aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rwxr-xr-xrailties/bin/rails2
-rw-r--r--railties/lib/generators/erb.rb (renamed from railties/lib/rails/generators/erb.rb)0
-rw-r--r--railties/lib/generators/erb/controller/controller_generator.rb (renamed from railties/lib/rails/generators/erb/controller/controller_generator.rb)2
-rw-r--r--railties/lib/generators/erb/controller/templates/view.html.erb (renamed from railties/lib/rails/generators/erb/controller/templates/view.html.erb)0
-rw-r--r--railties/lib/generators/erb/mailer/mailer_generator.rb (renamed from railties/lib/rails/generators/erb/mailer/mailer_generator.rb)2
-rw-r--r--railties/lib/generators/erb/mailer/templates/view.erb (renamed from railties/lib/rails/generators/erb/mailer/templates/view.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/scaffold_generator.rb (renamed from railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb)2
-rw-r--r--railties/lib/generators/erb/scaffold/templates/_form.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/templates/edit.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/templates/index.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/index.html.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/templates/layout.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/templates/new.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/new.html.erb)0
-rw-r--r--railties/lib/generators/erb/scaffold/templates/show.html.erb (renamed from railties/lib/rails/generators/erb/scaffold/templates/show.html.erb)0
-rw-r--r--railties/lib/generators/rails/app/USAGE (renamed from railties/lib/rails/generators/rails/app/USAGE)0
-rw-r--r--railties/lib/generators/rails/app/app_generator.rb (renamed from railties/lib/rails/generators/rails/app/app_generator.rb)6
-rw-r--r--railties/lib/generators/rails/app/templates/Gemfile (renamed from railties/lib/rails/generators/rails/app/templates/Gemfile)0
-rw-r--r--railties/lib/generators/rails/app/templates/README (renamed from railties/lib/rails/generators/rails/app/templates/README)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/Rakefile (renamed from railties/lib/rails/generators/rails/app/templates/Rakefile)0
-rw-r--r--railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb (renamed from railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb (renamed from railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/app/models/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/app/templates/config.ru (renamed from railties/lib/rails/generators/rails/app/templates/config.ru)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/application.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/application.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/boot.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/boot.rb)13
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/frontbase.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/mysql.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/oracle.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/postgresql.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/environment.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/environment.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/environments/development.rb.tt (renamed from railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/environments/production.rb.tt (renamed from railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/environments/test.rb.tt (renamed from railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt (renamed from railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/initializers/inflections.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt (renamed from railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/locales/en.yml (renamed from railties/lib/rails/generators/rails/app/templates/config/locales/en.yml)0
-rw-r--r--railties/lib/generators/rails/app/templates/config/routes.rb (renamed from railties/lib/rails/generators/rails/app/templates/config/routes.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/db/seeds.rb (renamed from railties/lib/rails/generators/rails/app/templates/db/seeds.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/doc/README_FOR_APP (renamed from railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP)0
-rw-r--r--railties/lib/generators/rails/app/templates/gitignore (renamed from railties/lib/rails/generators/rails/app/templates/gitignore)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/404.html (renamed from railties/lib/rails/generators/rails/app/templates/public/404.html)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/422.html (renamed from railties/lib/rails/generators/rails/app/templates/public/422.html)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/500.html (renamed from railties/lib/rails/generators/rails/app/templates/public/500.html)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/favicon.ico (renamed from railties/lib/rails/generators/rails/app/templates/public/favicon.ico)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/images/rails.png (renamed from railties/lib/rails/generators/rails/app/templates/public/images/rails.png)bin6646 -> 6646 bytes
-rw-r--r--railties/lib/generators/rails/app/templates/public/index.html (renamed from railties/lib/rails/generators/rails/app/templates/public/index.html)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/application.js (renamed from railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/controls.js (renamed from railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js (renamed from railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/effects.js (renamed from railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/prototype.js (renamed from railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/robots.txt (renamed from railties/lib/rails/generators/rails/app/templates/public/robots.txt)0
-rw-r--r--railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/about (renamed from railties/lib/rails/generators/rails/app/templates/script/about)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/console.tt (renamed from railties/lib/rails/generators/rails/app/templates/script/console.tt)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/dbconsole.tt (renamed from railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/destroy (renamed from railties/lib/rails/generators/rails/app/templates/script/destroy)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/generate (renamed from railties/lib/rails/generators/rails/app/templates/script/generate)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/performance/benchmarker (renamed from railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/performance/profiler (renamed from railties/lib/rails/generators/rails/app/templates/script/performance/profiler)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/plugin (renamed from railties/lib/rails/generators/rails/app/templates/script/plugin)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/runner (renamed from railties/lib/rails/generators/rails/app/templates/script/runner)0
-rwxr-xr-xrailties/lib/generators/rails/app/templates/script/server.tt (renamed from railties/lib/rails/generators/rails/app/templates/script/server.tt)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/functional/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/integration/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb (renamed from railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/test_helper.rb (renamed from railties/lib/rails/generators/rails/app/templates/test/test_helper.rb)0
-rw-r--r--railties/lib/generators/rails/app/templates/test/unit/.empty_directory (renamed from railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/controller/USAGE (renamed from railties/lib/rails/generators/rails/controller/USAGE)0
-rw-r--r--railties/lib/generators/rails/controller/controller_generator.rb (renamed from railties/lib/rails/generators/rails/controller/controller_generator.rb)0
-rw-r--r--railties/lib/generators/rails/controller/templates/controller.rb (renamed from railties/lib/rails/generators/rails/controller/templates/controller.rb)0
-rw-r--r--railties/lib/generators/rails/generator/USAGE (renamed from railties/lib/rails/generators/rails/generator/USAGE)0
-rw-r--r--railties/lib/generators/rails/generator/generator_generator.rb (renamed from railties/lib/rails/generators/rails/generator/generator_generator.rb)0
-rw-r--r--railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt (renamed from railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt)0
-rw-r--r--railties/lib/generators/rails/generator/templates/USAGE.tt (renamed from railties/lib/rails/generators/rails/generator/templates/USAGE.tt)0
-rw-r--r--railties/lib/generators/rails/generator/templates/templates/.empty_directory (renamed from railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory)0
-rw-r--r--railties/lib/generators/rails/helper/USAGE (renamed from railties/lib/rails/generators/rails/helper/USAGE)0
-rw-r--r--railties/lib/generators/rails/helper/helper_generator.rb (renamed from railties/lib/rails/generators/rails/helper/helper_generator.rb)0
-rw-r--r--railties/lib/generators/rails/helper/templates/helper.rb (renamed from railties/lib/rails/generators/rails/helper/templates/helper.rb)0
-rw-r--r--railties/lib/generators/rails/integration_test/USAGE (renamed from railties/lib/rails/generators/rails/integration_test/USAGE)0
-rw-r--r--railties/lib/generators/rails/integration_test/integration_test_generator.rb (renamed from railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb)0
-rw-r--r--railties/lib/generators/rails/mailer/USAGE (renamed from railties/lib/rails/generators/rails/mailer/USAGE)4
-rw-r--r--railties/lib/generators/rails/mailer/mailer_generator.rb (renamed from railties/lib/rails/generators/rails/mailer/mailer_generator.rb)2
-rw-r--r--railties/lib/generators/rails/mailer/templates/mailer.rb (renamed from railties/lib/rails/generators/rails/mailer/templates/mailer.rb)0
-rw-r--r--railties/lib/generators/rails/metal/USAGE (renamed from railties/lib/rails/generators/rails/metal/USAGE)0
-rw-r--r--railties/lib/generators/rails/metal/metal_generator.rb (renamed from railties/lib/rails/generators/rails/metal/metal_generator.rb)0
-rw-r--r--railties/lib/generators/rails/metal/templates/metal.rb (renamed from railties/lib/rails/generators/rails/metal/templates/metal.rb)0
-rw-r--r--railties/lib/generators/rails/migration/USAGE (renamed from railties/lib/rails/generators/rails/migration/USAGE)0
-rw-r--r--railties/lib/generators/rails/migration/migration_generator.rb (renamed from railties/lib/rails/generators/rails/migration/migration_generator.rb)0
-rw-r--r--railties/lib/generators/rails/model/USAGE (renamed from railties/lib/rails/generators/rails/model/USAGE)0
-rw-r--r--railties/lib/generators/rails/model/model_generator.rb (renamed from railties/lib/rails/generators/rails/model/model_generator.rb)0
-rw-r--r--railties/lib/generators/rails/model_subclass/model_subclass_generator.rb (renamed from railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb)1
-rw-r--r--railties/lib/generators/rails/observer/USAGE (renamed from railties/lib/rails/generators/rails/observer/USAGE)0
-rw-r--r--railties/lib/generators/rails/observer/observer_generator.rb (renamed from railties/lib/rails/generators/rails/observer/observer_generator.rb)0
-rw-r--r--railties/lib/generators/rails/performance_test/USAGE (renamed from railties/lib/rails/generators/rails/performance_test/USAGE)0
-rw-r--r--railties/lib/generators/rails/performance_test/performance_test_generator.rb (renamed from railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb)0
-rw-r--r--railties/lib/generators/rails/plugin/USAGE (renamed from railties/lib/rails/generators/rails/plugin/USAGE)0
-rw-r--r--railties/lib/generators/rails/plugin/plugin_generator.rb (renamed from railties/lib/rails/generators/rails/plugin/plugin_generator.rb)14
-rw-r--r--railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt (renamed from railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/README.tt (renamed from railties/lib/rails/generators/rails/plugin/templates/README)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/Rakefile.tt (renamed from railties/lib/rails/generators/rails/plugin/templates/Rakefile)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/init.rb (renamed from railties/lib/rails/generators/rails/plugin/templates/init.rb)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/install.rb (renamed from railties/lib/rails/generators/rails/plugin/templates/install.rb)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt (renamed from railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt (renamed from railties/lib/rails/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt)0
-rw-r--r--railties/lib/generators/rails/plugin/templates/uninstall.rb (renamed from railties/lib/rails/generators/rails/plugin/templates/uninstall.rb)0
-rw-r--r--railties/lib/generators/rails/resource/USAGE (renamed from railties/lib/rails/generators/rails/resource/USAGE)0
-rw-r--r--railties/lib/generators/rails/resource/resource_generator.rb (renamed from railties/lib/rails/generators/rails/resource/resource_generator.rb)2
-rw-r--r--railties/lib/generators/rails/scaffold/USAGE (renamed from railties/lib/rails/generators/rails/scaffold/USAGE)0
-rw-r--r--railties/lib/generators/rails/scaffold/scaffold_generator.rb (renamed from railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb)2
-rw-r--r--railties/lib/generators/rails/scaffold_controller/USAGE (renamed from railties/lib/rails/generators/rails/scaffold_controller/USAGE)0
-rw-r--r--railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb (renamed from railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb)0
-rw-r--r--railties/lib/generators/rails/scaffold_controller/templates/controller.rb (renamed from railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb)0
-rw-r--r--railties/lib/generators/rails/session_migration/USAGE (renamed from railties/lib/rails/generators/rails/session_migration/USAGE)0
-rw-r--r--railties/lib/generators/rails/session_migration/session_migration_generator.rb (renamed from railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb)0
-rw-r--r--railties/lib/generators/rails/stylesheets/USAGE (renamed from railties/lib/rails/generators/rails/stylesheets/USAGE)0
-rw-r--r--railties/lib/generators/rails/stylesheets/stylesheets_generator.rb (renamed from railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb)0
-rw-r--r--railties/lib/generators/rails/stylesheets/templates/scaffold.css (renamed from railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css)0
-rw-r--r--railties/lib/generators/test_unit.rb (renamed from railties/lib/rails/generators/test_unit.rb)0
-rw-r--r--railties/lib/generators/test_unit/controller/controller_generator.rb (renamed from railties/lib/rails/generators/test_unit/controller/controller_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/controller/templates/functional_test.rb (renamed from railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/helper/helper_generator.rb (renamed from railties/lib/rails/generators/test_unit/helper/helper_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/helper/templates/helper_test.rb (renamed from railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/integration/integration_generator.rb (renamed from railties/lib/rails/generators/test_unit/integration/integration_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/integration/templates/integration_test.rb (renamed from railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/mailer/mailer_generator.rb (renamed from railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb)4
-rw-r--r--railties/lib/generators/test_unit/mailer/templates/fixture (renamed from railties/lib/rails/generators/test_unit/mailer/templates/fixture)0
-rw-r--r--railties/lib/generators/test_unit/mailer/templates/functional_test.rb (renamed from railties/lib/rails/generators/test_unit/mailer/templates/unit_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/model/model_generator.rb (renamed from railties/lib/rails/generators/test_unit/model/model_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/model/templates/fixtures.yml (renamed from railties/lib/rails/generators/test_unit/model/templates/fixtures.yml)0
-rw-r--r--railties/lib/generators/test_unit/model/templates/unit_test.rb (renamed from railties/lib/rails/generators/test_unit/model/templates/unit_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/observer/observer_generator.rb (renamed from railties/lib/rails/generators/test_unit/observer/observer_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/observer/templates/unit_test.rb (renamed from railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/performance/performance_generator.rb (renamed from railties/lib/rails/generators/test_unit/performance/performance_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/performance/templates/performance_test.rb (renamed from railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb)0
-rw-r--r--railties/lib/generators/test_unit/plugin/plugin_generator.rb (renamed from railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt (renamed from railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt)0
-rw-r--r--railties/lib/generators/test_unit/plugin/templates/test_helper.rb (renamed from railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb)0
-rw-r--r--railties/lib/generators/test_unit/scaffold/scaffold_generator.rb (renamed from railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb)2
-rw-r--r--railties/lib/generators/test_unit/scaffold/templates/functional_test.rb (renamed from railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb)0
-rw-r--r--railties/lib/rails.rb5
-rw-r--r--railties/lib/rails/application.rb14
-rw-r--r--railties/lib/rails/backtrace_cleaner.rb31
-rw-r--r--railties/lib/rails/bootstrap.rb11
-rw-r--r--railties/lib/rails/configuration.rb23
-rw-r--r--railties/lib/rails/deprecation.rb6
-rw-r--r--railties/lib/rails/generators.rb184
-rw-r--r--railties/lib/rails/generators/active_record.rb23
-rw-r--r--railties/lib/rails/generators/active_record/migration/migration_generator.rb25
-rw-r--r--railties/lib/rails/generators/active_record/migration/templates/migration.rb11
-rw-r--r--railties/lib/rails/generators/active_record/model/model_generator.rb33
-rw-r--r--railties/lib/rails/generators/active_record/model/templates/migration.rb16
-rw-r--r--railties/lib/rails/generators/active_record/model/templates/model.rb5
-rw-r--r--railties/lib/rails/generators/active_record/observer/observer_generator.rb15
-rw-r--r--railties/lib/rails/generators/active_record/observer/templates/observer.rb2
-rw-r--r--railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb24
-rw-r--r--railties/lib/rails/generators/active_record/session_migration/templates/migration.rb16
-rw-r--r--railties/lib/rails/generators/base.rb8
-rw-r--r--railties/lib/rails/generators/named_base.rb8
-rw-r--r--railties/lib/rails/generators/resource_helpers.rb10
-rw-r--r--railties/lib/rails/plugin.rb8
-rw-r--r--railties/lib/rails/rack.rb5
-rw-r--r--railties/lib/rails/rack/metal.rb26
-rw-r--r--railties/lib/rails/subscriber.rb2
-rw-r--r--railties/lib/rails/tasks/documentation.rake2
-rw-r--r--railties/lib/rails/tasks/framework.rake7
-rw-r--r--railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb9
-rw-r--r--railties/test/application/middleware_test.rb2
-rw-r--r--railties/test/application/notifications_test.rb2
-rw-r--r--railties/test/backtrace_cleaner_test.rb4
-rw-r--r--railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb (renamed from railties/test/fixtures/lib/generators/active_record/fixjour/fixjour_generator.rb)2
-rw-r--r--railties/test/fixtures/lib/generators/rails/javascripts_generator.rb4
-rw-r--r--railties/test/fixtures/lib/generators/wrong_generator.rb (renamed from railties/test/fixtures/vendor/gems/gems/wrong/lib/generators/wrong_generator.rb)0
-rw-r--r--railties/test/fixtures/vendor/another_gem_path/xspec/lib/generators/xspec_generator.rb2
-rw-r--r--railties/test/fixtures/vendor/plugins/mspec/lib/rails_generators/mspec_generator.rb2
-rw-r--r--railties/test/generators/actions_test.rb18
-rw-r--r--railties/test/generators/app_generator_test.rb16
-rw-r--r--railties/test/generators/controller_generator_test.rb5
-rw-r--r--railties/test/generators/generator_generator_test.rb5
-rw-r--r--railties/test/generators/generators_test_helper.rb22
-rw-r--r--railties/test/generators/helper_generator_test.rb5
-rw-r--r--railties/test/generators/integration_test_generator_test.rb5
-rw-r--r--railties/test/generators/mailer_generator_test.rb13
-rw-r--r--railties/test/generators/metal_generator_test.rb5
-rw-r--r--railties/test/generators/migration_generator_test.rb6
-rw-r--r--railties/test/generators/model_generator_test.rb5
-rw-r--r--railties/test/generators/named_base_test.rb5
-rw-r--r--railties/test/generators/observer_generator_test.rb5
-rw-r--r--railties/test/generators/performance_test_generator_test.rb5
-rw-r--r--railties/test/generators/plugin_generator_test.rb20
-rw-r--r--railties/test/generators/resource_generator_test.rb5
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb5
-rw-r--r--railties/test/generators/scaffold_generator_test.rb5
-rw-r--r--railties/test/generators/session_migration_generator_test.rb6
-rw-r--r--railties/test/generators/stylesheets_generator_test.rb6
-rw-r--r--railties/test/generators_test.rb137
-rw-r--r--railties/test/subscriber_test.rb6
203 files changed, 426 insertions, 503 deletions
diff --git a/railties/bin/rails b/railties/bin/rails
index b8b2d6188f..afcd9fd0be 100755
--- a/railties/bin/rails
+++ b/railties/bin/rails
@@ -22,6 +22,6 @@ ARGV << "--help" if ARGV.empty?
require 'rails/generators'
-require 'rails/generators/rails/app/app_generator'
+require 'generators/rails/app/app_generator'
Rails::Generators::AppGenerator.start
diff --git a/railties/lib/rails/generators/erb.rb b/railties/lib/generators/erb.rb
index d468d012dc..d468d012dc 100644
--- a/railties/lib/rails/generators/erb.rb
+++ b/railties/lib/generators/erb.rb
diff --git a/railties/lib/rails/generators/erb/controller/controller_generator.rb b/railties/lib/generators/erb/controller/controller_generator.rb
index f8780d9c33..ab7b273662 100644
--- a/railties/lib/rails/generators/erb/controller/controller_generator.rb
+++ b/railties/lib/generators/erb/controller/controller_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/erb'
+require 'generators/erb'
module Erb
module Generators
diff --git a/railties/lib/rails/generators/erb/controller/templates/view.html.erb b/railties/lib/generators/erb/controller/templates/view.html.erb
index cd54d13d83..cd54d13d83 100644
--- a/railties/lib/rails/generators/erb/controller/templates/view.html.erb
+++ b/railties/lib/generators/erb/controller/templates/view.html.erb
diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/generators/erb/mailer/mailer_generator.rb
index 5266259e2f..4ec2f4c9f4 100644
--- a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
+++ b/railties/lib/generators/erb/mailer/mailer_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/erb'
+require 'generators/erb'
module Erb
module Generators
diff --git a/railties/lib/rails/generators/erb/mailer/templates/view.erb b/railties/lib/generators/erb/mailer/templates/view.erb
index fcce7bd805..fcce7bd805 100644
--- a/railties/lib/rails/generators/erb/mailer/templates/view.erb
+++ b/railties/lib/generators/erb/mailer/templates/view.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/generators/erb/scaffold/scaffold_generator.rb
index de5b0e9c5d..846540476f 100644
--- a/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/erb/scaffold/scaffold_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/erb'
+require 'generators/erb'
require 'rails/generators/resource_helpers'
module Erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/generators/erb/scaffold/templates/_form.html.erb
index 9c19a09616..9c19a09616 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/_form.html.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/generators/erb/scaffold/templates/edit.html.erb
index 5bc507ffc8..5bc507ffc8 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/edit.html.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb b/railties/lib/generators/erb/scaffold/templates/index.html.erb
index b5c7fd1e58..b5c7fd1e58 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/index.html.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/generators/erb/scaffold/templates/layout.html.erb
index 7aa049fe80..7aa049fe80 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/layout.html.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb b/railties/lib/generators/erb/scaffold/templates/new.html.erb
index 9a1c489331..9a1c489331 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/new.html.erb
diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/generators/erb/scaffold/templates/show.html.erb
index 24f13fc0f8..24f13fc0f8 100644
--- a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/show.html.erb
diff --git a/railties/lib/rails/generators/rails/app/USAGE b/railties/lib/generators/rails/app/USAGE
index 36d6061a59..36d6061a59 100644
--- a/railties/lib/rails/generators/rails/app/USAGE
+++ b/railties/lib/generators/rails/app/USAGE
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb
index d58d245168..2e34992b3b 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/generators/rails/app/app_generator.rb
@@ -5,7 +5,7 @@ require 'rails/version' unless defined?(Rails::VERSION)
module Rails::Generators
# We need to store the RAILS_DEV_PATH in a constant, otherwise the path
# can change in Ruby 1.8.7 when we FileUtils.cd.
- RAILS_DEV_PATH = File.expand_path("../../../../../..", File.dirname(__FILE__))
+ RAILS_DEV_PATH = File.expand_path("../../../../..", File.dirname(__FILE__))
class AppGenerator < Base
DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
@@ -35,7 +35,7 @@ module Rails::Generators
:desc => "Skip Prototype files"
class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false,
- :desc => "Skip Git ignores and keeps"
+ :desc => "Skip Git ignores and keeps"
# Add bin/rails options
class_option :version, :type => :boolean, :aliases => "-v", :group => :rails,
@@ -87,7 +87,7 @@ module Rails::Generators
end
def create_boot_file
- copy_file "config/boot.rb"
+ template "config/boot.rb"
end
def create_activerecord_files
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/generators/rails/app/templates/Gemfile
index 7b5c89c3e2..7b5c89c3e2 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/generators/rails/app/templates/Gemfile
diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/generators/rails/app/templates/README
index 37ec8ea211..37ec8ea211 100644
--- a/railties/lib/rails/generators/rails/app/templates/README
+++ b/railties/lib/generators/rails/app/templates/README
diff --git a/railties/lib/rails/generators/rails/app/templates/Rakefile b/railties/lib/generators/rails/app/templates/Rakefile
index c19ad0e945..c19ad0e945 100755
--- a/railties/lib/rails/generators/rails/app/templates/Rakefile
+++ b/railties/lib/generators/rails/app/templates/Rakefile
diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb
index 2cdf4eae54..2cdf4eae54 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb
+++ b/railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb b/railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb
index de6be7945c..de6be7945c 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb
+++ b/railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory b/railties/lib/generators/rails/app/templates/app/models/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/app/models/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory b/railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/generators/rails/app/templates/config.ru
index 2ab821e38d..2ab821e38d 100644
--- a/railties/lib/rails/generators/rails/app/templates/config.ru
+++ b/railties/lib/generators/rails/app/templates/config.ru
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/generators/rails/app/templates/config/application.rb
index 334820826f..334820826f 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/generators/rails/app/templates/config/application.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/generators/rails/app/templates/config/boot.rb
index 6de1725260..466e1e50ec 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/generators/rails/app/templates/config/boot.rb
@@ -13,7 +13,9 @@ else
require 'rubygems'
end
+<% unless options[:skip_activerecord] -%>
require 'rails/all'
+
# To pick the frameworks you want, remove 'require "rails/all"'
# and list the framework railties that you want:
#
@@ -22,4 +24,13 @@ require 'rails/all'
# require "action_controller/railtie"
# require "action_view/railtie"
# require "action_mailer/railtie"
-# require "active_resource/railtie" \ No newline at end of file
+# require "active_resource/railtie"
+<% else -%>
+# Pick the frameworks you want:
+# require "active_record/railtie"
+require "active_model/railtie"
+require "action_controller/railtie"
+require "action_view/railtie"
+require "action_mailer/railtie"
+require "active_resource/railtie"
+<% end -%> \ No newline at end of file
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml b/railties/lib/generators/rails/app/templates/config/databases/frontbase.yml
index c0c3588be1..c0c3588be1 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/frontbase.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml b/railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml
index a9716ddb44..a9716ddb44 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/generators/rails/app/templates/config/databases/mysql.yml
index 6bf2f7b1fd..6bf2f7b1fd 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/mysql.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml b/railties/lib/generators/rails/app/templates/config/databases/oracle.yml
index a1883f6256..a1883f6256 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/oracle.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/generators/rails/app/templates/config/databases/postgresql.yml
index f600e054cf..f600e054cf 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/postgresql.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml
index 025d62a8d8..025d62a8d8 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml
+++ b/railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environment.rb b/railties/lib/generators/rails/app/templates/config/environment.rb
index 1684986a59..1684986a59 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environment.rb
+++ b/railties/lib/generators/rails/app/templates/config/environment.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/development.rb.tt
index b10103b436..b10103b436 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
+++ b/railties/lib/generators/rails/app/templates/config/environments/development.rb.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/production.rb.tt
index 543a40108c..543a40108c 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
+++ b/railties/lib/generators/rails/app/templates/config/environments/production.rb.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/test.rb.tt
index 428fa35633..428fa35633 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
+++ b/railties/lib/generators/rails/app/templates/config/environments/test.rb.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb b/railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb
index 839d4cde19..839d4cde19 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb
+++ b/railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt b/railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt
index 451dbe1d1c..451dbe1d1c 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt
+++ b/railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb b/railties/lib/generators/rails/app/templates/config/initializers/inflections.rb
index d531b8bb82..d531b8bb82 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb
+++ b/railties/lib/generators/rails/app/templates/config/initializers/inflections.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb b/railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb
index 72aca7e441..72aca7e441 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb
+++ b/railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt b/railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt
index baff704d3e..baff704d3e 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt
+++ b/railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml b/railties/lib/generators/rails/app/templates/config/locales/en.yml
index f265c068d8..f265c068d8 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml
+++ b/railties/lib/generators/rails/app/templates/config/locales/en.yml
diff --git a/railties/lib/rails/generators/rails/app/templates/config/routes.rb b/railties/lib/generators/rails/app/templates/config/routes.rb
index d6c0365c04..d6c0365c04 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/routes.rb
+++ b/railties/lib/generators/rails/app/templates/config/routes.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/db/seeds.rb b/railties/lib/generators/rails/app/templates/db/seeds.rb
index bc8695e6f0..bc8695e6f0 100644
--- a/railties/lib/rails/generators/rails/app/templates/db/seeds.rb
+++ b/railties/lib/generators/rails/app/templates/db/seeds.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP b/railties/lib/generators/rails/app/templates/doc/README_FOR_APP
index fe41f5cc24..fe41f5cc24 100644
--- a/railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP
+++ b/railties/lib/generators/rails/app/templates/doc/README_FOR_APP
diff --git a/railties/lib/rails/generators/rails/app/templates/gitignore b/railties/lib/generators/rails/app/templates/gitignore
index a4f05d101d..a4f05d101d 100644
--- a/railties/lib/rails/generators/rails/app/templates/gitignore
+++ b/railties/lib/generators/rails/app/templates/gitignore
diff --git a/railties/lib/rails/generators/rails/app/templates/public/404.html b/railties/lib/generators/rails/app/templates/public/404.html
index 9a48320a5f..9a48320a5f 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/404.html
+++ b/railties/lib/generators/rails/app/templates/public/404.html
diff --git a/railties/lib/rails/generators/rails/app/templates/public/422.html b/railties/lib/generators/rails/app/templates/public/422.html
index 83660ab187..83660ab187 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/422.html
+++ b/railties/lib/generators/rails/app/templates/public/422.html
diff --git a/railties/lib/rails/generators/rails/app/templates/public/500.html b/railties/lib/generators/rails/app/templates/public/500.html
index b80307fc16..b80307fc16 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/500.html
+++ b/railties/lib/generators/rails/app/templates/public/500.html
diff --git a/railties/lib/rails/generators/rails/app/templates/public/favicon.ico b/railties/lib/generators/rails/app/templates/public/favicon.ico
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/favicon.ico
+++ b/railties/lib/generators/rails/app/templates/public/favicon.ico
diff --git a/railties/lib/rails/generators/rails/app/templates/public/images/rails.png b/railties/lib/generators/rails/app/templates/public/images/rails.png
index d5edc04e65..d5edc04e65 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/images/rails.png
+++ b/railties/lib/generators/rails/app/templates/public/images/rails.png
Binary files differ
diff --git a/railties/lib/rails/generators/rails/app/templates/public/index.html b/railties/lib/generators/rails/app/templates/public/index.html
index b153ae392f..b153ae392f 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/index.html
+++ b/railties/lib/generators/rails/app/templates/public/index.html
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js b/railties/lib/generators/rails/app/templates/public/javascripts/application.js
index fe4577696b..fe4577696b 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/application.js
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js b/railties/lib/generators/rails/app/templates/public/javascripts/controls.js
index ca29aefdd1..ca29aefdd1 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/controls.js
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js b/railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js
index 07229f986f..07229f986f 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js b/railties/lib/generators/rails/app/templates/public/javascripts/effects.js
index 5a639d2dea..5a639d2dea 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/effects.js
diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js b/railties/lib/generators/rails/app/templates/public/javascripts/prototype.js
index dfe8ab4e13..dfe8ab4e13 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/prototype.js
diff --git a/railties/lib/rails/generators/rails/app/templates/public/robots.txt b/railties/lib/generators/rails/app/templates/public/robots.txt
index 085187fa58..085187fa58 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/robots.txt
+++ b/railties/lib/generators/rails/app/templates/public/robots.txt
diff --git a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory b/railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/script/about b/railties/lib/generators/rails/app/templates/script/about
index 93fd007649..93fd007649 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/about
+++ b/railties/lib/generators/rails/app/templates/script/about
diff --git a/railties/lib/rails/generators/rails/app/templates/script/console.tt b/railties/lib/generators/rails/app/templates/script/console.tt
index daba8ba2f1..daba8ba2f1 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/console.tt
+++ b/railties/lib/generators/rails/app/templates/script/console.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt b/railties/lib/generators/rails/app/templates/script/dbconsole.tt
index a7f114a97f..a7f114a97f 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt
+++ b/railties/lib/generators/rails/app/templates/script/dbconsole.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy b/railties/lib/generators/rails/app/templates/script/destroy
index adfa8e8426..adfa8e8426 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/destroy
+++ b/railties/lib/generators/rails/app/templates/script/destroy
diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate b/railties/lib/generators/rails/app/templates/script/generate
index 6fb8ad0395..6fb8ad0395 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/generate
+++ b/railties/lib/generators/rails/app/templates/script/generate
diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker b/railties/lib/generators/rails/app/templates/script/performance/benchmarker
index 9647d8f10a..9647d8f10a 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker
+++ b/railties/lib/generators/rails/app/templates/script/performance/benchmarker
diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler b/railties/lib/generators/rails/app/templates/script/performance/profiler
index a5822042d2..a5822042d2 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler
+++ b/railties/lib/generators/rails/app/templates/script/performance/profiler
diff --git a/railties/lib/rails/generators/rails/app/templates/script/plugin b/railties/lib/generators/rails/app/templates/script/plugin
index 1f1af6c880..1f1af6c880 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/plugin
+++ b/railties/lib/generators/rails/app/templates/script/plugin
diff --git a/railties/lib/rails/generators/rails/app/templates/script/runner b/railties/lib/generators/rails/app/templates/script/runner
index 3354ed4a28..3354ed4a28 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/runner
+++ b/railties/lib/generators/rails/app/templates/script/runner
diff --git a/railties/lib/rails/generators/rails/app/templates/script/server.tt b/railties/lib/generators/rails/app/templates/script/server.tt
index 4fd0cc7832..4fd0cc7832 100755
--- a/railties/lib/rails/generators/rails/app/templates/script/server.tt
+++ b/railties/lib/generators/rails/app/templates/script/server.tt
diff --git a/railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory b/railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory b/railties/lib/generators/rails/app/templates/test/functional/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/test/functional/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory b/railties/lib/generators/rails/app/templates/test/integration/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/test/integration/.empty_directory
diff --git a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb b/railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb
index a3dc38d9e4..a3dc38d9e4 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb
+++ b/railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb b/railties/lib/generators/rails/app/templates/test/test_helper.rb
index 45b551fc7d..45b551fc7d 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb
+++ b/railties/lib/generators/rails/app/templates/test/test_helper.rb
diff --git a/railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory b/railties/lib/generators/rails/app/templates/test/unit/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory
+++ b/railties/lib/generators/rails/app/templates/test/unit/.empty_directory
diff --git a/railties/lib/rails/generators/rails/controller/USAGE b/railties/lib/generators/rails/controller/USAGE
index 6ed4b2edfc..6ed4b2edfc 100644
--- a/railties/lib/rails/generators/rails/controller/USAGE
+++ b/railties/lib/generators/rails/controller/USAGE
diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/generators/rails/controller/controller_generator.rb
index 91470be833..91470be833 100644
--- a/railties/lib/rails/generators/rails/controller/controller_generator.rb
+++ b/railties/lib/generators/rails/controller/controller_generator.rb
diff --git a/railties/lib/rails/generators/rails/controller/templates/controller.rb b/railties/lib/generators/rails/controller/templates/controller.rb
index cda2659e69..cda2659e69 100644
--- a/railties/lib/rails/generators/rails/controller/templates/controller.rb
+++ b/railties/lib/generators/rails/controller/templates/controller.rb
diff --git a/railties/lib/rails/generators/rails/generator/USAGE b/railties/lib/generators/rails/generator/USAGE
index ca7d3f62d0..ca7d3f62d0 100644
--- a/railties/lib/rails/generators/rails/generator/USAGE
+++ b/railties/lib/generators/rails/generator/USAGE
diff --git a/railties/lib/rails/generators/rails/generator/generator_generator.rb b/railties/lib/generators/rails/generator/generator_generator.rb
index 5b5d1884bc..5b5d1884bc 100644
--- a/railties/lib/rails/generators/rails/generator/generator_generator.rb
+++ b/railties/lib/generators/rails/generator/generator_generator.rb
diff --git a/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt b/railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt
index d8757460e4..d8757460e4 100644
--- a/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt
+++ b/railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt
diff --git a/railties/lib/rails/generators/rails/generator/templates/USAGE.tt b/railties/lib/generators/rails/generator/templates/USAGE.tt
index ea9f4f12cc..ea9f4f12cc 100644
--- a/railties/lib/rails/generators/rails/generator/templates/USAGE.tt
+++ b/railties/lib/generators/rails/generator/templates/USAGE.tt
diff --git a/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory b/railties/lib/generators/rails/generator/templates/templates/.empty_directory
index e69de29bb2..e69de29bb2 100644
--- a/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory
+++ b/railties/lib/generators/rails/generator/templates/templates/.empty_directory
diff --git a/railties/lib/rails/generators/rails/helper/USAGE b/railties/lib/generators/rails/helper/USAGE
index 531c9b390a..531c9b390a 100644
--- a/railties/lib/rails/generators/rails/helper/USAGE
+++ b/railties/lib/generators/rails/helper/USAGE
diff --git a/railties/lib/rails/generators/rails/helper/helper_generator.rb b/railties/lib/generators/rails/helper/helper_generator.rb
index ad66388591..ad66388591 100644
--- a/railties/lib/rails/generators/rails/helper/helper_generator.rb
+++ b/railties/lib/generators/rails/helper/helper_generator.rb
diff --git a/railties/lib/rails/generators/rails/helper/templates/helper.rb b/railties/lib/generators/rails/helper/templates/helper.rb
index 3fe2ecdc74..3fe2ecdc74 100644
--- a/railties/lib/rails/generators/rails/helper/templates/helper.rb
+++ b/railties/lib/generators/rails/helper/templates/helper.rb
diff --git a/railties/lib/rails/generators/rails/integration_test/USAGE b/railties/lib/generators/rails/integration_test/USAGE
index b76c35a702..b76c35a702 100644
--- a/railties/lib/rails/generators/rails/integration_test/USAGE
+++ b/railties/lib/generators/rails/integration_test/USAGE
diff --git a/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb b/railties/lib/generators/rails/integration_test/integration_test_generator.rb
index 363a327fcb..363a327fcb 100644
--- a/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb
+++ b/railties/lib/generators/rails/integration_test/integration_test_generator.rb
diff --git a/railties/lib/rails/generators/rails/mailer/USAGE b/railties/lib/generators/rails/mailer/USAGE
index c56095b2c8..4b0b8ddc3b 100644
--- a/railties/lib/rails/generators/rails/mailer/USAGE
+++ b/railties/lib/generators/rails/mailer/USAGE
@@ -9,7 +9,7 @@ Example:
`./script/generate mailer Notifications signup forgot_password invoice`
creates a Notifications mailer class, views, test, and fixtures:
- Mailer: app/models/notifications.rb
+ Mailer: app/mailers/notifications.rb
Views: app/views/notifications/signup.erb [...]
- Test: test/unit/test/unit/notifications_test.rb
+ Test: test/functional/notifications_test.rb
Fixtures: test/fixtures/notifications/signup [...]
diff --git a/railties/lib/rails/generators/rails/mailer/mailer_generator.rb b/railties/lib/generators/rails/mailer/mailer_generator.rb
index 33f1665b83..8993181d79 100644
--- a/railties/lib/rails/generators/rails/mailer/mailer_generator.rb
+++ b/railties/lib/generators/rails/mailer/mailer_generator.rb
@@ -5,7 +5,7 @@ module Rails
check_class_collision
def create_mailer_file
- template "mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
+ template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}.rb")
end
hook_for :template_engine, :test_framework
diff --git a/railties/lib/rails/generators/rails/mailer/templates/mailer.rb b/railties/lib/generators/rails/mailer/templates/mailer.rb
index 90e0b712d6..90e0b712d6 100644
--- a/railties/lib/rails/generators/rails/mailer/templates/mailer.rb
+++ b/railties/lib/generators/rails/mailer/templates/mailer.rb
diff --git a/railties/lib/rails/generators/rails/metal/USAGE b/railties/lib/generators/rails/metal/USAGE
index 123ec6c03f..123ec6c03f 100644
--- a/railties/lib/rails/generators/rails/metal/USAGE
+++ b/railties/lib/generators/rails/metal/USAGE
diff --git a/railties/lib/rails/generators/rails/metal/metal_generator.rb b/railties/lib/generators/rails/metal/metal_generator.rb
index fe4f945cad..fe4f945cad 100644
--- a/railties/lib/rails/generators/rails/metal/metal_generator.rb
+++ b/railties/lib/generators/rails/metal/metal_generator.rb
diff --git a/railties/lib/rails/generators/rails/metal/templates/metal.rb b/railties/lib/generators/rails/metal/templates/metal.rb
index e94982b69a..e94982b69a 100644
--- a/railties/lib/rails/generators/rails/metal/templates/metal.rb
+++ b/railties/lib/generators/rails/metal/templates/metal.rb
diff --git a/railties/lib/rails/generators/rails/migration/USAGE b/railties/lib/generators/rails/migration/USAGE
index d91127aac3..d91127aac3 100644
--- a/railties/lib/rails/generators/rails/migration/USAGE
+++ b/railties/lib/generators/rails/migration/USAGE
diff --git a/railties/lib/rails/generators/rails/migration/migration_generator.rb b/railties/lib/generators/rails/migration/migration_generator.rb
index 39fa5b63b1..39fa5b63b1 100644
--- a/railties/lib/rails/generators/rails/migration/migration_generator.rb
+++ b/railties/lib/generators/rails/migration/migration_generator.rb
diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/generators/rails/model/USAGE
index b056d5df8b..b056d5df8b 100644
--- a/railties/lib/rails/generators/rails/model/USAGE
+++ b/railties/lib/generators/rails/model/USAGE
diff --git a/railties/lib/rails/generators/rails/model/model_generator.rb b/railties/lib/generators/rails/model/model_generator.rb
index 629d5eed3f..629d5eed3f 100644
--- a/railties/lib/rails/generators/rails/model/model_generator.rb
+++ b/railties/lib/generators/rails/model/model_generator.rb
diff --git a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb b/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb
index 4649709780..99fd2f45bc 100644
--- a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb
+++ b/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb
@@ -1,5 +1,6 @@
module Rails
module Generators
+ # TODO Deprecate me in a release > Rails 3.0
class ModelSubclassGenerator < Base
desc "model_subclass is deprecated. Invoke model with --parent option instead."
diff --git a/railties/lib/rails/generators/rails/observer/USAGE b/railties/lib/generators/rails/observer/USAGE
index 9a20f55a89..9a20f55a89 100644
--- a/railties/lib/rails/generators/rails/observer/USAGE
+++ b/railties/lib/generators/rails/observer/USAGE
diff --git a/railties/lib/rails/generators/rails/observer/observer_generator.rb b/railties/lib/generators/rails/observer/observer_generator.rb
index f5cedee91f..f5cedee91f 100644
--- a/railties/lib/rails/generators/rails/observer/observer_generator.rb
+++ b/railties/lib/generators/rails/observer/observer_generator.rb
diff --git a/railties/lib/rails/generators/rails/performance_test/USAGE b/railties/lib/generators/rails/performance_test/USAGE
index ee82578cdb..ee82578cdb 100644
--- a/railties/lib/rails/generators/rails/performance_test/USAGE
+++ b/railties/lib/generators/rails/performance_test/USAGE
diff --git a/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb b/railties/lib/generators/rails/performance_test/performance_test_generator.rb
index d1c71ab8ed..d1c71ab8ed 100644
--- a/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb
+++ b/railties/lib/generators/rails/performance_test/performance_test_generator.rb
diff --git a/railties/lib/rails/generators/rails/plugin/USAGE b/railties/lib/generators/rails/plugin/USAGE
index 8a17fa4dec..8a17fa4dec 100644
--- a/railties/lib/rails/generators/rails/plugin/USAGE
+++ b/railties/lib/generators/rails/plugin/USAGE
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/generators/rails/plugin/plugin_generator.rb
index bc614bc5d3..b68b8691db 100644
--- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
+++ b/railties/lib/generators/rails/plugin/plugin_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/rails/generator/generator_generator'
+require 'generators/rails/generator/generator_generator'
module Rails
module Generators
@@ -20,15 +20,15 @@ module Rails
directory 'tasks', plugin_dir('tasks')
end
- hook_for :generator do |instance, generator|
- instance.inside instance.send(:plugin_dir), :verbose => true do
- instance.invoke generator, [ instance.name ], :namespace => false
+ hook_for :generator do |generator|
+ inside plugin_dir, :verbose => true do
+ invoke generator, [ name ], :namespace => false
end
end
- hook_for :test_framework do |instance, test_framework|
- instance.inside instance.send(:plugin_dir), :verbose => true do
- instance.invoke test_framework
+ hook_for :test_framework do |test_framework|
+ inside plugin_dir, :verbose => true do
+ invoke test_framework
end
end
diff --git a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE b/railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt
index 8717df053d..8717df053d 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE
+++ b/railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt
diff --git a/railties/lib/rails/generators/rails/plugin/templates/README b/railties/lib/generators/rails/plugin/templates/README.tt
index 702db07cb1..702db07cb1 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/README
+++ b/railties/lib/generators/rails/plugin/templates/README.tt
diff --git a/railties/lib/rails/generators/rails/plugin/templates/Rakefile b/railties/lib/generators/rails/plugin/templates/Rakefile.tt
index 23c2245a41..23c2245a41 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/Rakefile
+++ b/railties/lib/generators/rails/plugin/templates/Rakefile.tt
diff --git a/railties/lib/rails/generators/rails/plugin/templates/init.rb b/railties/lib/generators/rails/plugin/templates/init.rb
index 3c19a743c9..3c19a743c9 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/init.rb
+++ b/railties/lib/generators/rails/plugin/templates/init.rb
diff --git a/railties/lib/rails/generators/rails/plugin/templates/install.rb b/railties/lib/generators/rails/plugin/templates/install.rb
index f7732d3796..f7732d3796 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/install.rb
+++ b/railties/lib/generators/rails/plugin/templates/install.rb
diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt b/railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt
index d8d908a959..d8d908a959 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
+++ b/railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt
diff --git a/railties/lib/rails/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt b/railties/lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt
index 72920a9d3a..72920a9d3a 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt
+++ b/railties/lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt
diff --git a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb b/railties/lib/generators/rails/plugin/templates/uninstall.rb
index 9738333463..9738333463 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb
+++ b/railties/lib/generators/rails/plugin/templates/uninstall.rb
diff --git a/railties/lib/rails/generators/rails/resource/USAGE b/railties/lib/generators/rails/resource/USAGE
index 936619b0db..936619b0db 100644
--- a/railties/lib/rails/generators/rails/resource/USAGE
+++ b/railties/lib/generators/rails/resource/USAGE
diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/generators/rails/resource/resource_generator.rb
index a89ce7faed..43c7cc85f4 100644
--- a/railties/lib/rails/generators/rails/resource/resource_generator.rb
+++ b/railties/lib/generators/rails/resource/resource_generator.rb
@@ -1,5 +1,5 @@
-require 'rails/generators/rails/model/model_generator'
require 'rails/generators/resource_helpers'
+require 'generators/rails/model/model_generator'
module Rails
module Generators
diff --git a/railties/lib/rails/generators/rails/scaffold/USAGE b/railties/lib/generators/rails/scaffold/USAGE
index 530ccdaf0a..530ccdaf0a 100644
--- a/railties/lib/rails/generators/rails/scaffold/USAGE
+++ b/railties/lib/generators/rails/scaffold/USAGE
diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/generators/rails/scaffold/scaffold_generator.rb
index 779f933785..fdea5bf52b 100644
--- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/rails/scaffold/scaffold_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/rails/resource/resource_generator'
+require 'generators/rails/resource/resource_generator'
module Rails
module Generators
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/USAGE b/railties/lib/generators/rails/scaffold_controller/USAGE
index d60a3c3680..d60a3c3680 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/USAGE
+++ b/railties/lib/generators/rails/scaffold_controller/USAGE
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb
index e544e29892..e544e29892 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb
+++ b/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/generators/rails/scaffold_controller/templates/controller.rb
index 874e96a2b4..874e96a2b4 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/generators/rails/scaffold_controller/templates/controller.rb
diff --git a/railties/lib/rails/generators/rails/session_migration/USAGE b/railties/lib/generators/rails/session_migration/USAGE
index e106f6ecc8..e106f6ecc8 100644
--- a/railties/lib/rails/generators/rails/session_migration/USAGE
+++ b/railties/lib/generators/rails/session_migration/USAGE
diff --git a/railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb b/railties/lib/generators/rails/session_migration/session_migration_generator.rb
index 258cc5b4a0..258cc5b4a0 100644
--- a/railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb
+++ b/railties/lib/generators/rails/session_migration/session_migration_generator.rb
diff --git a/railties/lib/rails/generators/rails/stylesheets/USAGE b/railties/lib/generators/rails/stylesheets/USAGE
index d6a81e51d0..d6a81e51d0 100644
--- a/railties/lib/rails/generators/rails/stylesheets/USAGE
+++ b/railties/lib/generators/rails/stylesheets/USAGE
diff --git a/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb b/railties/lib/generators/rails/stylesheets/stylesheets_generator.rb
index ce68443c39..ce68443c39 100644
--- a/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb
+++ b/railties/lib/generators/rails/stylesheets/stylesheets_generator.rb
diff --git a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/generators/rails/stylesheets/templates/scaffold.css
index d9fa2cf2dc..d9fa2cf2dc 100644
--- a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css
+++ b/railties/lib/generators/rails/stylesheets/templates/scaffold.css
diff --git a/railties/lib/rails/generators/test_unit.rb b/railties/lib/generators/test_unit.rb
index 62b9afaa2c..62b9afaa2c 100644
--- a/railties/lib/rails/generators/test_unit.rb
+++ b/railties/lib/generators/test_unit.rb
diff --git a/railties/lib/rails/generators/test_unit/controller/controller_generator.rb b/railties/lib/generators/test_unit/controller/controller_generator.rb
index 39816d9990..b57a6e794f 100644
--- a/railties/lib/rails/generators/test_unit/controller/controller_generator.rb
+++ b/railties/lib/generators/test_unit/controller/controller_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/generators/test_unit/controller/templates/functional_test.rb
index 62fa5d86fd..62fa5d86fd 100644
--- a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb
+++ b/railties/lib/generators/test_unit/controller/templates/functional_test.rb
diff --git a/railties/lib/rails/generators/test_unit/helper/helper_generator.rb b/railties/lib/generators/test_unit/helper/helper_generator.rb
index 4ea80bf7be..9ecfaa45ab 100644
--- a/railties/lib/rails/generators/test_unit/helper/helper_generator.rb
+++ b/railties/lib/generators/test_unit/helper/helper_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb b/railties/lib/generators/test_unit/helper/templates/helper_test.rb
index 591e40900e..591e40900e 100644
--- a/railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb
+++ b/railties/lib/generators/test_unit/helper/templates/helper_test.rb
diff --git a/railties/lib/rails/generators/test_unit/integration/integration_generator.rb b/railties/lib/generators/test_unit/integration/integration_generator.rb
index 32d0fac029..d9d9b3bf1d 100644
--- a/railties/lib/rails/generators/test_unit/integration/integration_generator.rb
+++ b/railties/lib/generators/test_unit/integration/integration_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb b/railties/lib/generators/test_unit/integration/templates/integration_test.rb
index 2c57158b1c..2c57158b1c 100644
--- a/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb
+++ b/railties/lib/generators/test_unit/integration/templates/integration_test.rb
diff --git a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb b/railties/lib/generators/test_unit/mailer/mailer_generator.rb
index 7353e5d61a..a0d73db1b0 100644
--- a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb
+++ b/railties/lib/generators/test_unit/mailer/mailer_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
@@ -7,7 +7,7 @@ module TestUnit
check_class_collision :suffix => "Test"
def create_test_files
- template "unit_test.rb", File.join('test/unit', class_path, "#{file_name}_test.rb")
+ template "functional_test.rb", File.join('test/functional', class_path, "#{file_name}_test.rb")
end
def create_fixtures_files
diff --git a/railties/lib/rails/generators/test_unit/mailer/templates/fixture b/railties/lib/generators/test_unit/mailer/templates/fixture
index fcce7bd805..fcce7bd805 100644
--- a/railties/lib/rails/generators/test_unit/mailer/templates/fixture
+++ b/railties/lib/generators/test_unit/mailer/templates/fixture
diff --git a/railties/lib/rails/generators/test_unit/mailer/templates/unit_test.rb b/railties/lib/generators/test_unit/mailer/templates/functional_test.rb
index 4de94076e9..4de94076e9 100644
--- a/railties/lib/rails/generators/test_unit/mailer/templates/unit_test.rb
+++ b/railties/lib/generators/test_unit/mailer/templates/functional_test.rb
diff --git a/railties/lib/rails/generators/test_unit/model/model_generator.rb b/railties/lib/generators/test_unit/model/model_generator.rb
index 609b815683..469306e6c5 100644
--- a/railties/lib/rails/generators/test_unit/model/model_generator.rb
+++ b/railties/lib/generators/test_unit/model/model_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/generators/test_unit/model/templates/fixtures.yml
index a30132bc99..a30132bc99 100644
--- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
+++ b/railties/lib/generators/test_unit/model/templates/fixtures.yml
diff --git a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb b/railties/lib/generators/test_unit/model/templates/unit_test.rb
index 3e0bc29d3a..3e0bc29d3a 100644
--- a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb
+++ b/railties/lib/generators/test_unit/model/templates/unit_test.rb
diff --git a/railties/lib/rails/generators/test_unit/observer/observer_generator.rb b/railties/lib/generators/test_unit/observer/observer_generator.rb
index 6cc1158c21..14181f4e49 100644
--- a/railties/lib/rails/generators/test_unit/observer/observer_generator.rb
+++ b/railties/lib/generators/test_unit/observer/observer_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb b/railties/lib/generators/test_unit/observer/templates/unit_test.rb
index 03f6d5666e..03f6d5666e 100644
--- a/railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb
+++ b/railties/lib/generators/test_unit/observer/templates/unit_test.rb
diff --git a/railties/lib/rails/generators/test_unit/performance/performance_generator.rb b/railties/lib/generators/test_unit/performance/performance_generator.rb
index 99edda5461..0d9c646b26 100644
--- a/railties/lib/rails/generators/test_unit/performance/performance_generator.rb
+++ b/railties/lib/generators/test_unit/performance/performance_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb b/railties/lib/generators/test_unit/performance/templates/performance_test.rb
index 362e3dc09f..362e3dc09f 100644
--- a/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb
+++ b/railties/lib/generators/test_unit/performance/templates/performance_test.rb
diff --git a/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb b/railties/lib/generators/test_unit/plugin/plugin_generator.rb
index 4d65cd7d89..05adf58c4f 100644
--- a/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb
+++ b/railties/lib/generators/test_unit/plugin/plugin_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
module TestUnit
module Generators
diff --git a/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt b/railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt
index 3e0bc29d3a..3e0bc29d3a 100644
--- a/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt
+++ b/railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt
diff --git a/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb b/railties/lib/generators/test_unit/plugin/templates/test_helper.rb
index 2ca36a1e44..2ca36a1e44 100644
--- a/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb
+++ b/railties/lib/generators/test_unit/plugin/templates/test_helper.rb
diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb
index c0315c7fe6..a95916ae13 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb
+++ b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/test_unit'
+require 'generators/test_unit'
require 'rails/generators/resource_helpers'
module TestUnit
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb
index 9380aa49b6..9380aa49b6 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
+++ b/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb
index 4ded2515fc..0bc7160815 100644
--- a/railties/lib/rails.rb
+++ b/railties/lib/rails.rb
@@ -1,9 +1,8 @@
-require "pathname"
+require 'pathname'
require 'active_support'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/logger'
-require 'action_dispatch'
require 'rails/initializable'
require 'rails/application'
@@ -18,6 +17,8 @@ require 'rails/deprecation'
require 'rails/subscriber'
require 'rails/ruby_version_check'
+require 'action_dispatch/railtie'
+
# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
# multibyte safe operations. Plugin authors supporting other encodings
# should override this behaviour and set the relevant +default_charset+
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index c95316a4da..4d05f8115c 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -99,9 +99,15 @@ module Rails
end
end
+ def app
+ @app ||= begin
+ reload_routes!
+ middleware.build(routes)
+ end
+ end
+
def call(env)
- @app ||= middleware.build(routes)
- @app.call(env)
+ app.call(env)
end
initializer :load_application_initializers do
@@ -110,6 +116,10 @@ module Rails
end
end
+ initializer :build_middleware_stack do
+ app
+ end
+
# Fires the user-supplied after_initialize block (Configuration#after_initialize)
initializer :after_initialize do
config.after_initialize_blocks.each do |block|
diff --git a/railties/lib/rails/backtrace_cleaner.rb b/railties/lib/rails/backtrace_cleaner.rb
index cd7dd0f80a..40198306f9 100644
--- a/railties/lib/rails/backtrace_cleaner.rb
+++ b/railties/lib/rails/backtrace_cleaner.rb
@@ -3,17 +3,7 @@ require 'active_support/backtrace_cleaner'
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
ERB_METHOD_SIG = /:in `_run_erb_.*/
-
- RAILS_GEMS = %w( actionpack activerecord actionmailer activesupport activeresource rails )
-
- VENDOR_DIRS = %w( vendor/rails )
- SERVER_DIRS = %w( lib/mongrel bin/mongrel
- lib/passenger bin/passenger-spawn-server
- lib/rack )
- RAILS_NOISE = %w( script/server )
- RUBY_NOISE = %w( rubygems/custom_require benchmark.rb )
-
- ALL_NOISE = VENDOR_DIRS + SERVER_DIRS + RAILS_NOISE + RUBY_NOISE
+ APP_DIRS = %w( app config lib test )
def initialize
super
@@ -22,10 +12,9 @@ module Rails
add_filter { |line| line.sub('./', '/') } # for tests
add_gem_filters
+ add_bundler_filters
- add_silencer { |line| ALL_NOISE.any? { |dir| line.include?(dir) } }
- add_silencer { |line| RAILS_GEMS.any? { |gem| line =~ /^#{gem} / } }
- add_silencer { |line| line =~ %r(vendor/plugins/[^\/]+/lib) }
+ add_silencer { |line| !APP_DIRS.any? { |dir| line =~ /^#{dir}/ } }
end
private
@@ -33,9 +22,21 @@ module Rails
return unless defined? Gem
(Gem.path + [Gem.default_dir]).uniq.each do |path|
# http://gist.github.com/30430
- add_filter { |line| line.sub(/(#{path})\/gems\/([a-z]+)-([0-9.]+)\/(.*)/, '\2 (\3) \4')}
+ add_filter { |line|
+ line.sub(%r{(#{path})/gems/([^/]+)-([0-9.]+)/(.*)}, '\2 (\3) \4')
+ }
end
end
+
+ def add_bundler_filters
+ return unless defined? Bundler
+ add_filter { |line|
+ line.sub(%r{vendor/gems/[^/]+/[^/]+/gems/([^/]+)-([0-9.]+)/(.*)}, '\1 (\2) \3')
+ }
+ add_filter { |line|
+ line.sub(%r{vendor/gems/[^/]+/[^/]+/dirs/([^/]+)/(.*)}, '\1 \2')
+ }
+ end
end
# For installing the BacktraceCleaner in the test/unit
diff --git a/railties/lib/rails/bootstrap.rb b/railties/lib/rails/bootstrap.rb
index b7cf70747a..5db663f9ef 100644
--- a/railties/lib/rails/bootstrap.rb
+++ b/railties/lib/rails/bootstrap.rb
@@ -23,8 +23,8 @@ module Rails
# the load_once paths.
initializer :set_autoload_paths do
require 'active_support/dependencies'
- ActiveSupport::Dependencies.load_paths = config.load_paths.uniq
- ActiveSupport::Dependencies.load_once_paths = config.load_once_paths.uniq
+ ActiveSupport::Dependencies.load_paths = expand_load_path(config.load_paths)
+ ActiveSupport::Dependencies.load_once_paths = expand_load_path(config.load_once_paths)
extra = ActiveSupport::Dependencies.load_once_paths - ActiveSupport::Dependencies.load_paths
unless extra.empty?
@@ -140,7 +140,7 @@ module Rails
end
end
- initializer :initialize_notifications do
+ initializer :initialize_notifications do
require 'active_support/notifications'
if config.colorize_logging == false
@@ -152,5 +152,10 @@ module Rails
Rails::Subscriber.dispatch(args)
end
end
+
+ private
+ def expand_load_path(load_paths)
+ load_paths.map { |path| Dir.glob(path.to_s) }.flatten.uniq
+ end
end
end
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index a2fab120cf..b76a7ac2d8 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -14,9 +14,12 @@ module Rails
middleware.use('::Rack::Lock', :if => lambda { !ActionController::Base.allow_concurrency })
middleware.use('::Rack::Runtime')
middleware.use('ActionDispatch::ShowExceptions', lambda { ActionController::Base.consider_all_requests_local })
- middleware.use('ActionDispatch::Callbacks', lambda { ActionController::Dispatcher.prepare_each_request })
+ middleware.use('ActionDispatch::Notifications')
+ middleware.use('ActionDispatch::Callbacks', lambda { !Rails.application.config.cache_classes })
+ middleware.use('ActionDispatch::Cookies')
middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options })
middleware.use('ActionDispatch::Flash', :if => lambda { ActionController::Base.session_store })
+ middleware.use(lambda { Rails::Rack::Metal.new(Rails.application.config.paths.app.metals.to_a, Rails.application.config.metals) })
middleware.use('ActionDispatch::ParamsParser')
middleware.use('::Rack::MethodOverride')
middleware.use('::ActionDispatch::Head')
@@ -197,12 +200,7 @@ module Rails
end
def eager_load_paths
- @eager_load_paths ||= %w(
- app/metal
- app/models
- app/controllers
- app/helpers
- ).map { |dir| "#{root}/#{dir}" }.select { |dir| File.directory?(dir) }
+ @eager_load_paths ||= ["#{root}/app/*"]
end
def load_paths
@@ -212,20 +210,13 @@ module Rails
# Add the old mock paths only if the directories exists
paths.concat(Dir["#{root}/test/mocks/#{Rails.env}"]) if File.exists?("#{root}/test/mocks/#{Rails.env}")
- # Add the app's controller directory
- paths.concat(Dir["#{root}/app/controllers/"])
-
# Followed by the standard includes.
paths.concat %w(
app
- app/metal
- app/models
- app/controllers
- app/helpers
- app/services
+ app/*
lib
vendor
- ).map { |dir| "#{root}/#{dir}" }.select { |dir| File.directory?(dir) }
+ ).map { |dir| "#{root}/#{dir}" }
paths.concat builtin_directories
end
diff --git a/railties/lib/rails/deprecation.rb b/railties/lib/rails/deprecation.rb
index 43f08d13df..f28da5a6b0 100644
--- a/railties/lib/rails/deprecation.rb
+++ b/railties/lib/rails/deprecation.rb
@@ -11,7 +11,7 @@ RAILS_ROOT = (Class.new(ActiveSupport::Deprecation::DeprecationProxy) do
end
def warn(callstack, called, args)
- msg = "RAILS_ROOT is deprecated! Use Rails.root instead."
+ msg = "RAILS_ROOT is deprecated! Use Rails.root instead"
ActiveSupport::Deprecation.warn(msg, callstack)
end
end).new
@@ -26,7 +26,7 @@ RAILS_ENV = (Class.new(ActiveSupport::Deprecation::DeprecationProxy) do
end
def warn(callstack, called, args)
- msg = "RAILS_ENV is deprecated! Use Rails.env instead."
+ msg = "RAILS_ENV is deprecated! Use Rails.env instead"
ActiveSupport::Deprecation.warn(msg, callstack)
end
end).new
@@ -41,7 +41,7 @@ RAILS_DEFAULT_LOGGER = (Class.new(ActiveSupport::Deprecation::DeprecationProxy)
end
def warn(callstack, called, args)
- msg = "RAILS_DEFAULT_LOGGER is deprecated! Use Rails.logger instead."
+ msg = "RAILS_DEFAULT_LOGGER is deprecated! Use Rails.logger instead"
ActiveSupport::Deprecation.warn(msg, callstack)
end
end).new
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 3713a38b33..736c36c0dc 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -87,18 +87,6 @@ module Rails
@options ||= DEFAULT_OPTIONS.dup
end
- def self.gems_generators_paths #:nodoc:
- return [] unless defined?(Gem) && Gem.respond_to?(:loaded_specs)
- Gem.loaded_specs.inject([]) do |paths, (name, spec)|
- paths += Dir[File.join(spec.full_gem_path, "lib/{generators,rails_generators}")]
- end
- end
-
- def self.plugins_generators_paths #:nodoc:
- return [] unless defined?(Rails.root) && Rails.root
- Dir[File.join(Rails.root, "vendor", "plugins", "*", "lib", "{generators,rails_generators}")]
- end
-
# Hold configured generators fallbacks. If a plugin developer wants a
# generator group to fallback to another group in case of missing generators,
# they can add a fallback.
@@ -126,31 +114,6 @@ module Rails
@subclasses ||= []
end
- # Generators load paths used on lookup. The lookup happens as:
- #
- # 1) lib generators
- # 2) vendor/plugin generators
- # 3) vendor/gems generators
- # 4) ~/rails/generators
- # 5) rubygems generators
- # 6) builtin generators
- #
- # TODO Remove hardcoded paths for all, except (6).
- #
- def self.load_paths
- @load_paths ||= begin
- paths = []
- paths += Dir[File.join(Rails.root, "lib", "{generators,rails_generators}")] if defined?(Rails.root) && Rails.root
- paths += Dir[File.join(Thor::Util.user_home, ".rails", "{generators,rails_generators}")]
- paths += self.plugins_generators_paths
- paths += self.gems_generators_paths
- paths << File.expand_path(File.join(File.dirname(__FILE__), "generators"))
- paths.uniq!
- paths
- end
- end
- load_paths # Cache load paths. Needed to avoid __FILE__ pointing to wrong paths.
-
# Rails finds namespaces similar to thor, it only adds one rule:
#
# Generators names must end with "_generator.rb". This is required because Rails
@@ -168,34 +131,26 @@ module Rails
# Rails looks for is the first and last parts of the namespace.
#
def self.find_by_namespace(name, base=nil, context=nil) #:nodoc:
- # Mount regexps to lookup
- regexps = []
- regexps << /^#{base}:[\w:]*#{name}$/ if base
- regexps << /^#{name}:[\w:]*#{context}$/ if context
- regexps << /^[(#{name}):]+$/
- regexps.uniq!
-
- # Check if generator happens to be loaded
- checked = subclasses.dup
- klass = find_by_regexps(regexps, checked)
- return klass if klass
-
- # Try to require other generators by looking in load_paths
- lookup(name, context)
- unchecked = subclasses - checked
- klass = find_by_regexps(regexps, unchecked)
- return klass if klass
-
- # Invoke fallbacks
- invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)
- end
+ lookups = []
+ lookups << "#{base}:#{name}" if base
+ lookups << "#{name}:#{context}" if context
+ lookups << "#{name}:#{name}" unless name.to_s.include?(?:)
+ lookups << "#{name}"
+ lookups << "rails:#{name}" unless base || context || name.to_s.include?(?:)
+
+ lookup(lookups)
+
+ namespaces = subclasses.inject({}) do |hash, klass|
+ hash[klass.namespace] = klass
+ hash
+ end
- # Tries to find a generator which the namespace match the regexp.
- def self.find_by_regexps(regexps, klasses)
- klasses.find do |klass|
- namespace = klass.namespace
- regexps.find { |r| namespace =~ r }
+ lookups.each do |namespace|
+ klass = namespaces[namespace]
+ return klass if klass
end
+
+ invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)
end
# Receives a namespace, arguments and the behavior to invoke the generator.
@@ -203,9 +158,8 @@ module Rails
# commands.
def self.invoke(namespace, args=ARGV, config={})
names = namespace.to_s.split(':')
-
- if klass = find_by_namespace(names.pop, names.shift || "rails")
- args << "--help" if klass.arguments.any? { |a| a.required? } && args.empty?
+ if klass = find_by_namespace(names.pop, names.shift)
+ args << "--help" if args.empty? && klass.arguments.any? { |a| a.required? }
klass.start(args, config)
else
puts "Could not find generator #{namespace}."
@@ -214,26 +168,46 @@ module Rails
# Show help message with available generators.
def self.help
- builtin = Rails::Generators.builtin.each { |n| n.sub!(/^rails:/, '') }
- builtin.sort!
+ traverse_load_paths!
+
+ namespaces = subclasses.map{ |k| k.namespace }
+ namespaces.sort!
- lookup("*")
- others = subclasses.map{ |k| k.namespace.gsub(':generators:', ':') }
- others -= Rails::Generators.builtin
- others.sort!
+ groups = Hash.new { |h,k| h[k] = [] }
+ namespaces.each do |namespace|
+ base = namespace.split(':').first
+ groups[base] << namespace
+ end
- puts "Please select a generator."
- puts "Builtin: #{builtin.join(', ')}."
- puts "Others: #{others.join(', ')}." unless others.empty?
+ puts "Usage:"
+ puts " script/generate GENERATOR [args] [options]"
+ puts
+ puts "General options:"
+ puts " -h, [--help] # Print generators options and usage"
+ puts " -p, [--pretend] # Run but do not make any changes"
+ puts " -f, [--force] # Overwrite files that already exist"
+ puts " -s, [--skip] # Skip files that already exist"
+ puts " -q, [--quiet] # Supress status output"
+ puts
+ puts "Please choose a generator below."
+ puts
+
+ # Print Rails defaults first.
+ rails = groups.delete("rails")
+ rails.map! { |n| n.sub(/^rails:/, '') }
+ print_list("rails", rails)
+
+ groups.sort.each { |b, n| print_list(b, n) }
end
protected
- # Keep builtin generators in an Array.
- def self.builtin #:nodoc:
- Dir[File.dirname(__FILE__) + '/generators/*/*'].collect do |file|
- file.split('/')[-2, 2].join(':')
- end
+ # Prints a list of generators.
+ def self.print_list(base, namespaces) #:nodoc:
+ return if namespaces.empty?
+ puts "#{base.camelize}:"
+ namespaces.each { |namespace| puts(" #{namespace}") }
+ puts
end
# Try fallbacks for the given base.
@@ -252,27 +226,55 @@ module Rails
nil
end
+ # This will try to load any generator in the load path to show in help.
+ def self.traverse_load_paths! #:nodoc:
+ $LOAD_PATH.each do |base|
+ Dir[File.join(base, "{generators,rails_generators}", "**", "*_generator.rb")].each do |path|
+ begin
+ require path
+ rescue Exception => e
+ # No problem
+ end
+ end
+ end
+ end
+
# Receives namespaces in an array and tries to find matching generators
# in the load path.
- def self.lookup(*attempts) #:nodoc:
- attempts.compact!
- attempts.uniq!
- attempts = "{#{attempts.join(',')}}_generator.rb"
+ def self.lookup(namespaces) #:nodoc:
+ paths = namespaces_to_paths(namespaces)
+
+ paths.each do |path|
+ ["generators", "rails_generators"].each do |base|
+ path = "#{base}/#{path}_generator"
- self.load_paths.each do |path|
- Dir[File.join(path, '**', attempts)].each do |file|
begin
- require file
+ require path
+ return
+ rescue LoadError => e
+ raise unless e.message =~ /#{Regexp.escape(path)}$/
rescue NameError => e
- raise unless e.message =~ /Rails::Generator/
- warn "[WARNING] Could not load generator at #{file.inspect} because it's a Rails 2.x generator, which is not supported anymore"
- rescue Exception => e
- warn "[WARNING] Could not load generator at #{file.inspect}. Error: #{e.message}"
+ raise unless e.message =~ /Rails::Generator([\s(::)]|$)/
+ warn "[WARNING] Could not load generator #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}"
end
end
end
end
+ # Convert namespaces to paths by replacing ":" for "/" and adding
+ # an extra lookup. For example, "rails:model" should be searched
+ # in both: "rails/model/model_generator" and "rails/model_generator".
+ def self.namespaces_to_paths(namespaces) #:nodoc:
+ paths = []
+ namespaces.each do |namespace|
+ pieces = namespace.split(":")
+ paths << pieces.dup.push(pieces.last).join("/")
+ paths << pieces.join("/")
+ end
+ paths.uniq!
+ paths
+ end
+
end
end
diff --git a/railties/lib/rails/generators/active_record.rb b/railties/lib/rails/generators/active_record.rb
deleted file mode 100644
index c62f75c384..0000000000
--- a/railties/lib/rails/generators/active_record.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'rails/generators/named_base'
-require 'rails/generators/migration'
-require 'rails/generators/active_model'
-require 'active_record'
-
-module ActiveRecord
- module Generators
- class Base < Rails::Generators::NamedBase #:nodoc:
- include Rails::Generators::Migration
-
- protected
- # Implement the required interface for Rails::Generators::Migration.
- #
- def next_migration_number(dirname) #:nodoc:
- if ActiveRecord::Base.timestamped_migrations
- Time.now.utc.strftime("%Y%m%d%H%M%S")
- else
- "%.3d" % (current_migration_number(dirname) + 1)
- end
- end
- end
- end
-end
diff --git a/railties/lib/rails/generators/active_record/migration/migration_generator.rb b/railties/lib/rails/generators/active_record/migration/migration_generator.rb
deleted file mode 100644
index f6159deeeb..0000000000
--- a/railties/lib/rails/generators/active_record/migration/migration_generator.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'rails/generators/active_record'
-
-module ActiveRecord
- module Generators
- class MigrationGenerator < Base
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
-
- def create_migration_file
- set_local_assigns!
- migration_template "migration.rb", "db/migrate/#{file_name}.rb"
- end
-
- protected
- attr_reader :migration_action
-
- def set_local_assigns!
- if file_name =~ /^(add|remove)_.*_(?:to|from)_(.*)/
- @migration_action = $1
- @table_name = $2.pluralize
- end
- end
-
- end
- end
-end
diff --git a/railties/lib/rails/generators/active_record/migration/templates/migration.rb b/railties/lib/rails/generators/active_record/migration/templates/migration.rb
deleted file mode 100644
index bbb7c53d86..0000000000
--- a/railties/lib/rails/generators/active_record/migration/templates/migration.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class <%= migration_class_name %> < ActiveRecord::Migration
- def self.up<% attributes.each do |attribute| %>
- <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
- <%- end %>
- end
-
- def self.down<% attributes.reverse.each do |attribute| %>
- <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
- <%- end %>
- end
-end
diff --git a/railties/lib/rails/generators/active_record/model/model_generator.rb b/railties/lib/rails/generators/active_record/model/model_generator.rb
deleted file mode 100644
index 3e72fbeca8..0000000000
--- a/railties/lib/rails/generators/active_record/model/model_generator.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require 'rails/generators/active_record'
-
-module ActiveRecord
- module Generators
- class ModelGenerator < Base
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
-
- check_class_collision
-
- class_option :migration, :type => :boolean
- class_option :timestamps, :type => :boolean
- class_option :parent, :type => :string, :desc => "The parent class for the generated model"
-
- def create_migration_file
- return unless options[:migration] && options[:parent].nil?
- migration_template "migration.rb", "db/migrate/create_#{table_name}.rb"
- end
-
- def create_model_file
- template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
- end
-
- hook_for :test_framework
-
- protected
-
- def parent_class_name
- options[:parent] || "ActiveRecord::Base"
- end
-
- end
- end
-end
diff --git a/railties/lib/rails/generators/active_record/model/templates/migration.rb b/railties/lib/rails/generators/active_record/model/templates/migration.rb
deleted file mode 100644
index 1f68487304..0000000000
--- a/railties/lib/rails/generators/active_record/model/templates/migration.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class <%= migration_class_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= table_name %> do |t|
-<% for attribute in attributes -%>
- t.<%= attribute.type %> :<%= attribute.name %>
-<% end -%>
-<% if options[:timestamps] %>
- t.timestamps
-<% end -%>
- end
- end
-
- def self.down
- drop_table :<%= table_name %>
- end
-end
diff --git a/railties/lib/rails/generators/active_record/model/templates/model.rb b/railties/lib/rails/generators/active_record/model/templates/model.rb
deleted file mode 100644
index 21ae29e9f2..0000000000
--- a/railties/lib/rails/generators/active_record/model/templates/model.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class <%= class_name %> < <%= parent_class_name.classify %>
-<% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
- belongs_to :<%= attribute.name %>
-<% end -%>
-end
diff --git a/railties/lib/rails/generators/active_record/observer/observer_generator.rb b/railties/lib/rails/generators/active_record/observer/observer_generator.rb
deleted file mode 100644
index c1c0e3f25b..0000000000
--- a/railties/lib/rails/generators/active_record/observer/observer_generator.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'rails/generators/active_record'
-
-module ActiveRecord
- module Generators
- class ObserverGenerator < Base
- check_class_collision :suffix => "Observer"
-
- def create_observer_file
- template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb")
- end
-
- hook_for :test_framework
- end
- end
-end
diff --git a/railties/lib/rails/generators/active_record/observer/templates/observer.rb b/railties/lib/rails/generators/active_record/observer/templates/observer.rb
deleted file mode 100644
index b9a3004161..0000000000
--- a/railties/lib/rails/generators/active_record/observer/templates/observer.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class <%= class_name %>Observer < ActiveRecord::Observer
-end
diff --git a/railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb b/railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb
deleted file mode 100644
index afcda2a98a..0000000000
--- a/railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'rails/generators/active_record'
-
-module ActiveRecord
- module Generators
- class SessionMigrationGenerator < Base
- argument :name, :type => :string, :default => "add_sessions_table"
-
- def create_migration_file
- migration_template "migration.rb", "db/migrate/#{file_name}.rb"
- end
-
- protected
-
- def session_table_name
- current_table_name = ActiveRecord::SessionStore::Session.table_name
- if ["sessions", "session"].include?(current_table_name)
- current_table_name = (ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session')
- end
- current_table_name
- end
-
- end
- end
-end
diff --git a/railties/lib/rails/generators/active_record/session_migration/templates/migration.rb b/railties/lib/rails/generators/active_record/session_migration/templates/migration.rb
deleted file mode 100644
index 919822af7b..0000000000
--- a/railties/lib/rails/generators/active_record/session_migration/templates/migration.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class <%= migration_class_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= session_table_name %> do |t|
- t.string :session_id, :null => false
- t.text :data
- t.timestamps
- end
-
- add_index :<%= session_table_name %>, :session_id
- add_index :<%= session_table_name %>, :updated_at
- end
-
- def self.down
- drop_table :<%= session_table_name %>
- end
-end
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index 26abb46644..f4b2bd1ae9 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -17,7 +17,7 @@ module Rails
def self.source_root
@_rails_source_root ||= begin
if base_name && generator_name
- File.expand_path(File.join(File.dirname(__FILE__), base_name, generator_name, 'templates'))
+ File.expand_path(File.join("../../generators", base_name, generator_name, 'templates'), File.dirname(__FILE__))
end
end
end
@@ -42,7 +42,7 @@ module Rails
#
def self.namespace(name=nil)
return super if name
- @namespace ||= super.sub(/_generator$/, '')
+ @namespace ||= super.sub(/_generator$/, '').sub(/:generators:/, ':')
end
# Invoke a generator based on the value supplied by the user to the
@@ -324,9 +324,13 @@ module Rails
# added hook is being used.
#
def self.prepare_for_invocation(name, value) #:nodoc:
+ return super unless value.is_a?(String) || value.is_a?(Symbol)
+
if value && constants = self.hooks[name]
value = name if TrueClass === value
Rails::Generators.find_by_namespace(value, *constants)
+ elsif klass = Rails::Generators.find_by_namespace(value)
+ klass
else
super
end
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index 1d4f52286e..3e851bf888 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -6,10 +6,12 @@ module Rails
class NamedBase < Base
argument :name, :type => :string
- attr_reader :class_name, :singular_name, :plural_name, :table_name,
- :class_path, :file_path, :class_nesting_depth
+ no_tasks {
+ attr_reader :class_name, :singular_name, :plural_name, :table_name,
+ :class_path, :file_path, :class_nesting_depth
- alias :file_name :singular_name
+ alias :file_name :singular_name
+ }
def initialize(args, *options) #:nodoc:
# Unfreeze name in case it's given as a frozen string
diff --git a/railties/lib/rails/generators/resource_helpers.rb b/railties/lib/rails/generators/resource_helpers.rb
index 99954e2292..7e00a222ed 100644
--- a/railties/lib/rails/generators/resource_helpers.rb
+++ b/railties/lib/rails/generators/resource_helpers.rb
@@ -9,10 +9,14 @@ module Rails
mattr_accessor :skip_warn
def self.included(base) #:nodoc:
- base.send :attr_reader, :controller_name, :controller_class_name, :controller_file_name,
- :controller_class_path, :controller_file_path
+ base.class_eval do
+ class_option :force_plural, :type => :boolean, :desc => "Forces the use of a plural ModelName"
- base.send :class_option, :force_plural, :type => :boolean, :desc => "Forces the use of a plural ModelName"
+ no_tasks {
+ attr_reader :controller_name, :controller_class_name, :controller_file_name,
+ :controller_class_path, :controller_file_path
+ }
+ end
end
# Set controller variables on initialization.
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index a057b8f701..0c09730963 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -50,7 +50,11 @@ module Rails
end
initializer :add_view_paths, :after => :initialize_framework_views do
- ActionController::Base.view_paths.concat ["#{path}/app/views"] if File.directory?("#{path}/app/views")
+ plugin_views = "#{path}/app/views"
+ if File.directory?(plugin_views)
+ ActionController::Base.view_paths.concat([plugin_views]) if defined? ActionController
+ ActionMailer::Base.view_paths.concat([plugin_views]) if defined? ActionMailer
+ end
end
# TODO Isn't it supposed to be :after => "action_controller.initialize_routing" ?
@@ -62,4 +66,4 @@ module Rails
end
end
end
-end \ No newline at end of file
+end
diff --git a/railties/lib/rails/rack.rb b/railties/lib/rails/rack.rb
index d487bd0542..36945a6b0f 100644
--- a/railties/lib/rails/rack.rb
+++ b/railties/lib/rails/rack.rb
@@ -1,7 +1,8 @@
module Rails
module Rack
- autoload :Debugger, "rails/rack/debugger"
+ autoload :Debugger, "rails/rack/debugger"
autoload :LogTailer, "rails/rack/log_tailer"
- autoload :Static, "rails/rack/static"
+ autoload :Metal, "rails/rack/metal"
+ autoload :Static, "rails/rack/static"
end
end
diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb
new file mode 100644
index 0000000000..565f95d7c4
--- /dev/null
+++ b/railties/lib/rails/rack/metal.rb
@@ -0,0 +1,26 @@
+require 'action_dispatch'
+
+module Rails
+ module Rack
+ class Metal
+ def initialize(metal_roots, metals=nil)
+ load_list = metals || Dir["{#{metal_roots.join(",")}}/**/*.rb"]
+
+ @metals = load_list.map { |metal|
+ metal = File.basename(metal, '.rb')
+ require_dependency metal
+ metal.camelize.constantize
+ }.compact
+ end
+
+ def new(app)
+ ActionDispatch::Cascade.new(@metals, app)
+ end
+
+ def name
+ ActionDispatch::Cascade.name
+ end
+ alias_method :to_s, :name
+ end
+ end
+end
diff --git a/railties/lib/rails/subscriber.rb b/railties/lib/rails/subscriber.rb
index 11102522b0..db92916043 100644
--- a/railties/lib/rails/subscriber.rb
+++ b/railties/lib/rails/subscriber.rb
@@ -66,7 +66,7 @@ module Rails
subscriber.send(name, ActiveSupport::Notifications::Event.new(*args))
end
- if args[0] == "action_dispatch.callback" && !subscribers.empty?
+ if args[0] == "action_dispatch.after_dispatch" && !subscribers.empty?
flush_all!
log_tailer.tail! if log_tailer
end
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index db1939c45f..65d0d476ba 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -55,7 +55,7 @@ namespace :doc do
desc "Generate Rails guides"
task :guides do
require File.join(RAILTIES_PATH, "guides/rails_guides")
- RailsGuides::Generator.new(File.join(RAILS_ROOT, "doc/guides")).generate
+ RailsGuides::Generator.new(Rails.root.join("doc/guides")).generate
end
namespace :plugins do
diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake
index f7b53885c8..5d7c094d8b 100644
--- a/railties/lib/rails/tasks/framework.rake
+++ b/railties/lib/rails/tasks/framework.rake
@@ -85,15 +85,16 @@ namespace :rails do
template = ENV["LOCATION"]
template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
- require 'generators'
- generator = Rails::Generators::App.new [ Rails.root ], {}, :destination_root => Rails.root
+ require 'rails/generators'
+ require 'generators/rails/app/app_generator'
+ generator = Rails::Generators::AppGenerator.new [ Rails.root ], {}, :destination_root => Rails.root
generator.apply template, :verbose => false
end
namespace :update do
def invoke_from_app_generator(method)
require 'rails/generators'
- require 'rails/generators/rails/app/app_generator'
+ require 'generators/rails/app/app_generator'
generator = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true },
:destination_root => Rails.root
diff --git a/railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb b/railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb
index a585b37b73..eda3b52c4f 100644
--- a/railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb
+++ b/railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb
@@ -252,10 +252,13 @@ class Thor::Group
shell.padding += 1
result = if block_given?
- if block.arity == 2
- block.call(self, klass)
- else
+ case block.arity
+ when 3
block.call(self, klass, task)
+ when 2
+ block.call(self, klass)
+ when 1
+ instance_exec(klass, &block)
end
else
invoke klass, task, *args
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 7b3077bb6e..1c5cc62ecd 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -18,7 +18,9 @@ module ApplicationTests
"Rack::Lock",
"Rack::Runtime",
"ActionDispatch::ShowExceptions",
+ "ActionDispatch::Notifications",
"ActionDispatch::Callbacks",
+ "ActionDispatch::Cookies",
"ActionDispatch::Session::CookieStore",
"ActionDispatch::Flash",
"ActionDispatch::Cascade",
diff --git a/railties/test/application/notifications_test.rb b/railties/test/application/notifications_test.rb
index 1eb0777db8..db8605edbe 100644
--- a/railties/test/application/notifications_test.rb
+++ b/railties/test/application/notifications_test.rb
@@ -64,7 +64,7 @@ module ApplicationTests
ActiveRecord::Base.logger = logger = MockLogger.new
- # Mimic an ActiveRecord notifications
+ # Mimic ActiveRecord notifications
instrument "active_record.sql", :name => "SQL", :sql => "SHOW tables"
wait
diff --git a/railties/test/backtrace_cleaner_test.rb b/railties/test/backtrace_cleaner_test.rb
index 6cff591b94..80077378db 100644
--- a/railties/test/backtrace_cleaner_test.rb
+++ b/railties/test/backtrace_cleaner_test.rb
@@ -37,7 +37,7 @@ if defined? Gem
test "should format installed gems correctly" do
@backtrace = [ "#{Gem.path[0]}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
- @result = @cleaner.clean(@backtrace)
+ @result = @cleaner.clean(@backtrace, :all)
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
end
@@ -46,7 +46,7 @@ if defined? Gem
# skip this test if default_dir is the only directory on Gem.path
if @target_dir
@backtrace = [ "#{@target_dir}/gems/nosuchgem-1.2.3/lib/foo.rb" ]
- @result = @cleaner.clean(@backtrace)
+ @result = @cleaner.clean(@backtrace, :all)
assert_equal "nosuchgem (1.2.3) lib/foo.rb", @result[0]
end
end
diff --git a/railties/test/fixtures/lib/generators/active_record/fixjour/fixjour_generator.rb b/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb
index a7d079a1bc..7a4edb8bcb 100644
--- a/railties/test/fixtures/lib/generators/active_record/fixjour/fixjour_generator.rb
+++ b/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb
@@ -1,4 +1,4 @@
-require 'rails/generators/active_record'
+require 'generators/active_record'
module ActiveRecord
module Generators
diff --git a/railties/test/fixtures/lib/generators/rails/javascripts_generator.rb b/railties/test/fixtures/lib/generators/rails/javascripts_generator.rb
deleted file mode 100644
index cad5e96784..0000000000
--- a/railties/test/fixtures/lib/generators/rails/javascripts_generator.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-module Rails::Generators
- class JavascriptsGenerator < Rails::Generators::NamedBase
- end
-end
diff --git a/railties/test/fixtures/vendor/gems/gems/wrong/lib/generators/wrong_generator.rb b/railties/test/fixtures/lib/generators/wrong_generator.rb
index 6aa7cb052e..6aa7cb052e 100644
--- a/railties/test/fixtures/vendor/gems/gems/wrong/lib/generators/wrong_generator.rb
+++ b/railties/test/fixtures/lib/generators/wrong_generator.rb
diff --git a/railties/test/fixtures/vendor/another_gem_path/xspec/lib/generators/xspec_generator.rb b/railties/test/fixtures/vendor/another_gem_path/xspec/lib/generators/xspec_generator.rb
deleted file mode 100644
index cd477eb4c9..0000000000
--- a/railties/test/fixtures/vendor/another_gem_path/xspec/lib/generators/xspec_generator.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class XspecGenerator < Rails::Generators::NamedBase
-end
diff --git a/railties/test/fixtures/vendor/plugins/mspec/lib/rails_generators/mspec_generator.rb b/railties/test/fixtures/vendor/plugins/mspec/lib/rails_generators/mspec_generator.rb
deleted file mode 100644
index 191bdbf2fc..0000000000
--- a/railties/test/fixtures/vendor/plugins/mspec/lib/rails_generators/mspec_generator.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class MspecGenerator < Rails::Generators::NamedBase
-end
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index 27b6a49566..cb1fa96e0d 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -1,7 +1,11 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/app/app_generator'
+require 'generators/rails/app/app_generator'
-class ActionsTest < GeneratorsTestCase
+# TODO This line shouldn't be required
+require 'generators/rails/model/model_generator'
+
+class ActionsTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
tests Rails::Generators::AppGenerator
arguments [destination_root]
@@ -11,6 +15,16 @@ class ActionsTest < GeneratorsTestCase
@svn_plugin_uri = 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
end
+ def test_invoke_other_generator_with_shortcut
+ action :invoke, 'model', ['my_model']
+ assert_file 'app/models/my_model.rb', /MyModel/
+ end
+
+ def test_invoke_other_generator_with_full_namespace
+ action :invoke, 'rails:model', ['my_model']
+ assert_file 'app/models/my_model.rb', /MyModel/
+ end
+
def test_create_file_should_write_data_to_file_path
action :create_file, 'lib/test_file.rb', 'heres test data'
assert_file 'lib/test_file.rb', 'heres test data'
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 62ea07f14e..f821f5caf3 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -1,8 +1,9 @@
require 'abstract_unit'
require 'generators/generators_test_helper'
-require 'rails/generators/rails/app/app_generator'
+require 'generators/rails/app/app_generator'
-class AppGeneratorTest < GeneratorsTestCase
+class AppGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments [destination_root]
def setup
@@ -80,11 +81,10 @@ class AppGeneratorTest < GeneratorsTestCase
assert_no_file "config/database.yml"
end
- # TODO: Bring this back using requires
- # def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
- # run_generator ["--skip-activerecord"]
- # assert_file "config/application.rb", /config\.frameworks \-= \[ :active_record \]/
- # end
+ def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
+ run_generator [destination_root, "--skip-activerecord"]
+ assert_file "config/boot.rb", /# require "active_record\/railtie"/
+ end
def test_prototype_and_test_unit_are_added_by_default
run_generator
@@ -159,7 +159,7 @@ class AppGeneratorTest < GeneratorsTestCase
end
def test_default_namespace
- assert_match "rails:generators:app", Rails::Generators::AppGenerator.namespace
+ assert_match "rails:app", Rails::Generators::AppGenerator.namespace
end
def test_file_is_added_for_backwards_compatibility
diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb
index 8e2fd3b9ed..79a4e5bf17 100644
--- a/railties/test/generators/controller_generator_test.rb
+++ b/railties/test/generators/controller_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/controller/controller_generator'
+require 'generators/rails/controller/controller_generator'
-class ControllerGeneratorTest < GeneratorsTestCase
+class ControllerGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(Account foo bar)
def test_help_does_not_show_invoked_generators_options_if_they_already_exist
diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb
index 28377f23b0..f3fd688e4f 100644
--- a/railties/test/generators/generator_generator_test.rb
+++ b/railties/test/generators/generator_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/generator/generator_generator'
+require 'generators/rails/generator/generator_generator'
-class GeneratorGeneratorTest < GeneratorsTestCase
+class GeneratorGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(awesome)
def test_generator_skeleton_is_created
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 54953b76c8..3cd16a69f9 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -10,21 +10,19 @@ Rails.application.config.root = Rails.root
require 'rails/generators'
require 'rails/generators/test_case'
-require 'rubygems'
require 'active_record'
require 'action_dispatch'
-class GeneratorsTestCase < Rails::Generators::TestCase
- destination File.join(Rails.root, "tmp")
- setup :prepare_destination
+module GeneratorsTestHelper
+ def self.included(base)
+ base.class_eval do
+ destination File.join(Rails.root, "tmp")
+ setup :prepare_destination
- def self.inherited(base)
- base.tests Rails::Generators.const_get(base.name.sub(/Test$/, ''))
- rescue
- # Do nothing.
- end
-
- def test_truth
- # Don't cry test/unit
+ begin
+ base.tests Rails::Generators.const_get(base.name.sub(/Test$/, ''))
+ rescue
+ end
+ end
end
end \ No newline at end of file
diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb
index cf18782986..6d7168738e 100644
--- a/railties/test/generators/helper_generator_test.rb
+++ b/railties/test/generators/helper_generator_test.rb
@@ -1,10 +1,11 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/helper/helper_generator'
+require 'generators/rails/helper/helper_generator'
ObjectHelper = Class.new
AnotherObjectHelperTest = Class.new
-class HelperGeneratorTest < GeneratorsTestCase
+class HelperGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(admin)
def test_helper_skeleton_is_created
diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb
index 88e18be5b2..d7fc324c88 100644
--- a/railties/test/generators/integration_test_generator_test.rb
+++ b/railties/test/generators/integration_test_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/integration_test/integration_test_generator'
+require 'generators/rails/integration_test/integration_test_generator'
-class IntegrationTestGeneratorTest < GeneratorsTestCase
+class IntegrationTestGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(integration)
def test_integration_test_skeleton_is_created
diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb
index ee4346eb71..dfc3130f77 100644
--- a/railties/test/generators/mailer_generator_test.rb
+++ b/railties/test/generators/mailer_generator_test.rb
@@ -1,12 +1,13 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/mailer/mailer_generator'
+require 'generators/rails/mailer/mailer_generator'
-class MailerGeneratorTest < GeneratorsTestCase
+class MailerGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(notifier foo bar)
def test_mailer_skeleton_is_created
run_generator
- assert_file "app/models/notifier.rb", /class Notifier < ActionMailer::Base/
+ assert_file "app/mailers/notifier.rb", /class Notifier < ActionMailer::Base/
end
def test_check_class_collision
@@ -16,7 +17,7 @@ class MailerGeneratorTest < GeneratorsTestCase
def test_invokes_default_test_framework
run_generator
- assert_file "test/unit/notifier_test.rb", /class NotifierTest < ActionMailer::TestCase/
+ assert_file "test/functional/notifier_test.rb", /class NotifierTest < ActionMailer::TestCase/
assert_file "test/fixtures/notifier/foo", /app\/views\/notifier\/foo/
assert_file "test/fixtures/notifier/bar", /app\/views\/notifier\/bar/
end
@@ -39,7 +40,7 @@ class MailerGeneratorTest < GeneratorsTestCase
def test_actions_are_turned_into_methods
run_generator
- assert_file "app/models/notifier.rb", /def foo/
- assert_file "app/models/notifier.rb", /def bar/
+ assert_file "app/mailers/notifier.rb", /def foo/
+ assert_file "app/mailers/notifier.rb", /def bar/
end
end
diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb
index 5d6a277561..e3a2384885 100644
--- a/railties/test/generators/metal_generator_test.rb
+++ b/railties/test/generators/metal_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/metal/metal_generator'
+require 'generators/rails/metal/metal_generator'
-class MetalGeneratorTest < GeneratorsTestCase
+class MetalGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(foo)
def test_metal_skeleton_is_created
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb
index 2fd3e5c056..811a712fd5 100644
--- a/railties/test/generators/migration_generator_test.rb
+++ b/railties/test/generators/migration_generator_test.rb
@@ -1,7 +1,9 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/migration/migration_generator'
+require 'generators/rails/migration/migration_generator'
+
+class MigrationGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
-class MigrationGeneratorTest < GeneratorsTestCase
def test_migration
migration = "change_title_body_from_posts"
run_generator [migration]
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index 051a43706b..79ce9a2a7b 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/model/model_generator'
+require 'generators/rails/model/model_generator'
-class ModelGeneratorTest < GeneratorsTestCase
+class ModelGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(Account name:string age:integer)
def test_help_shows_invoked_generators_options
diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb
index 8c1df3b992..99eb431a49 100644
--- a/railties/test/generators/named_base_test.rb
+++ b/railties/test/generators/named_base_test.rb
@@ -1,5 +1,5 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
+require 'generators/rails/scaffold_controller/scaffold_controller_generator'
# Mock out what we need from AR::Base.
module ActiveRecord
@@ -11,7 +11,8 @@ module ActiveRecord
end
end
-class NamedBaseTest < GeneratorsTestCase
+class NamedBaseTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
tests Rails::Generators::ScaffoldControllerGenerator
def test_named_generator_attributes
diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb
index 44d9e4a9f3..058a19228d 100644
--- a/railties/test/generators/observer_generator_test.rb
+++ b/railties/test/generators/observer_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/observer/observer_generator'
+require 'generators/rails/observer/observer_generator'
-class ObserverGeneratorTest < GeneratorsTestCase
+class ObserverGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(account)
def test_invokes_default_orm
diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb
index 099575ea1d..c95063a127 100644
--- a/railties/test/generators/performance_test_generator_test.rb
+++ b/railties/test/generators/performance_test_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/performance_test/performance_test_generator'
+require 'generators/rails/performance_test/performance_test_generator'
-class PerformanceTestGeneratorTest < GeneratorsTestCase
+class PerformanceTestGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(performance)
def test_performance_test_skeleton_is_created
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb
index f84b8b6d50..4bfe210efb 100644
--- a/railties/test/generators/plugin_generator_test.rb
+++ b/railties/test/generators/plugin_generator_test.rb
@@ -1,17 +1,33 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/plugin/plugin_generator'
+require 'generators/rails/plugin/plugin_generator'
-class PluginGeneratorTest < GeneratorsTestCase
+class PluginGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(plugin_fu)
def test_plugin_skeleton_is_created
run_generator
+ year = Date.today.year
%w(
vendor/plugins
vendor/plugins/plugin_fu
+ vendor/plugins/plugin_fu/init.rb
+ vendor/plugins/plugin_fu/install.rb
+ vendor/plugins/plugin_fu/uninstall.rb
vendor/plugins/plugin_fu/lib
+ vendor/plugins/plugin_fu/lib/plugin_fu.rb
).each{ |path| assert_file path }
+
+ %w(
+ vendor/plugins/plugin_fu/README
+ vendor/plugins/plugin_fu/Rakefile
+ ).each{ |path| assert_file path, /PluginFu/ }
+
+ %w(
+ vendor/plugins/plugin_fu/README
+ vendor/plugins/plugin_fu/MIT-LICENSE
+ ).each{ |path| assert_file path, /#{year}/ }
end
def test_check_class_collision
diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb
index 15c0ca0f01..959934bd71 100644
--- a/railties/test/generators/resource_generator_test.rb
+++ b/railties/test/generators/resource_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/resource/resource_generator'
+require 'generators/rails/resource/resource_generator'
-class ResourceGeneratorTest < GeneratorsTestCase
+class ResourceGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(account)
def setup
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index 7593c14dd9..f971598d18 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -1,12 +1,13 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
+require 'generators/rails/scaffold_controller/scaffold_controller_generator'
module Unknown
module Generators
end
end
-class ScaffoldControllerGeneratorTest < GeneratorsTestCase
+class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(User name:string age:integer)
def test_controller_skeleton_is_created
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 4ddc7b1c89..a7e9c8a231 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -1,7 +1,8 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/scaffold/scaffold_generator'
+require 'generators/rails/scaffold/scaffold_generator'
-class ScaffoldGeneratorTest < GeneratorsTestCase
+class ScaffoldGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
arguments %w(product_line title:string price:integer)
def setup
diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb
index 251ffb19ed..de28b4c75b 100644
--- a/railties/test/generators/session_migration_generator_test.rb
+++ b/railties/test/generators/session_migration_generator_test.rb
@@ -1,7 +1,9 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/session_migration/session_migration_generator'
+require 'generators/rails/session_migration/session_migration_generator'
+
+class SessionMigrationGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
-class SessionMigrationGeneratorTest < GeneratorsTestCase
def test_session_migration_with_default_name
run_generator
assert_migration "db/migrate/add_sessions_table.rb", /class AddSessionsTable < ActiveRecord::Migration/
diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb
index d9079327ba..718fcb1fa7 100644
--- a/railties/test/generators/stylesheets_generator_test.rb
+++ b/railties/test/generators/stylesheets_generator_test.rb
@@ -1,7 +1,9 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/stylesheets/stylesheets_generator'
+require 'generators/rails/stylesheets/stylesheets_generator'
+
+class StylesheetsGeneratorTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
-class StylesheetsGeneratorTest < GeneratorsTestCase
def test_copy_stylesheets
run_generator
assert_file "public/stylesheets/scaffold.css"
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index 2df218debc..60c81a813f 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -1,15 +1,21 @@
require 'generators/generators_test_helper'
-require 'rails/generators/rails/model/model_generator'
-require 'rails/generators/test_unit/model/model_generator'
+require 'generators/rails/model/model_generator'
+require 'generators/test_unit/model/model_generator'
require 'mocha'
-class GeneratorsTest < GeneratorsTestCase
+class GeneratorsTest < Rails::Generators::TestCase
+ include GeneratorsTestHelper
+
def setup
- Rails::Generators.instance_variable_set(:@load_paths, nil)
- Gem.stubs(:respond_to?).with(:loaded_specs).returns(false)
+ @path = File.expand_path("lib", Rails.root)
+ $LOAD_PATH.unshift(@path)
+ end
+
+ def teardown
+ $LOAD_PATH.delete(@path)
end
- def test_invoke_add_generators_to_raw_lookups
+ def test_simple_invoke
TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {})
Rails::Generators.invoke("test_unit:model", ["Account"])
end
@@ -34,87 +40,66 @@ class GeneratorsTest < GeneratorsTestCase
Rails::Generators.invoke :model, ["Account"], :behavior => :skip
end
- def test_find_by_namespace_without_base_or_context
- assert_nil Rails::Generators.find_by_namespace(:model)
+ def test_find_by_namespace
+ klass = Rails::Generators.find_by_namespace("rails:model")
+ assert klass
+ assert_equal "rails:model", klass.namespace
end
def test_find_by_namespace_with_base
klass = Rails::Generators.find_by_namespace(:model, :rails)
assert klass
- assert_equal "rails:generators:model", klass.namespace
+ assert_equal "rails:model", klass.namespace
end
def test_find_by_namespace_with_context
klass = Rails::Generators.find_by_namespace(:test_unit, nil, :model)
assert klass
- assert_equal "test_unit:generators:model", klass.namespace
- end
-
- def test_find_by_namespace_with_duplicated_name
- klass = Rails::Generators.find_by_namespace(:foobar)
- assert klass
- assert_equal "foobar:foobar", klass.namespace
+ assert_equal "test_unit:model", klass.namespace
end
- def test_find_by_namespace_lookup_to_the_rails_root_folder
+ def test_find_by_namespace_with_generator_on_root
klass = Rails::Generators.find_by_namespace(:fixjour)
assert klass
assert_equal "fixjour", klass.namespace
end
- def test_find_by_namespace_lookup_to_deep_rails_root_folders
+ def test_find_by_namespace_in_subfolder
klass = Rails::Generators.find_by_namespace(:fixjour, :active_record)
assert klass
- assert_equal "active_record:generators:fixjour", klass.namespace
+ assert_equal "active_record:fixjour", klass.namespace
end
- def test_find_by_namespace_lookup_traverse_folders
- klass = Rails::Generators.find_by_namespace(:javascripts, :rails)
+ def test_find_by_namespace_with_duplicated_name
+ klass = Rails::Generators.find_by_namespace(:foobar)
assert klass
- assert_equal "rails:generators:javascripts", klass.namespace
+ assert_equal "foobar:foobar", klass.namespace
end
- def test_find_by_namespace_lookup_to_vendor_folders
- klass = Rails::Generators.find_by_namespace(:mspec)
- assert klass
- assert_equal "mspec", klass.namespace
+ def test_find_by_namespace_without_base_or_context_looks_into_rails_namespace
+ assert Rails::Generators.find_by_namespace(:model)
end
- def test_find_by_namespace_lookup_with_gem_specification
- assert_nil Rails::Generators.find_by_namespace(:xspec)
- Rails::Generators.instance_variable_set(:@load_paths, nil)
-
- spec = Gem::Specification.new
- spec.expects(:full_gem_path).returns(File.join(Rails.root, 'vendor', 'another_gem_path', 'xspec'))
- Gem.expects(:respond_to?).with(:loaded_specs).returns(true)
- Gem.expects(:loaded_specs).returns(:spec => spec)
-
- klass = Rails::Generators.find_by_namespace(:xspec)
- assert klass
- assert_equal "xspec", klass.namespace
- end
-
- def test_builtin_generators
- assert Rails::Generators.builtin.include?("rails:model")
+ def test_find_by_namespace_show_warning_if_generator_cant_be_loaded
+ output = capture(:stderr) { Rails::Generators.find_by_namespace(:wrong) }
+ assert_match /\[WARNING\] Could not load generator/, output
+ assert_match /Rails 2\.x generator/, output
end
def test_rails_generators_help_with_builtin_information
output = capture(:stdout){ Rails::Generators.help }
- assert_match /model/, output
- assert_match /scaffold_controller/, output
+ assert_match /Rails:/, output
+ assert_match /^ model$/, output
+ assert_match /^ scaffold_controller$/, output
end
def test_rails_generators_with_others_information
- output = capture(:stdout){ Rails::Generators.help }.split("\n").last
- assert_equal "Others: active_record:fixjour, fixjour, foobar:foobar, mspec, rails:javascripts, xspec.", output
- end
-
- def test_warning_is_shown_if_generator_cant_be_loaded
- Rails::Generators.load_paths << File.join(Rails.root, "vendor", "gems", "gems", "wrong")
- output = capture(:stderr){ Rails::Generators.find_by_namespace(:wrong) }
-
- assert_match /\[WARNING\] Could not load generator at/, output
- assert_match /Rails 2\.x generator/, output
+ output = capture(:stdout){ Rails::Generators.help }
+ assert_match /ActiveRecord:/, output
+ assert_match /Fixjour:/, output
+ assert_match /^ active_record:model$/, output
+ assert_match /^ active_record:fixjour$/, output
+ assert_match /^ fixjour$/, output
end
def test_no_color_sets_proper_shell
@@ -124,36 +109,18 @@ class GeneratorsTest < GeneratorsTestCase
Thor::Base.shell = Thor::Shell::Color
end
- def test_rails_root_templates
- template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb")
-
- # Create template
- mkdir_p(File.dirname(template))
- File.open(template, 'w'){ |f| f.write "empty" }
-
- output = capture(:stdout) do
- Rails::Generators.invoke :model, ["user"], :destination_root => destination_root
- end
-
- assert_file "app/models/user.rb" do |content|
- assert_equal "empty", content
- end
- ensure
- rm_rf File.dirname(template)
- end
-
def test_fallbacks_for_generators_on_find_by_namespace
Rails::Generators.fallbacks[:remarkable] = :test_unit
klass = Rails::Generators.find_by_namespace(:plugin, :remarkable)
assert klass
- assert_equal "test_unit:generators:plugin", klass.namespace
+ assert_equal "test_unit:plugin", klass.namespace
end
def test_fallbacks_for_generators_on_find_by_namespace_with_context
Rails::Generators.fallbacks[:remarkable] = :test_unit
klass = Rails::Generators.find_by_namespace(:remarkable, :rails, :plugin)
assert klass
- assert_equal "test_unit:generators:plugin", klass.namespace
+ assert_equal "test_unit:plugin", klass.namespace
end
def test_fallbacks_for_generators_on_invoke
@@ -181,8 +148,26 @@ class GeneratorsTest < GeneratorsTestCase
Rails::Generators.subclasses.delete(klass)
end
+ def test_rails_root_templates
+ template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb")
+
+ # Create template
+ mkdir_p(File.dirname(template))
+ File.open(template, 'w'){ |f| f.write "empty" }
+
+ output = capture(:stdout) do
+ Rails::Generators.invoke :model, ["user"], :destination_root => destination_root
+ end
+
+ assert_file "app/models/user.rb" do |content|
+ assert_equal "empty", content
+ end
+ ensure
+ rm_rf File.dirname(template)
+ end
+
def test_source_paths_for_not_namespaced_generators
- mspec = Rails::Generators.find_by_namespace :mspec
- assert mspec.source_paths.include?(File.join(Rails.root, "lib", "templates", "mspec"))
+ mspec = Rails::Generators.find_by_namespace :fixjour
+ assert mspec.source_paths.include?(File.join(Rails.root, "lib", "templates", "fixjour"))
end
end
diff --git a/railties/test/subscriber_test.rb b/railties/test/subscriber_test.rb
index ac34939510..fa3f7bfabb 100644
--- a/railties/test/subscriber_test.rb
+++ b/railties/test/subscriber_test.rb
@@ -92,7 +92,7 @@ module SubscriberTest
def test_flushes_loggers_when_action_dispatch_callback_is_received
Rails::Subscriber.add :my_subscriber, @subscriber
- instrument "action_dispatch.callback"
+ instrument "action_dispatch.after_dispatch"
wait
assert_equal 1, @logger.flush_count
end
@@ -100,7 +100,7 @@ module SubscriberTest
def test_flushes_the_same_logger_just_once
Rails::Subscriber.add :my_subscriber, @subscriber
Rails::Subscriber.add :another, @subscriber
- instrument "action_dispatch.callback"
+ instrument "action_dispatch.after_dispatch"
wait
assert_equal 1, @logger.flush_count
end
@@ -111,7 +111,7 @@ module SubscriberTest
Rails::Subscriber.log_tailer = log_tailer
Rails::Subscriber.add :my_subscriber, @subscriber
- instrument "action_dispatch.callback"
+ instrument "action_dispatch.after_dispatch"
wait
ensure
Rails::Subscriber.log_tailer = nil