3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/boatman/copyable.rb', line 3
def copy(file, params, remove_original=false, &block)
source_path = file.path
base_name = params[:rename] || File.basename(source_path)
destination_path = File.expand_path(params[:to] + "/" + base_name)
return if File.exists?(destination_path)
begin
copy_entry(source_path, destination_path, &block)
FileUtils.rm_r source_path if remove_original
Boatman.logger.info "Successfully copied #{source_path} to #{destination_path}"
rescue Exception => e
Boatman.logger.error "#{e.message} at #{e.backtrace[0]}"
end
end
|