Rename to build_before
and add corresponding command-line option.
This commit is contained in:
parent
8c9b79688a
commit
3b9b8093d3
3 changed files with 19 additions and 4 deletions
|
@ -120,7 +120,13 @@ Adjust these values accordingly.
|
||||||
## Step 4
|
## Step 4
|
||||||
|
|
||||||
middleman build [--clean]
|
middleman build [--clean]
|
||||||
middleman deploy [--clean]
|
middleman deploy [--clean --build-before]
|
||||||
|
|
||||||
|
To run `middleman build` before `middleman deploy`, add:
|
||||||
|
|
||||||
|
deploy.build_before = true
|
||||||
|
|
||||||
|
Default is `false`.
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,17 @@ module Middleman
|
||||||
:type => :boolean,
|
:type => :boolean,
|
||||||
:aliases => "-c",
|
:aliases => "-c",
|
||||||
:desc => "Remove orphaned files or directories on the remote host"
|
:desc => "Remove orphaned files or directories on the remote host"
|
||||||
|
method_option "build_before",
|
||||||
|
:type => :boolean,
|
||||||
|
:aliases => "-b",
|
||||||
|
:desc => "Run `middleman build` before the deploy step"
|
||||||
def deploy
|
def deploy
|
||||||
Middleman::Cli::Build.new.build if self.deploy_options.force_build
|
if options.has_key? "build_before"
|
||||||
|
build_before = options.build_before
|
||||||
|
else
|
||||||
|
build_before = self.deploy_options.build_before
|
||||||
|
end
|
||||||
|
Middleman::Cli::Build.new.build if build_before
|
||||||
send("deploy_#{self.deploy_options.method}")
|
send("deploy_#{self.deploy_options.method}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ require "middleman-core"
|
||||||
module Middleman
|
module Middleman
|
||||||
module Deploy
|
module Deploy
|
||||||
|
|
||||||
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :force_build); end
|
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :build_before); end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ module Middleman
|
||||||
options.remote ||= "origin"
|
options.remote ||= "origin"
|
||||||
options.branch ||= "gh-pages"
|
options.branch ||= "gh-pages"
|
||||||
|
|
||||||
options.force_build ||= false
|
options.build_before ||= false
|
||||||
|
|
||||||
@@options = options
|
@@options = options
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue