Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7837

Show
Ignore:
Timestamp:
10/11/07 15:15:32 (2 years ago)
Author:
david
Message:

Added better documentation for generator overwrite options (closes #9842) [wincet]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/lib/rails_generator/commands.rb

    r7666 r7837  
    9494          # Ask the user interactively whether to force collision. 
    9595          def force_file_collision?(destination, src, dst, file_options = {}, &block) 
    96             $stdout.print "overwrite #{destination}? [Ynaqd] " 
    97             case $stdin.gets 
    98               when /d/i 
     96            $stdout.print "overwrite #{destination}? (enter \"h\" for help) [Ynaqdh] " 
     97            case $stdin.gets.chomp 
     98              when /\Ad\z/i 
    9999                Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp| 
    100100                  temp.write render_file(src, file_options, &block) 
     
    104104                puts "retrying" 
    105105                raise 'retry diff' 
    106               when /a/i 
     106              when /\Aa\z/i 
    107107                $stdout.puts "forcing #{spec.name}" 
    108108                options[:collision] = :force 
    109               when /q/i 
     109              when /\Aq\z/i 
    110110                $stdout.puts "aborting #{spec.name}" 
    111111                raise SystemExit 
    112               when /n/i then :skip 
    113               else :force 
     112              when /\An\z/i then :skip 
     113              when /\Ay\z/i then :force 
     114              else 
     115                $stdout.puts <<-HELP 
     116Y - yes, overwrite 
     117n - no, do not overwrite 
     118a - all, overwrite this and all others 
     119q - quit, abort 
     120d - diff, show the differences between the old and the new 
     121h - help, show this help 
     122HELP 
     123                raise 'retry' 
    114124            end 
    115125          rescue