def file(relative_source, relative_destination, file_options = {}, &block)
source = source_path(relative_source)
destination = destination_path(relative_destination)
destination_exists = File.exist?(destination)
if destination_exists and identical?(source, destination, &block)
return logger.identical(relative_destination)
end
if destination_exists
choice = case (file_options[:collision] || options[:collision]).to_sym
when :ask then force_file_collision?(relative_destination, source, destination, file_options, &block)
when :force then :force
when :skip then :skip
else raise "Invalid collision option: #{options[:collision].inspect}"
end
case choice
when :force then logger.force(relative_destination)
when :skip then return(logger.skip(relative_destination))
else raise "Invalid collision choice: #{choice}.inspect"
end
else
logger.create relative_destination
end
return if options[:pretend]
File.open(destination, 'wb') do |dest|
dest.write render_file(source, file_options, &block)
end
if file_options[:chmod]
FileUtils.chmod(file_options[:chmod], destination)
end
system("svn add #{destination}") if options[:svn]
end