diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-10-11 15:15:32 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-10-11 15:15:32 +0000 |
commit | c8d9a07a0029e2bf897db8e976fd203808b519c4 (patch) | |
tree | 2000f215e66735ec7fe4b448dcf0c25ca764d6b3 /railties | |
parent | 21b51eda632ab202bd2eeaa726a05af52a38bad0 (diff) | |
download | rails-c8d9a07a0029e2bf897db8e976fd203808b519c4.tar.gz rails-c8d9a07a0029e2bf897db8e976fd203808b519c4.tar.bz2 rails-c8d9a07a0029e2bf897db8e976fd203808b519c4.zip |
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
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index 4b6f7ecd15..b541c6f65d 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -93,9 +93,9 @@ module Rails private # Ask the user interactively whether to force collision. def force_file_collision?(destination, src, dst, file_options = {}, &block) - $stdout.print "overwrite #{destination}? [Ynaqd] " - case $stdin.gets - when /d/i + $stdout.print "overwrite #{destination}? (enter \"h\" for help) [Ynaqdh] " + case $stdin.gets.chomp + when /\Ad\z/i Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp| temp.write render_file(src, file_options, &block) temp.rewind @@ -103,14 +103,24 @@ module Rails end puts "retrying" raise 'retry diff' - when /a/i + when /\Aa\z/i $stdout.puts "forcing #{spec.name}" options[:collision] = :force - when /q/i + when /\Aq\z/i $stdout.puts "aborting #{spec.name}" raise SystemExit - when /n/i then :skip - else :force + when /\An\z/i then :skip + 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 rescue retry |