mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added better documentation for generator overwrite options (closes #9842) [wincet]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7837 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
21b51eda63
commit
c8d9a07a00
1 changed files with 17 additions and 7 deletions
|
@ -93,9 +93,9 @@ module Rails
|
||||||
private
|
private
|
||||||
# Ask the user interactively whether to force collision.
|
# Ask the user interactively whether to force collision.
|
||||||
def force_file_collision?(destination, src, dst, file_options = {}, &block)
|
def force_file_collision?(destination, src, dst, file_options = {}, &block)
|
||||||
$stdout.print "overwrite #{destination}? [Ynaqd] "
|
$stdout.print "overwrite #{destination}? (enter \"h\" for help) [Ynaqdh] "
|
||||||
case $stdin.gets
|
case $stdin.gets.chomp
|
||||||
when /d/i
|
when /\Ad\z/i
|
||||||
Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
|
Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
|
||||||
temp.write render_file(src, file_options, &block)
|
temp.write render_file(src, file_options, &block)
|
||||||
temp.rewind
|
temp.rewind
|
||||||
|
@ -103,14 +103,24 @@ module Rails
|
||||||
end
|
end
|
||||||
puts "retrying"
|
puts "retrying"
|
||||||
raise 'retry diff'
|
raise 'retry diff'
|
||||||
when /a/i
|
when /\Aa\z/i
|
||||||
$stdout.puts "forcing #{spec.name}"
|
$stdout.puts "forcing #{spec.name}"
|
||||||
options[:collision] = :force
|
options[:collision] = :force
|
||||||
when /q/i
|
when /\Aq\z/i
|
||||||
$stdout.puts "aborting #{spec.name}"
|
$stdout.puts "aborting #{spec.name}"
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
when /n/i then :skip
|
when /\An\z/i then :skip
|
||||||
else :force
|
when /\Ay\z/i then :force
|
||||||
|
else
|
||||||
|
$stdout.puts <<-HELP
|
||||||
|
Y - yes, overwrite
|
||||||
|
n - no, do not overwrite
|
||||||
|
a - all, overwrite this and all others
|
||||||
|
q - quit, abort
|
||||||
|
d - diff, show the differences between the old and the new
|
||||||
|
h - help, show this help
|
||||||
|
HELP
|
||||||
|
raise 'retry'
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
retry
|
retry
|
||||||
|
|
Loading…
Reference in a new issue