Class: LSync::Methods::RSyncSnapshot

Inherits:
RSync show all
Defined in:
lib/lsync/methods/rsync.rb

Instance Method Summary collapse

Methods inherited from RSync

#initialize, #run_handler, #should_run?

Methods inherited from LSync::Method

#initialize, #should_run?

Methods included from EventHandler

#abort!, #fire, #on, #try

Constructor Details

This class inherits a constructor from LSync::Methods::RSync

Instance Method Details

#inprogress_pathObject


142
143
144
# File 'lib/lsync/methods/rsync.rb', line 142

def inprogress_path
	@options[:inprogress_path] || "backup.inprogress"
end

#run(controller) ⇒ Object


146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/lsync/methods/rsync.rb', line 146

def run(controller)
	directory = controller.directory
	arguments = (@options[:arguments] || []) + (directory.options[:arguments] || [])
	
	link_dest = Pathname.new("../" * (directory.path.depth + 1)) + "latest" + directory.path
	arguments += ['--archive', '--link-dest', link_dest.to_s]

	destination_directory = File.join(inprogress_path, directory.path)

	local_server, remote_server, source, destination = configuration(controller, controller.directory, destination_directory)

	arguments += connect_arguments(local_server, remote_server)

	# Create the destination backup directory
	controller.target.exec!(["mkdir", "-p", controller.target.full_path(destination_directory)])

	run_handler(controller, local_server, source, destination, arguments)
end