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 railties/lib/rails_generator/commands.rb, line 514
514:         def complex_template(*args)
515:           # nothing should be done here
516:         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 railties/lib/rails_generator/commands.rb, line 478
478:         def directory(relative_path)
479:           parts = relative_path.split('/')
480:           until parts.empty?
481:             partial = File.join(parts)
482:             path = destination_path(partial)
483:             if File.exist?(path)
484:               if Dir[File.join(path, '*')].empty?
485:                 logger.rmdir partial
486:                 unless options[:pretend]
487:                   if options[:svn]
488:                     # If the directory has been marked to be added
489:                     # but has not yet been checked in, revert and delete
490:                     if options[:svn][relative_path]
491:                       system("svn revert #{path}")
492:                       FileUtils.rmdir(path)
493:                     else
494:                     # If the directory is not in the status list, it
495:                     # has no modifications so we can simply remove it
496:                       system("svn rm #{path}")
497:                     end
498:                   # I don't think git needs to remove directories?..
499:                   # or maybe they have special consideration...
500:                   else
501:                     FileUtils.rmdir(path)
502:                   end
503:                 end
504:               else
505:                 logger.notempty partial
506:               end
507:             else
508:               logger.missing partial
509:             end
510:             parts.pop
511:           end
512:         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 railties/lib/rails_generator/commands.rb, line 433
433:         def file(relative_source, relative_destination, file_options = {})
434:           destination = destination_path(relative_destination)
435:           if File.exist?(destination)
436:             logger.rm relative_destination
437:             unless options[:pretend]
438:               if options[:svn]
439:                 # If the file has been marked to be added
440:                 # but has not yet been checked in, revert and delete
441:                 if options[:svn][relative_destination]
442:                   system("svn revert #{destination}")
443:                   FileUtils.rm(destination)
444:                 else
445:                 # If the directory is not in the status list, it
446:                 # has no modifications so we can simply remove it
447:                   system("svn rm #{destination}")
448:                 end
449:               elsif options[:git]
450:                 if options[:git][:new][relative_destination]
451:                   # file has been added, but not committed
452:                   system("git reset HEAD #{relative_destination}")
453:                   FileUtils.rm(destination)
454:                 elsif options[:git][:modified][relative_destination]
455:                   # file is committed and modified
456:                   system("git rm -f #{relative_destination}")
457:                 else
458:                   # If the directory is not in the status list, it
459:                   # has no modifications so we can simply remove it
460:                   system("git rm #{relative_destination}")
461:                 end
462:               else
463:                 FileUtils.rm(destination)
464:               end
465:             end
466:           else
467:             logger.missing relative_destination
468:             return
469:           end
470:         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 railties/lib/rails_generator/commands.rb, line 519
519:         def migration_template(relative_source, relative_destination, template_options = {})
520:           migration_directory relative_destination
521: 
522:           migration_file_name = template_options[:migration_file_name] || file_name
523:           unless migration_exists?(migration_file_name)
524:             puts "There is no migration named #{migration_file_name}"
525:             return
526:           end
527: 
528: 
529:           existing_migrations(migration_file_name).each do |file_path|
530:             file(relative_source, file_path, template_options)
531:           end
532:         end
route_resources(*resources)
     # File railties/lib/rails_generator/commands.rb, line 534
534:         def route_resources(*resources)
535:           resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
536:           look_for = "\n  map.resources #{resource_list}\n"
537:           logger.route "map.resources #{resource_list}"
538:           gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
539:         end
template(relative_source, relative_destination, file_options = {})

Alias for file