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



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/synco/methods/scp.rb', line 15

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



11
12
13
# File 'lib/synco/methods/scp.rb', line 11

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