force_file_collision?(destination, src, dst, file_options = {}, &block)
private
Ask the user interactively whether to force collision.
Show source
def force_file_collision?(destination, src, dst, file_options = {}, &block)
$stdout.print "overwrite #{destination}? [Ynaqd] "
case $stdin.gets
when /d/i
Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
temp.write render_file(src, file_options, &block)
temp.rewind
$stdout.puts `
end
puts "retrying"
raise 'retry diff'
when /a/i
$stdout.puts "forcing #{spec.name}"
options[:collision] = :force
when /q/i
$stdout.puts "aborting #{spec.name}"
raise SystemExit
when /n/i then :skip
else :force
end
rescue
retry
end