Class: Synco::Methods::SCP

Inherits:
Synco::Method show all
Defined in:
lib/synco/methods/scp.rb

Instance Attribute Summary

Attributes inherited from Synco::Method

#arguments, #options

Attributes inherited from Controller

#events

Instance Method Summary collapse

Methods inherited from Synco::Method

#initialize

Methods inherited from Controller

#abort!, build, #fire, #freeze, #initialize, #on, #try

Constructor Details

This class inherits a constructor from Synco::Method

Instance Method Details

#call(scope) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/synco/methods/scp.rb', line 30

def call(scope)
	server = scope.current_server
	directory = scope.directory
	
	server.run(
		*@command,
		*arguments,
		# If the destination directory already exists, scp will create the source directory inside the destinatio directory. This behaviour means that running scp multiple times gives different results, i.e. the first time it will copy source/* to destination/*, but the second time you will end up with destination/source/*. Putting a dot after the first path alleviates this issue for some reason.
		scope.master_server.connection_string(directory, on: server) + '.',
		scope.target_server.connection_string(directory, on: server)
	)
end

#default_commandObject



26
27
28
# File 'lib/synco/methods/scp.rb', line 26

def default_command
	['scp', '-pr']
end