Class: Middleman::Deploy::Methods::Rsync
- Defined in:
- lib/middleman-deploy/methods/rsync.rb
Instance Attribute Summary collapse
-
#clean ⇒ Object
readonly
Returns the value of attribute clean.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(server_instance, options = {}) ⇒ Rsync
constructor
A new instance of Rsync.
- #process ⇒ Object
Constructor Details
#initialize(server_instance, options = {}) ⇒ Rsync
Returns a new instance of Rsync.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 8 def initialize(server_instance, ={}) super(server_instance, ) @clean = self..clean @flags = self..flags @host = self..host @path = self..path @port = self..port @user = self..user end |
Instance Attribute Details
#clean ⇒ Object (readonly)
Returns the value of attribute clean.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def clean @clean end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def flags @flags end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def host @host end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def port @port end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 6 def user @user end |
Instance Method Details
#process ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/middleman-deploy/methods/rsync.rb', line 19 def process # Append "@" to user if provided. user = "#{self.user}@" if self.user && !self.user.empty? dest_url = "#{user}#{self.host}:#{self.path}" flags = self.flags || '-avz' command = "rsync #{flags} '-e ssh -p #{self.port}' #{self.server_instance.build_dir}/ #{dest_url}" if self.clean command += " --delete" end puts "## Deploying via rsync to #{dest_url} port=#{self.port}" run command end |