Class: DeepTest::Distributed::RSync::Args
- Inherits:
-
Object
- Object
- DeepTest::Distributed::RSync::Args
- Defined in:
- lib/deep_test/distributed/rsync.rb
Instance Method Summary collapse
- #command(destination) ⇒ Object
- #common_location_options ⇒ Object
- #destination_location(destination) ⇒ Object
-
#initialize(connection_info, options) ⇒ Args
constructor
A new instance of Args.
- #source_location ⇒ Object
Constructor Details
#initialize(connection_info, options) ⇒ Args
Returns a new instance of Args.
13 14 15 16 17 18 |
# File 'lib/deep_test/distributed/rsync.rb', line 13 def initialize(connection_info, ) @connection_info = connection_info @options = @sync_options = . raise "Pushing code to a daemon isn't supported at the moment" if @sync_options[:daemon] && @sync_options[:push_code] end |
Instance Method Details
#command(destination) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/deep_test/distributed/rsync.rb', line 20 def command(destination) # The '/' after source tells rsync to copy the contents # of source to destination, rather than the source directory # itself "rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination_location(destination)} 2>&1".strip.squeeze(" ") end |
#common_location_options ⇒ Object
39 40 41 42 43 44 |
# File 'lib/deep_test/distributed/rsync.rb', line 39 def loc = "" loc << @sync_options[:username] << '@' if @sync_options[:username] loc << @connection_info.address loc << (@sync_options[:daemon] ? '::' : ':') end |
#destination_location(destination) ⇒ Object
33 34 35 36 37 |
# File 'lib/deep_test/distributed/rsync.rb', line 33 def destination_location(destination) loc = "" loc << unless @sync_options[:local] || !@sync_options[:push_code] loc << destination end |
#source_location ⇒ Object
27 28 29 30 31 |
# File 'lib/deep_test/distributed/rsync.rb', line 27 def source_location loc = "" loc << unless @sync_options[:local] || @sync_options[:push_code] loc << @sync_options[:source] end |