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
- #tunnelize(rsync_command) ⇒ 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 26 |
# 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 cmd = "rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination_location(destination)} 2>&1".strip.squeeze(" ") @sync_options[:distribution_server_tunnel] ? tunnelize(cmd) : cmd end |
#common_location_options ⇒ Object
44 45 46 47 48 49 |
# File 'lib/deep_test/distributed/rsync.rb', line 44 def loc = "" loc << @sync_options[:username] << '@' if @sync_options[:username] loc << @connection_info.address loc << (@sync_options[:daemon] ? '::' : ':') end |
#destination_location(destination) ⇒ Object
38 39 40 41 42 |
# File 'lib/deep_test/distributed/rsync.rb', line 38 def destination_location(destination) loc = "" loc << unless @sync_options[:local] || !@sync_options[:push_code] loc << destination end |
#source_location ⇒ Object
32 33 34 35 36 |
# File 'lib/deep_test/distributed/rsync.rb', line 32 def source_location loc = "" loc << unless @sync_options[:local] || @sync_options[:push_code] loc << (@sync_options[:distribution_server_source] || @sync_options[:source]) end |
#tunnelize(rsync_command) ⇒ Object
28 29 30 |
# File 'lib/deep_test/distributed/rsync.rb', line 28 def tunnelize(rsync_command) "ssh #{@sync_options[:ssh_tunnel_options]} #{@sync_options[:username]}@#{@sync_options[:code_distribution_server]} 'cd #{source_location} && #{rsync_command}'" end |