From ce4aa1d3330cdd493ce191f79f1dc9a7cd5379e8 Mon Sep 17 00:00:00 2001 From: Tom Vaughan Date: Mon, 20 Aug 2012 15:10:40 -0700 Subject: [PATCH] run rsync command as a post-build step (works) --- lib/middleman-deploy/extension.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/middleman-deploy/extension.rb b/lib/middleman-deploy/extension.rb index 8c56f64..9005f39 100644 --- a/lib/middleman-deploy/extension.rb +++ b/lib/middleman-deploy/extension.rb @@ -4,7 +4,7 @@ require "middleman-core" # Extension namespace module Middleman module Deploy - class Options < Struct.new(:host, :port, :user, :path); end + class Options < Struct.new(:delete, :host, :port, :user, :path); end class << self @@ -12,6 +12,7 @@ module Middleman options = Options.new(options_hash) yield options if block_given? + options.delete ||= false options.port ||= 22 app.after_configuration do @@ -31,6 +32,10 @@ end EOF 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 alias :included :registered end