Rename to `build_before` and add corresponding command-line option.

master
Tom Vaughan 2013-06-11 00:42:12 -04:00
parent 8c9b79688a
commit 3b9b8093d3
3 changed files with 19 additions and 4 deletions

View File

@ -120,7 +120,13 @@ Adjust these values accordingly.
## Step 4
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

View File

@ -27,8 +27,17 @@ module Middleman
:type => :boolean,
:aliases => "-c",
: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
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}")
end

View File

@ -5,7 +5,7 @@ require "middleman-core"
module Middleman
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
@ -22,7 +22,7 @@ module Middleman
options.remote ||= "origin"
options.branch ||= "gh-pages"
options.force_build ||= false
options.build_before ||= false
@@options = options