Undo the actions performed by a generator. Rewind the action manifest and attempt to completely erase the results of each action.

Methods
Public Instance methods
complex_template(*args)
     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 515
515:         def complex_template(*args)
516:           # nothing should be done here
517:         end
directory(relative_path)

Remove each directory in the given path from right to left. Remove each subdirectory if it exists and is a directory.

     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 479
479:         def directory(relative_path)
480:           parts = relative_path.split('/')
481:           until parts.empty?
482:             partial = File.join(parts)
483:             path = destination_path(partial)
484:             if File.exist?(path)
485:               if Dir[File.join(path, '*')].empty?
486:                 logger.rmdir partial
487:                 unless options[:pretend]
488:                   if options[:svn]
489:                     # If the directory has been marked to be added
490:                     # but has not yet been checked in, revert and delete
491:                     if options[:svn][relative_path]
492:                       system("svn revert #{path}")
493:                       FileUtils.rmdir(path)
494:                     else
495:                     # If the directory is not in the status list, it
496:                     # has no modifications so we can simply remove it
497:                       system("svn rm #{path}")
498:                     end
499:                   # I don't think git needs to remove directories?..
500:                   # or maybe they have special consideration...
501:                   else
502:                     FileUtils.rmdir(path)
503:                   end
504:                 end
505:               else
506:                 logger.notempty partial
507:               end
508:             else
509:               logger.missing partial
510:             end
511:             parts.pop
512:           end
513:         end
file(relative_source, relative_destination, file_options = {})

Remove a file if it exists and is a file.

This method is also aliased as template
     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 434
434:         def file(relative_source, relative_destination, file_options = {})
435:           destination = destination_path(relative_destination)
436:           if File.exist?(destination)
437:             logger.rm relative_destination
438:             unless options[:pretend]
439:               if options[:svn]
440:                 # If the file has been marked to be added
441:                 # but has not yet been checked in, revert and delete
442:                 if options[:svn][relative_destination]
443:                   system("svn revert #{destination}")
444:                   FileUtils.rm(destination)
445:                 else
446:                 # If the directory is not in the status list, it
447:                 # has no modifications so we can simply remove it
448:                   system("svn rm #{destination}")
449:                 end
450:               elsif options[:git]
451:                 if options[:git][:new][relative_destination]
452:                   # file has been added, but not committed
453:                   system("git reset HEAD #{relative_destination}")
454:                   FileUtils.rm(destination)
455:                 elsif options[:git][:modified][relative_destination]
456:                   # file is committed and modified
457:                   system("git rm -f #{relative_destination}")
458:                 else
459:                   # If the directory is not in the status list, it
460:                   # has no modifications so we can simply remove it
461:                   system("git rm #{relative_destination}")
462:                 end
463:               else
464:                 FileUtils.rm(destination)
465:               end
466:             end
467:           else
468:             logger.missing relative_destination
469:             return
470:           end
471:         end
migration_template(relative_source, relative_destination, template_options = {})

When deleting a migration, it knows to delete every file named "[0-9]*_#{file_name}".

     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 520
520:         def migration_template(relative_source, relative_destination, template_options = {})
521:           migration_directory relative_destination
522: 
523:           migration_file_name = template_options[:migration_file_name] || file_name
524:           unless migration_exists?(migration_file_name)
525:             puts "There is no migration named #{migration_file_name}"
526:             return
527:           end
528: 
529: 
530:           existing_migrations(migration_file_name).each do |file_path|
531:             file(relative_source, file_path, template_options)
532:           end
533:         end
route_resources(*resources)
     # File vendor/rails/railties/lib/rails_generator/commands.rb, line 535
535:         def route_resources(*resources)
536:           resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
537:           look_for = "\n  map.resources #{resource_list}\n"
538:           logger.route "map.resources #{resource_list}"
539:           gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
540:         end
template(relative_source, relative_destination, file_options = {})

Alias for file