run rsync command as a post-build step (works)
This commit is contained in:
parent
35c088912f
commit
ce4aa1d333
1 changed files with 6 additions and 1 deletions
|
@ -4,7 +4,7 @@ require "middleman-core"
|
||||||
# Extension namespace
|
# Extension namespace
|
||||||
module Middleman
|
module Middleman
|
||||||
module Deploy
|
module Deploy
|
||||||
class Options < Struct.new(:host, :port, :user, :path); end
|
class Options < Struct.new(:delete, :host, :port, :user, :path); end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ module Middleman
|
||||||
options = Options.new(options_hash)
|
options = Options.new(options_hash)
|
||||||
yield options if block_given?
|
yield options if block_given?
|
||||||
|
|
||||||
|
options.delete ||= false
|
||||||
options.port ||= 22
|
options.port ||= 22
|
||||||
|
|
||||||
app.after_configuration do
|
app.after_configuration do
|
||||||
|
@ -31,6 +32,10 @@ end
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
app.after_build do |builder|
|
||||||
|
builder.run "rsync -avze '" + "ssh -p #{options.port}" + "' #{"--delete" if options.delete == true} build/ #{options.user}@#{options.host}:#{options.path}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue