diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/Rakefile | 8 | ||||
-rw-r--r-- | railties/builtin/rails_info/rails/info_helper.rb | 2 | ||||
-rw-r--r-- | railties/lib/generators/erb.rb | 8 | ||||
-rw-r--r-- | railties/lib/generators/erb/mailer/mailer_generator.rb | 20 | ||||
-rw-r--r-- | railties/lib/generators/test_unit/controller/templates/functional_test.rb | 8 | ||||
-rw-r--r-- | railties/lib/generators/test_unit/mailer/templates/fixture | 3 | ||||
-rw-r--r-- | railties/lib/rails.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 59 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands/application.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/dbconsole.rb | 12 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/generators.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/base.rb | 12 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb.rb | 21 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/controller/controller_generator.rb (renamed from railties/lib/generators/erb/controller/controller_generator.rb) | 9 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/controller/templates/view.html.erb (renamed from railties/lib/generators/erb/controller/templates/view.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/mailer/mailer_generator.rb | 13 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/mailer/templates/view.text.erb (renamed from railties/lib/generators/erb/mailer/templates/view.text.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb (renamed from railties/lib/generators/erb/scaffold/scaffold_generator.rb) | 40 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/_form.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/edit.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/index.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/index.html.erb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/layout.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/new.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/new.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/scaffold/templates/show.html.erb (renamed from railties/lib/generators/erb/scaffold/templates/show.html.erb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/named_base.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/USAGE (renamed from railties/lib/generators/rails/app/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb (renamed from railties/lib/generators/rails/app/app_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile (renamed from railties/lib/generators/rails/app/templates/Gemfile) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/README (renamed from railties/lib/generators/rails/app/templates/README) | 0 | ||||
-rwxr-xr-x | railties/lib/rails/generators/rails/app/templates/Rakefile (renamed from railties/lib/generators/rails/app/templates/Rakefile) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb (renamed from railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb (renamed from railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory (renamed from railties/lib/generators/rails/app/templates/app/models/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory (renamed from railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config.ru (renamed from railties/lib/generators/rails/app/templates/config.ru) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb (renamed from railties/lib/generators/rails/app/templates/config/application.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/boot.rb (renamed from railties/lib/generators/rails/app/templates/config/boot.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/frontbase.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/mysql.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/oracle.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/postgresql.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml (renamed from railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environment.rb (renamed from railties/lib/generators/rails/app/templates/config/environment.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt (renamed from railties/lib/generators/rails/app/templates/config/environments/development.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt (renamed from railties/lib/generators/rails/app/templates/config/environments/production.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt (renamed from railties/lib/generators/rails/app/templates/config/environments/test.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb (renamed from railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt (renamed from railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb (renamed from railties/lib/generators/rails/app/templates/config/initializers/inflections.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb (renamed from railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt (renamed from railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/locales/en.yml (renamed from railties/lib/generators/rails/app/templates/config/locales/en.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/routes.rb (renamed from railties/lib/generators/rails/app/templates/config/routes.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/db/seeds.rb (renamed from railties/lib/generators/rails/app/templates/db/seeds.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP (renamed from railties/lib/generators/rails/app/templates/doc/README_FOR_APP) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/gitignore (renamed from railties/lib/generators/rails/app/templates/gitignore) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/404.html (renamed from railties/lib/generators/rails/app/templates/public/404.html) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/422.html (renamed from railties/lib/generators/rails/app/templates/public/422.html) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/500.html (renamed from railties/lib/generators/rails/app/templates/public/500.html) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/favicon.ico (renamed from railties/lib/generators/rails/app/templates/public/favicon.ico) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/images/rails.png (renamed from railties/lib/generators/rails/app/templates/public/images/rails.png) | bin | 6646 -> 6646 bytes | |||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/index.html (renamed from railties/lib/generators/rails/app/templates/public/index.html) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/application.js) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/controls.js) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/effects.js) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/prototype.js) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/javascripts/rails.js (renamed from railties/lib/generators/rails/app/templates/public/javascripts/rails.js) | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/robots.txt (renamed from railties/lib/generators/rails/app/templates/public/robots.txt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory (renamed from railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/script/rails (renamed from railties/lib/generators/rails/app/templates/script/rails) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory (renamed from railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory (renamed from railties/lib/generators/rails/app/templates/test/functional/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory (renamed from railties/lib/generators/rails/app/templates/test/integration/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb (renamed from railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/test_helper.rb (renamed from railties/lib/generators/rails/app/templates/test/test_helper.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory (renamed from railties/lib/generators/rails/app/templates/test/unit/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/controller/USAGE (renamed from railties/lib/generators/rails/controller/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/controller/controller_generator.rb (renamed from railties/lib/generators/rails/controller/controller_generator.rb) | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/controller/templates/controller.rb (renamed from railties/lib/generators/rails/controller/templates/controller.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/generator/USAGE (renamed from railties/lib/generators/rails/generator/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/generator/generator_generator.rb (renamed from railties/lib/generators/rails/generator/generator_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt (renamed from railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/generator/templates/USAGE.tt (renamed from railties/lib/generators/rails/generator/templates/USAGE.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory (renamed from railties/lib/generators/rails/generator/templates/templates/.empty_directory) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/helper/USAGE (renamed from railties/lib/generators/rails/helper/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/helper/helper_generator.rb (renamed from railties/lib/generators/rails/helper/helper_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/helper/templates/helper.rb (renamed from railties/lib/generators/rails/helper/templates/helper.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/integration_test/USAGE (renamed from railties/lib/generators/rails/integration_test/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb (renamed from railties/lib/generators/rails/integration_test/integration_test_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/mailer/USAGE (renamed from railties/lib/generators/rails/mailer/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/mailer/mailer_generator.rb (renamed from railties/lib/generators/rails/mailer/mailer_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/mailer/templates/mailer.rb (renamed from railties/lib/generators/rails/mailer/templates/mailer.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/metal/USAGE (renamed from railties/lib/generators/rails/metal/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/metal/metal_generator.rb (renamed from railties/lib/generators/rails/metal/metal_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/metal/templates/metal.rb (renamed from railties/lib/generators/rails/metal/templates/metal.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/migration/USAGE (renamed from railties/lib/generators/rails/migration/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/migration/migration_generator.rb (renamed from railties/lib/generators/rails/migration/migration_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/model/USAGE (renamed from railties/lib/generators/rails/model/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/model/model_generator.rb (renamed from railties/lib/generators/rails/model/model_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb (renamed from railties/lib/generators/rails/model_subclass/model_subclass_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/observer/USAGE (renamed from railties/lib/generators/rails/observer/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/observer/observer_generator.rb (renamed from railties/lib/generators/rails/observer/observer_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/performance_test/USAGE (renamed from railties/lib/generators/rails/performance_test/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb (renamed from railties/lib/generators/rails/performance_test/performance_test_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/USAGE (renamed from railties/lib/generators/rails/plugin/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/plugin_generator.rb (renamed from railties/lib/generators/rails/plugin/plugin_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt (renamed from railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/README.tt (renamed from railties/lib/generators/rails/plugin/templates/README.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt (renamed from railties/lib/generators/rails/plugin/templates/Rakefile.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/init.rb (renamed from railties/lib/generators/rails/plugin/templates/init.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/install.rb (renamed from railties/lib/generators/rails/plugin/templates/install.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt (renamed from railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt (renamed from railties/lib/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/uninstall.rb (renamed from railties/lib/generators/rails/plugin/templates/uninstall.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/resource/USAGE (renamed from railties/lib/generators/rails/resource/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/resource/resource_generator.rb (renamed from railties/lib/generators/rails/resource/resource_generator.rb) | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold/USAGE (renamed from railties/lib/generators/rails/scaffold/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb (renamed from railties/lib/generators/rails/scaffold/scaffold_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold_controller/USAGE (renamed from railties/lib/generators/rails/scaffold_controller/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb (renamed from railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb (renamed from railties/lib/generators/rails/scaffold_controller/templates/controller.rb) | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/session_migration/USAGE (renamed from railties/lib/generators/rails/session_migration/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb (renamed from railties/lib/generators/rails/session_migration/session_migration_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/USAGE (renamed from railties/lib/generators/rails/stylesheets/USAGE) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb (renamed from railties/lib/generators/rails/stylesheets/stylesheets_generator.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css (renamed from railties/lib/generators/rails/stylesheets/templates/scaffold.css) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit.rb (renamed from railties/lib/generators/test_unit.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/controller/controller_generator.rb (renamed from railties/lib/generators/test_unit/controller/controller_generator.rb) | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb | 18 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/helper/helper_generator.rb (renamed from railties/lib/generators/test_unit/helper/helper_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb (renamed from railties/lib/generators/test_unit/helper/templates/helper_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/integration/integration_generator.rb (renamed from railties/lib/generators/test_unit/integration/integration_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb (renamed from railties/lib/generators/test_unit/integration/templates/integration_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb (renamed from railties/lib/generators/test_unit/mailer/mailer_generator.rb) | 9 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb (renamed from railties/lib/generators/test_unit/mailer/templates/functional_test.rb) | 11 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/model_generator.rb (renamed from railties/lib/generators/test_unit/model/model_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/fixtures.yml (renamed from railties/lib/generators/test_unit/model/templates/fixtures.yml) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/unit_test.rb (renamed from railties/lib/generators/test_unit/model/templates/unit_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/observer/observer_generator.rb (renamed from railties/lib/generators/test_unit/observer/observer_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb (renamed from railties/lib/generators/test_unit/observer/templates/unit_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/performance/performance_generator.rb (renamed from railties/lib/generators/test_unit/performance/performance_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb (renamed from railties/lib/generators/test_unit/performance/templates/performance_test.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb (renamed from railties/lib/generators/test_unit/plugin/plugin_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt (renamed from railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb (renamed from railties/lib/generators/test_unit/plugin/templates/test_helper.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb (renamed from railties/lib/generators/test_unit/scaffold/scaffold_generator.rb) | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb (renamed from railties/lib/generators/test_unit/scaffold/templates/functional_test.rb) | 14 | ||||
-rw-r--r-- | railties/lib/rails/info.rb (renamed from railties/builtin/rails_info/rails/info.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/info_controller.rb (renamed from railties/builtin/rails_info/rails/info_controller.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/info_routes.rb (renamed from railties/builtin/routes.rb) | 0 | ||||
-rw-r--r-- | railties/lib/rails/railtie.rb | 27 | ||||
-rw-r--r-- | railties/lib/rails/railtie/configuration.rb | 77 | ||||
-rw-r--r-- | railties/lib/rails/railties_path.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/tasks/documentation.rake | 7 | ||||
-rw-r--r-- | railties/lib/rails/tasks/framework.rake | 10 | ||||
-rw-r--r-- | railties/lib/rails/tasks/misc.rake | 8 | ||||
-rw-r--r-- | railties/lib/rails/test_help.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/railtie.rb | 2 | ||||
-rw-r--r-- | railties/railties.gemspec | 2 | ||||
-rw-r--r-- | railties/test/abstract_unit.rb | 1 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 27 | ||||
-rw-r--r-- | railties/test/application/paths_test.rb | 18 | ||||
-rw-r--r-- | railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb | 2 | ||||
-rw-r--r-- | railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb (renamed from railties/test/fixtures/lib/rails_generators/foobar/foobar_generator.rb) | 0 | ||||
-rw-r--r-- | railties/test/generators/actions_test.rb | 5 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/controller_generator_test.rb | 15 | ||||
-rw-r--r-- | railties/test/generators/generator_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/helper_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/integration_test_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/mailer_generator_test.rb | 14 | ||||
-rw-r--r-- | railties/test/generators/metal_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/named_base_test.rb | 20 | ||||
-rw-r--r-- | railties/test/generators/observer_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/performance_test_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/resource_generator_test.rb | 12 | ||||
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 12 | ||||
-rw-r--r-- | railties/test/generators/session_migration_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/stylesheets_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators_test.rb | 4 | ||||
-rw-r--r-- | railties/test/rails_info_controller_test.rb | 3 | ||||
-rw-r--r-- | railties/test/railties/railtie_test.rb | 21 |
192 files changed, 343 insertions, 320 deletions
diff --git a/railties/Rakefile b/railties/Rakefile index fe049d565f..6368456366 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -36,7 +36,7 @@ end desc "Updates application README to the latest version Railties README" task :update_readme do - readme = "lib/generators/rails/app/templates/README" + readme = "lib/rails/generators/rails/app/templates/README" rm readme cp "./README", readme end @@ -48,7 +48,7 @@ task :generate_guides do end task :update_prototype_ujs do - system "curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/generators/rails/app/templates/public/javascripts/rails.js" + system "curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/rails.js" end # Generate documentation ------------------------------------------------------------------ @@ -62,8 +62,8 @@ Rake::RDocTask.new { |rdoc| rdoc.rdoc_files.include('README', 'CHANGELOG') rdoc.rdoc_files.include('lib/*.rb') rdoc.rdoc_files.include('lib/rails/*.rb') - rdoc.rdoc_files.include('lib/generators/*.rb') - rdoc.rdoc_files.include('lib/commands/**/*.rb') + rdoc.rdoc_files.include('lib/rails/generators/*.rb') + rdoc.rdoc_files.include('lib/rails/commands/**/*.rb') } # Generate GEM ---------------------------------------------------------------------------- diff --git a/railties/builtin/rails_info/rails/info_helper.rb b/railties/builtin/rails_info/rails/info_helper.rb deleted file mode 100644 index e5605a8d9b..0000000000 --- a/railties/builtin/rails_info/rails/info_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Rails::InfoHelper -end diff --git a/railties/lib/generators/erb.rb b/railties/lib/generators/erb.rb deleted file mode 100644 index d468d012dc..0000000000 --- a/railties/lib/generators/erb.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'rails/generators/named_base' - -module Erb - module Generators - class Base < Rails::Generators::NamedBase #:nodoc: - end - end -end diff --git a/railties/lib/generators/erb/mailer/mailer_generator.rb b/railties/lib/generators/erb/mailer/mailer_generator.rb deleted file mode 100644 index 408c942cef..0000000000 --- a/railties/lib/generators/erb/mailer/mailer_generator.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'generators/erb' - -module Erb - module Generators - class MailerGenerator < Base - argument :actions, :type => :array, :default => [], :banner => "method method" - - def create_view_folder - empty_directory File.join("app/views", file_path) - end - - def create_view_files - actions.each do |action| - @action, @path = action, File.join(file_path, action) - template "view.text.erb", File.join("app/views", "#{@path}.text.erb") - end - end - end - end -end diff --git a/railties/lib/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/generators/test_unit/controller/templates/functional_test.rb deleted file mode 100644 index 62fa5d86fd..0000000000 --- a/railties/lib/generators/test_unit/controller/templates/functional_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'test_helper' - -class <%= class_name %>ControllerTest < ActionController::TestCase - # Replace this with your real tests. - test "the truth" do - assert true - end -end diff --git a/railties/lib/generators/test_unit/mailer/templates/fixture b/railties/lib/generators/test_unit/mailer/templates/fixture deleted file mode 100644 index 171648d6fd..0000000000 --- a/railties/lib/generators/test_unit/mailer/templates/fixture +++ /dev/null @@ -1,3 +0,0 @@ -<%= class_name %>#<%= @action %> - -Hi, find me in app/views/<%= @path %> diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 3d3151bd8f..9d02da104d 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -26,6 +26,9 @@ else end module Rails + autoload :Info, 'rails/info' + autoload :InfoController, 'rails/info_controller' + class << self def application @@application ||= nil diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 49388c5060..0084309ea4 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -1,5 +1,4 @@ require 'fileutils' -require 'rails/railties_path' require 'rails/plugin' require 'rails/engine' @@ -82,6 +81,8 @@ module Rails end end + delegate :metal_loader, :to => :config + def require_environment! environment = config.paths.config.environment.to_a.first require environment if environment diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index d3a0ecb243..44635ff4f6 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -6,7 +6,7 @@ module Rails include ::Rails::Configuration::Deprecated attr_accessor :allow_concurrency, :cache_classes, :cache_store, - :consider_all_requests_local, :dependency_loading, + :cookie_secret, :consider_all_requests_local, :dependency_loading, :filter_parameters, :log_level, :logger, :metals, :plugins, :preload_frameworks, :reload_engines, :reload_plugins, :serve_static_assets, :time_zone, :whiny_nils @@ -19,10 +19,16 @@ module Rails @serve_static_assets = true @time_zone = "UTC" @consider_all_requests_local = true + @session_store = :cookie_store + @session_options = {} end def middleware - @@default_middleware_stack ||= default_middleware + @middleware ||= default_middleware_stack + end + + def metal_loader + @metal_loader ||= Rails::Application::MetalLoader.new end def paths @@ -78,7 +84,7 @@ module Rails end def builtin_controller - File.join(RAILTIES_PATH, "builtin", "rails_info") if Rails.env.development? + File.expand_path('../info_routes', __FILE__) if Rails.env.development? end def log_level @@ -94,6 +100,51 @@ module Rails Rails::LogSubscriber.colorize_logging = val self.generators.colorize_logging = val end + + def session_store(*args) + if args.empty? + case @session_store + when :disabled + nil + when :active_record_store + ActiveRecord::SessionStore + when Symbol + ActionDispatch::Session.const_get(@session_store.to_s.camelize) + else + @session_store + end + else + @session_store = args.shift + @session_options = args.shift || {} + end + end + + protected + + def session_options + return @session_options unless @session_store == :cookie_store + @session_options.merge(:secret => @cookie_secret) + end + + def default_middleware_stack + ActionDispatch::MiddlewareStack.new.tap do |middleware| + middleware.use('::ActionDispatch::Static', lambda { Rails.public_path }, :if => lambda { serve_static_assets }) + middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency }) + middleware.use('::Rack::Runtime') + middleware.use('::Rails::Rack::Logger') + middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }) + middleware.use("::ActionDispatch::RemoteIp", lambda { action_dispatch.ip_spoofing_check }, lambda { action_dispatch.trusted_proxies }) + middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header }) + middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes }) + middleware.use('::ActionDispatch::Cookies') + middleware.use(lambda { session_store }, lambda { session_options }) + middleware.use('::ActionDispatch::Flash', :if => lambda { session_store }) + middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? }) + middleware.use('ActionDispatch::ParamsParser') + middleware.use('::Rack::MethodOverride') + middleware.use('::ActionDispatch::Head') + end + end end end -end
\ No newline at end of file +end diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index cb38d5a5db..978490f25f 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -23,7 +23,7 @@ module Rails initializer :add_builtin_route do |app| if Rails.env.development? - app.routes_reloader.paths << File.join(RAILTIES_PATH, 'builtin', 'routes.rb') + app.routes_reloader.paths << File.expand_path('../../info_routes.rb', __FILE__) end end @@ -45,4 +45,4 @@ module Rails end end end -end
\ No newline at end of file +end diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index fe2f89ee98..438c976b35 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -8,6 +8,6 @@ ARGV << "--help" if ARGV.empty? require 'rubygems' if ARGV.include?("--dev") require 'rails/generators' -require 'generators/rails/app/app_generator' +require 'rails/generators/rails/app/app_generator' Rails::Generators::AppGenerator.start
\ No newline at end of file diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index 593e2d8ee3..68982b9f52 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -91,6 +91,18 @@ module Rails args << config['database'] exec(find_cmd('sqlite3'), *args) + + when "oracle", "oracle_enhanced" + logon = "" + + if config['username'] + logon = config['username'] + logon << "/#{config['password']}" if config['password'] && include_password + logon << "@#{config['database']}" if config['database'] + end + + exec(find_cmd('sqlplus'), logon) + else abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!" end diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 7ee0f31359..85cae75bce 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -93,11 +93,11 @@ module Rails class << self attr_accessor :called_from - alias :engine_name :railtie_name - alias :engine_names :railtie_names + # TODO Remove this. It's deprecated. + alias :engine_name :railtie_name def inherited(base) - unless abstract_railtie?(base) + unless base.abstract_railtie? base.called_from = begin # Remove the line number from backtraces making sure we don't leave anything behind call_stack = caller.map { |p| p.split(':')[0..-2].join(':') } @@ -124,7 +124,7 @@ module Rails end end - delegate :middleware, :paths, :metal_loader, :root, :to => :config + delegate :middleware, :paths, :root, :to => :config def load_tasks super diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 9a51171cf5..57462707f4 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -242,7 +242,7 @@ module Rails paths = namespaces_to_paths(namespaces) paths.each do |raw_path| - ["rails_generators", "generators"].each do |base| + ["rails/generators", "generators"].each do |base| path = "#{base}/#{raw_path}_generator" begin @@ -265,7 +265,7 @@ module Rails load_generators_from_railties! $LOAD_PATH.each do |base| - Dir[File.join(base, "{generators,rails_generators}", "**", "*_generator.rb")].each do |path| + Dir[File.join(base, "{rails/generators,generators}", "**", "*_generator.rb")].each do |path| begin require path rescue Exception => e diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 9624c35c0b..0da85ea4a4 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -1,4 +1,12 @@ -require 'thor/group' +begin + require 'thor/group' +rescue LoadError + puts "Thor is not available.\nIf you ran this command from a git checkout " \ + "of Rails, please make sure thor is installed,\nand run this command " \ + "as `ruby /path/to/rails myapp --dev`" + exit +end + require 'rails/generators/actions' module Rails @@ -17,7 +25,7 @@ module Rails def self.source_root @_rails_source_root ||= begin if base_name && generator_name - File.expand_path(File.join("../../generators", base_name, generator_name, 'templates'), File.dirname(__FILE__)) + File.expand_path(File.join(base_name, generator_name, 'templates'), File.dirname(__FILE__)) end end end diff --git a/railties/lib/rails/generators/erb.rb b/railties/lib/rails/generators/erb.rb new file mode 100644 index 0000000000..3e6371268f --- /dev/null +++ b/railties/lib/rails/generators/erb.rb @@ -0,0 +1,21 @@ +require 'rails/generators/named_base' + +module Erb + module Generators + class Base < Rails::Generators::NamedBase #:nodoc: + protected + + def format + :html + end + + def handler + :erb + end + + def filename_with_extensions(name) + [name, format, handler].compact.join(".") + end + end + end +end diff --git a/railties/lib/generators/erb/controller/controller_generator.rb b/railties/lib/rails/generators/erb/controller/controller_generator.rb index ab7b273662..ac57140c23 100644 --- a/railties/lib/generators/erb/controller/controller_generator.rb +++ b/railties/lib/rails/generators/erb/controller/controller_generator.rb @@ -1,19 +1,18 @@ -require 'generators/erb' +require 'rails/generators/erb' module Erb module Generators class ControllerGenerator < Base argument :actions, :type => :array, :default => [], :banner => "action action" - def create_view_files + def copy_view_files base_path = File.join("app/views", class_path, file_name) empty_directory base_path actions.each do |action| @action = action - @path = File.join(base_path, "#{action}.html.erb") - - template 'view.html.erb', @path + @path = File.join(base_path, filename_with_extensions(action)) + template filename_with_extensions(:view), @path end end end diff --git a/railties/lib/generators/erb/controller/templates/view.html.erb b/railties/lib/rails/generators/erb/controller/templates/view.html.erb index cd54d13d83..cd54d13d83 100644 --- a/railties/lib/generators/erb/controller/templates/view.html.erb +++ b/railties/lib/rails/generators/erb/controller/templates/view.html.erb diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb new file mode 100644 index 0000000000..943d0c9f8d --- /dev/null +++ b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb @@ -0,0 +1,13 @@ +require 'rails/generators/erb/controller/controller_generator' + +module Erb + module Generators + class MailerGenerator < ControllerGenerator + protected + + def format + :text + end + end + end +end diff --git a/railties/lib/generators/erb/mailer/templates/view.text.erb b/railties/lib/rails/generators/erb/mailer/templates/view.text.erb index 6d597256a6..6d597256a6 100644 --- a/railties/lib/generators/erb/mailer/templates/view.text.erb +++ b/railties/lib/rails/generators/erb/mailer/templates/view.text.erb diff --git a/railties/lib/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb index 846540476f..f607e580a5 100644 --- a/railties/lib/generators/erb/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'generators/erb' +require 'rails/generators/erb' require 'rails/generators/resource_helpers' module Erb @@ -15,39 +15,27 @@ module Erb empty_directory File.join("app/views", controller_file_path) end - def copy_index_file - return if options[:singleton] - copy_view :index - end - - def copy_edit_file - copy_view :edit - end + def copy_view_files + views = available_views + views.delete("index") if options[:singleton] - def copy_show_file - copy_view :show - end - - def copy_new_file - copy_view :new - end - - def copy_form_file - copy_view :_form + views.each do |view| + filename = filename_with_extensions(view) + template filename, File.join("app/views", controller_file_path, filename) + end end def copy_layout_file return unless options[:layout] - template "layout.html.erb", - File.join("app/views/layouts", controller_class_path, "#{controller_file_name}.html.erb") + template filename_with_extensions(:layout), + File.join("app/views/layouts", controller_class_path, filename_with_extensions(controller_file_name)) end - protected - - def copy_view(view) - template "#{view}.html.erb", File.join("app/views", controller_file_path, "#{view}.html.erb") - end + protected + def available_views + %w(index edit show new _form) + end end end end diff --git a/railties/lib/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb index 01ec58c615..01ec58c615 100644 --- a/railties/lib/generators/erb/scaffold/templates/_form.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb diff --git a/railties/lib/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb index 5bc507ffc8..5bc507ffc8 100644 --- a/railties/lib/generators/erb/scaffold/templates/edit.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb diff --git a/railties/lib/generators/erb/scaffold/templates/index.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb index b5c7fd1e58..d30d306d42 100644 --- a/railties/lib/generators/erb/scaffold/templates/index.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb @@ -24,4 +24,4 @@ <br /> -<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %> +<%%= link_to 'New <%= human_name %>', new_<%= singular_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb index 3f64be0c45..3f64be0c45 100644 --- a/railties/lib/generators/erb/scaffold/templates/layout.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb diff --git a/railties/lib/generators/erb/scaffold/templates/new.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb index 9a1c489331..9a1c489331 100644 --- a/railties/lib/generators/erb/scaffold/templates/new.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb diff --git a/railties/lib/generators/erb/scaffold/templates/show.html.erb b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb index 24f13fc0f8..24f13fc0f8 100644 --- a/railties/lib/generators/erb/scaffold/templates/show.html.erb +++ b/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 12e918731e..8d1dfbd947 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -27,6 +27,10 @@ module Rails @class_name ||= (class_path + [file_name]).map!{ |m| m.camelize }.join('::') end + def human_name + @human_name ||= singular_name.humanize + end + def plural_name @plural_name ||= singular_name.pluralize end diff --git a/railties/lib/generators/rails/app/USAGE b/railties/lib/rails/generators/rails/app/USAGE index 36d6061a59..36d6061a59 100644 --- a/railties/lib/generators/rails/app/USAGE +++ b/railties/lib/rails/generators/rails/app/USAGE diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 1e1acc1141..fccae9190a 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/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__)) RESERVED_NAMES = %w[generate console server dbconsole application destroy benchmarker profiler diff --git a/railties/lib/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index 0dd10f3f2d..0dd10f3f2d 100644 --- a/railties/lib/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile diff --git a/railties/lib/generators/rails/app/templates/README b/railties/lib/rails/generators/rails/app/templates/README index ded8570c42..ded8570c42 100644 --- a/railties/lib/generators/rails/app/templates/README +++ b/railties/lib/rails/generators/rails/app/templates/README diff --git a/railties/lib/generators/rails/app/templates/Rakefile b/railties/lib/rails/generators/rails/app/templates/Rakefile index 9cb2046439..9cb2046439 100755 --- a/railties/lib/generators/rails/app/templates/Rakefile +++ b/railties/lib/rails/generators/rails/app/templates/Rakefile diff --git a/railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb index e8065d9505..e8065d9505 100644 --- a/railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb +++ b/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb diff --git a/railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb index de6be7945c..de6be7945c 100644 --- a/railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb +++ b/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb diff --git a/railties/lib/generators/rails/app/templates/app/models/.empty_directory b/railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/app/models/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru index fcfbc6b07a..fcfbc6b07a 100644 --- a/railties/lib/generators/rails/app/templates/config.ru +++ b/railties/lib/rails/generators/rails/app/templates/config.ru diff --git a/railties/lib/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index dc20ffb2fa..dc20ffb2fa 100644 --- a/railties/lib/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb diff --git a/railties/lib/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb index 3cb561d41f..3cb561d41f 100644 --- a/railties/lib/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb diff --git a/railties/lib/generators/rails/app/templates/config/databases/frontbase.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml index c0c3588be1..c0c3588be1 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/frontbase.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml diff --git a/railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml index 2784a949fb..2784a949fb 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml diff --git a/railties/lib/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml index 6bf2f7b1fd..6bf2f7b1fd 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/mysql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml diff --git a/railties/lib/generators/rails/app/templates/config/databases/oracle.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml index a1883f6256..a1883f6256 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/oracle.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml diff --git a/railties/lib/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index f600e054cf..f600e054cf 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml diff --git a/railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml index 025d62a8d8..025d62a8d8 100644 --- a/railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml diff --git a/railties/lib/generators/rails/app/templates/config/environment.rb b/railties/lib/rails/generators/rails/app/templates/config/environment.rb index 1684986a59..1684986a59 100644 --- a/railties/lib/generators/rails/app/templates/config/environment.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/environment.rb diff --git a/railties/lib/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index f0e917dd96..f0e917dd96 100644 --- a/railties/lib/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt diff --git a/railties/lib/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index 917052c3df..917052c3df 100644 --- a/railties/lib/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt diff --git a/railties/lib/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt index 0b87b241ec..0b87b241ec 100644 --- a/railties/lib/generators/rails/app/templates/config/environments/test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt diff --git a/railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb index 59385cdf37..59385cdf37 100644 --- a/railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb diff --git a/railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt index be627fbbcc..be627fbbcc 100644 --- a/railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt diff --git a/railties/lib/generators/rails/app/templates/config/initializers/inflections.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb index d531b8bb82..d531b8bb82 100644 --- a/railties/lib/generators/rails/app/templates/config/initializers/inflections.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb diff --git a/railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb index 72aca7e441..72aca7e441 100644 --- a/railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb diff --git a/railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt index 9e32fb930e..9e32fb930e 100644 --- a/railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt diff --git a/railties/lib/generators/rails/app/templates/config/locales/en.yml b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml index a747bfa698..a747bfa698 100644 --- a/railties/lib/generators/rails/app/templates/config/locales/en.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml diff --git a/railties/lib/generators/rails/app/templates/config/routes.rb b/railties/lib/rails/generators/rails/app/templates/config/routes.rb index d6c0365c04..d6c0365c04 100644 --- a/railties/lib/generators/rails/app/templates/config/routes.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/routes.rb diff --git a/railties/lib/generators/rails/app/templates/db/seeds.rb b/railties/lib/rails/generators/rails/app/templates/db/seeds.rb index 664d8c74c8..664d8c74c8 100644 --- a/railties/lib/generators/rails/app/templates/db/seeds.rb +++ b/railties/lib/rails/generators/rails/app/templates/db/seeds.rb diff --git a/railties/lib/generators/rails/app/templates/doc/README_FOR_APP b/railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP index fe41f5cc24..fe41f5cc24 100644 --- a/railties/lib/generators/rails/app/templates/doc/README_FOR_APP +++ b/railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP diff --git a/railties/lib/generators/rails/app/templates/gitignore b/railties/lib/rails/generators/rails/app/templates/gitignore index af64fae5e7..af64fae5e7 100644 --- a/railties/lib/generators/rails/app/templates/gitignore +++ b/railties/lib/rails/generators/rails/app/templates/gitignore diff --git a/railties/lib/generators/rails/app/templates/public/404.html b/railties/lib/rails/generators/rails/app/templates/public/404.html index 9a48320a5f..9a48320a5f 100644 --- a/railties/lib/generators/rails/app/templates/public/404.html +++ b/railties/lib/rails/generators/rails/app/templates/public/404.html diff --git a/railties/lib/generators/rails/app/templates/public/422.html b/railties/lib/rails/generators/rails/app/templates/public/422.html index 83660ab187..83660ab187 100644 --- a/railties/lib/generators/rails/app/templates/public/422.html +++ b/railties/lib/rails/generators/rails/app/templates/public/422.html diff --git a/railties/lib/generators/rails/app/templates/public/500.html b/railties/lib/rails/generators/rails/app/templates/public/500.html index b80307fc16..b80307fc16 100644 --- a/railties/lib/generators/rails/app/templates/public/500.html +++ b/railties/lib/rails/generators/rails/app/templates/public/500.html diff --git a/railties/lib/generators/rails/app/templates/public/favicon.ico b/railties/lib/rails/generators/rails/app/templates/public/favicon.ico index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/public/favicon.ico +++ b/railties/lib/rails/generators/rails/app/templates/public/favicon.ico diff --git a/railties/lib/generators/rails/app/templates/public/images/rails.png b/railties/lib/rails/generators/rails/app/templates/public/images/rails.png Binary files differindex d5edc04e65..d5edc04e65 100644 --- a/railties/lib/generators/rails/app/templates/public/images/rails.png +++ b/railties/lib/rails/generators/rails/app/templates/public/images/rails.png diff --git a/railties/lib/generators/rails/app/templates/public/index.html b/railties/lib/rails/generators/rails/app/templates/public/index.html index 836da1b689..836da1b689 100644 --- a/railties/lib/generators/rails/app/templates/public/index.html +++ b/railties/lib/rails/generators/rails/app/templates/public/index.html diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/application.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js index fe4577696b..fe4577696b 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/application.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/controls.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js index 7392fb664c..7392fb664c 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/controls.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js index 15c6dbca68..15c6dbca68 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/effects.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js index 066ee5909c..066ee5909c 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/effects.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/prototype.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js index 9fe6e1243b..9fe6e1243b 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/prototype.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/rails.js b/railties/lib/rails/generators/rails/app/templates/public/javascripts/rails.js index f7ddba390a..7342e1b830 100644 --- a/railties/lib/generators/rails/app/templates/public/javascripts/rails.js +++ b/railties/lib/rails/generators/rails/app/templates/public/javascripts/rails.js @@ -15,8 +15,7 @@ document.observe("dom:loaded", function() { params = element.serialize(true); } else { method = element.readAttribute('data-method') || 'get'; - // TODO: data-url support is going away, just use href - url = element.readAttribute('data-url') || element.readAttribute('href'); + url = element.readAttribute('href'); params = {}; } diff --git a/railties/lib/generators/rails/app/templates/public/robots.txt b/railties/lib/rails/generators/rails/app/templates/public/robots.txt index 085187fa58..085187fa58 100644 --- a/railties/lib/generators/rails/app/templates/public/robots.txt +++ b/railties/lib/rails/generators/rails/app/templates/public/robots.txt diff --git a/railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory b/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/script/rails b/railties/lib/rails/generators/rails/app/templates/script/rails index b01d1ee183..b01d1ee183 100644 --- a/railties/lib/generators/rails/app/templates/script/rails +++ b/railties/lib/rails/generators/rails/app/templates/script/rails diff --git a/railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory b/railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/test/functional/.empty_directory b/railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/test/functional/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/test/integration/.empty_directory b/railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/test/integration/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory diff --git a/railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb index a3dc38d9e4..a3dc38d9e4 100644 --- a/railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb +++ b/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb diff --git a/railties/lib/generators/rails/app/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb index 8bf1192ffe..8bf1192ffe 100644 --- a/railties/lib/generators/rails/app/templates/test/test_helper.rb +++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb diff --git a/railties/lib/generators/rails/app/templates/test/unit/.empty_directory b/railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/app/templates/test/unit/.empty_directory +++ b/railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory diff --git a/railties/lib/generators/rails/controller/USAGE b/railties/lib/rails/generators/rails/controller/USAGE index 70618a3906..70618a3906 100644 --- a/railties/lib/generators/rails/controller/USAGE +++ b/railties/lib/rails/generators/rails/controller/USAGE diff --git a/railties/lib/generators/rails/controller/controller_generator.rb b/railties/lib/rails/generators/rails/controller/controller_generator.rb index 91470be833..9788c0d0bc 100644 --- a/railties/lib/generators/rails/controller/controller_generator.rb +++ b/railties/lib/rails/generators/rails/controller/controller_generator.rb @@ -8,6 +8,12 @@ module Rails template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb") end + def add_routes + actions.reverse.each do |action| + route %{get "#{file_name}/#{action}"} + end + end + hook_for :template_engine, :test_framework, :helper end end diff --git a/railties/lib/generators/rails/controller/templates/controller.rb b/railties/lib/rails/generators/rails/controller/templates/controller.rb index cda2659e69..cda2659e69 100644 --- a/railties/lib/generators/rails/controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/controller/templates/controller.rb diff --git a/railties/lib/generators/rails/generator/USAGE b/railties/lib/rails/generators/rails/generator/USAGE index d8c3f7f634..d8c3f7f634 100644 --- a/railties/lib/generators/rails/generator/USAGE +++ b/railties/lib/rails/generators/rails/generator/USAGE diff --git a/railties/lib/generators/rails/generator/generator_generator.rb b/railties/lib/rails/generators/rails/generator/generator_generator.rb index 5b5d1884bc..5b5d1884bc 100644 --- a/railties/lib/generators/rails/generator/generator_generator.rb +++ b/railties/lib/rails/generators/rails/generator/generator_generator.rb diff --git a/railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt b/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt index d8757460e4..d8757460e4 100644 --- a/railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt +++ b/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt diff --git a/railties/lib/generators/rails/generator/templates/USAGE.tt b/railties/lib/rails/generators/rails/generator/templates/USAGE.tt index 1bb8df840d..1bb8df840d 100644 --- a/railties/lib/generators/rails/generator/templates/USAGE.tt +++ b/railties/lib/rails/generators/rails/generator/templates/USAGE.tt diff --git a/railties/lib/generators/rails/generator/templates/templates/.empty_directory b/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory index e69de29bb2..e69de29bb2 100644 --- a/railties/lib/generators/rails/generator/templates/templates/.empty_directory +++ b/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory diff --git a/railties/lib/generators/rails/helper/USAGE b/railties/lib/rails/generators/rails/helper/USAGE index c0ddb0f606..c0ddb0f606 100644 --- a/railties/lib/generators/rails/helper/USAGE +++ b/railties/lib/rails/generators/rails/helper/USAGE diff --git a/railties/lib/generators/rails/helper/helper_generator.rb b/railties/lib/rails/generators/rails/helper/helper_generator.rb index ad66388591..ad66388591 100644 --- a/railties/lib/generators/rails/helper/helper_generator.rb +++ b/railties/lib/rails/generators/rails/helper/helper_generator.rb diff --git a/railties/lib/generators/rails/helper/templates/helper.rb b/railties/lib/rails/generators/rails/helper/templates/helper.rb index 3fe2ecdc74..3fe2ecdc74 100644 --- a/railties/lib/generators/rails/helper/templates/helper.rb +++ b/railties/lib/rails/generators/rails/helper/templates/helper.rb diff --git a/railties/lib/generators/rails/integration_test/USAGE b/railties/lib/rails/generators/rails/integration_test/USAGE index 57ee3543e6..57ee3543e6 100644 --- a/railties/lib/generators/rails/integration_test/USAGE +++ b/railties/lib/rails/generators/rails/integration_test/USAGE diff --git a/railties/lib/generators/rails/integration_test/integration_test_generator.rb b/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb index 363a327fcb..363a327fcb 100644 --- a/railties/lib/generators/rails/integration_test/integration_test_generator.rb +++ b/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb diff --git a/railties/lib/generators/rails/mailer/USAGE b/railties/lib/rails/generators/rails/mailer/USAGE index a08d459739..a08d459739 100644 --- a/railties/lib/generators/rails/mailer/USAGE +++ b/railties/lib/rails/generators/rails/mailer/USAGE diff --git a/railties/lib/generators/rails/mailer/mailer_generator.rb b/railties/lib/rails/generators/rails/mailer/mailer_generator.rb index 8993181d79..8993181d79 100644 --- a/railties/lib/generators/rails/mailer/mailer_generator.rb +++ b/railties/lib/rails/generators/rails/mailer/mailer_generator.rb diff --git a/railties/lib/generators/rails/mailer/templates/mailer.rb b/railties/lib/rails/generators/rails/mailer/templates/mailer.rb index 7343eb28b3..7343eb28b3 100644 --- a/railties/lib/generators/rails/mailer/templates/mailer.rb +++ b/railties/lib/rails/generators/rails/mailer/templates/mailer.rb diff --git a/railties/lib/generators/rails/metal/USAGE b/railties/lib/rails/generators/rails/metal/USAGE index c88325a444..c88325a444 100644 --- a/railties/lib/generators/rails/metal/USAGE +++ b/railties/lib/rails/generators/rails/metal/USAGE diff --git a/railties/lib/generators/rails/metal/metal_generator.rb b/railties/lib/rails/generators/rails/metal/metal_generator.rb index fe4f945cad..fe4f945cad 100644 --- a/railties/lib/generators/rails/metal/metal_generator.rb +++ b/railties/lib/rails/generators/rails/metal/metal_generator.rb diff --git a/railties/lib/generators/rails/metal/templates/metal.rb b/railties/lib/rails/generators/rails/metal/templates/metal.rb index 8cc3f1f258..8cc3f1f258 100644 --- a/railties/lib/generators/rails/metal/templates/metal.rb +++ b/railties/lib/rails/generators/rails/metal/templates/metal.rb diff --git a/railties/lib/generators/rails/migration/USAGE b/railties/lib/rails/generators/rails/migration/USAGE index d21c81b760..d21c81b760 100644 --- a/railties/lib/generators/rails/migration/USAGE +++ b/railties/lib/rails/generators/rails/migration/USAGE diff --git a/railties/lib/generators/rails/migration/migration_generator.rb b/railties/lib/rails/generators/rails/migration/migration_generator.rb index 39fa5b63b1..39fa5b63b1 100644 --- a/railties/lib/generators/rails/migration/migration_generator.rb +++ b/railties/lib/rails/generators/rails/migration/migration_generator.rb diff --git a/railties/lib/generators/rails/model/USAGE b/railties/lib/rails/generators/rails/model/USAGE index d97e9ac103..d97e9ac103 100644 --- a/railties/lib/generators/rails/model/USAGE +++ b/railties/lib/rails/generators/rails/model/USAGE diff --git a/railties/lib/generators/rails/model/model_generator.rb b/railties/lib/rails/generators/rails/model/model_generator.rb index 629d5eed3f..629d5eed3f 100644 --- a/railties/lib/generators/rails/model/model_generator.rb +++ b/railties/lib/rails/generators/rails/model/model_generator.rb diff --git a/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb b/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb index 99fd2f45bc..99fd2f45bc 100644 --- a/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb +++ b/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb diff --git a/railties/lib/generators/rails/observer/USAGE b/railties/lib/rails/generators/rails/observer/USAGE index d8f32a6a48..d8f32a6a48 100644 --- a/railties/lib/generators/rails/observer/USAGE +++ b/railties/lib/rails/generators/rails/observer/USAGE diff --git a/railties/lib/generators/rails/observer/observer_generator.rb b/railties/lib/rails/generators/rails/observer/observer_generator.rb index f5cedee91f..f5cedee91f 100644 --- a/railties/lib/generators/rails/observer/observer_generator.rb +++ b/railties/lib/rails/generators/rails/observer/observer_generator.rb diff --git a/railties/lib/generators/rails/performance_test/USAGE b/railties/lib/rails/generators/rails/performance_test/USAGE index 9dc799559c..9dc799559c 100644 --- a/railties/lib/generators/rails/performance_test/USAGE +++ b/railties/lib/rails/generators/rails/performance_test/USAGE diff --git a/railties/lib/generators/rails/performance_test/performance_test_generator.rb b/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb index d1c71ab8ed..d1c71ab8ed 100644 --- a/railties/lib/generators/rails/performance_test/performance_test_generator.rb +++ b/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb diff --git a/railties/lib/generators/rails/plugin/USAGE b/railties/lib/rails/generators/rails/plugin/USAGE index 00a429c585..00a429c585 100644 --- a/railties/lib/generators/rails/plugin/USAGE +++ b/railties/lib/rails/generators/rails/plugin/USAGE diff --git a/railties/lib/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 8f01dcd589..40ed2062d3 100644 --- a/railties/lib/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -1,4 +1,4 @@ -require 'generators/rails/generator/generator_generator' +require 'rails/generators/rails/generator/generator_generator' module Rails module Generators diff --git a/railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt b/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt index 8717df053d..8717df053d 100644 --- a/railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt diff --git a/railties/lib/generators/rails/plugin/templates/README.tt b/railties/lib/rails/generators/rails/plugin/templates/README.tt index 702db07cb1..702db07cb1 100644 --- a/railties/lib/generators/rails/plugin/templates/README.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/README.tt diff --git a/railties/lib/generators/rails/plugin/templates/Rakefile.tt b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt index e94c0bfc77..e94c0bfc77 100644 --- a/railties/lib/generators/rails/plugin/templates/Rakefile.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt diff --git a/railties/lib/generators/rails/plugin/templates/init.rb b/railties/lib/rails/generators/rails/plugin/templates/init.rb index 3c19a743c9..3c19a743c9 100644 --- a/railties/lib/generators/rails/plugin/templates/init.rb +++ b/railties/lib/rails/generators/rails/plugin/templates/init.rb diff --git a/railties/lib/generators/rails/plugin/templates/install.rb b/railties/lib/rails/generators/rails/plugin/templates/install.rb index f7732d3796..f7732d3796 100644 --- a/railties/lib/generators/rails/plugin/templates/install.rb +++ b/railties/lib/rails/generators/rails/plugin/templates/install.rb diff --git a/railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt index d8d908a959..d8d908a959 100644 --- a/railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt diff --git a/railties/lib/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt index 72920a9d3a..72920a9d3a 100644 --- a/railties/lib/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt diff --git a/railties/lib/generators/rails/plugin/templates/uninstall.rb b/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb index 9738333463..9738333463 100644 --- a/railties/lib/generators/rails/plugin/templates/uninstall.rb +++ b/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb diff --git a/railties/lib/generators/rails/resource/USAGE b/railties/lib/rails/generators/rails/resource/USAGE index e359cd574f..e359cd574f 100644 --- a/railties/lib/generators/rails/resource/USAGE +++ b/railties/lib/rails/generators/rails/resource/USAGE diff --git a/railties/lib/generators/rails/resource/resource_generator.rb b/railties/lib/rails/generators/rails/resource/resource_generator.rb index 5acb839f39..1e78945a7e 100644 --- a/railties/lib/generators/rails/resource/resource_generator.rb +++ b/railties/lib/rails/generators/rails/resource/resource_generator.rb @@ -1,5 +1,5 @@ require 'rails/generators/resource_helpers' -require 'generators/rails/model/model_generator' +require 'rails/generators/rails/model/model_generator' module Rails module Generators @@ -16,6 +16,7 @@ module Rails class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller" def add_resource_route + return if options[:actions].present? route "resource#{:s unless options[:singleton]} :#{pluralize?(file_name)}" end diff --git a/railties/lib/generators/rails/scaffold/USAGE b/railties/lib/rails/generators/rails/scaffold/USAGE index be1d113ed8..be1d113ed8 100644 --- a/railties/lib/generators/rails/scaffold/USAGE +++ b/railties/lib/rails/generators/rails/scaffold/USAGE diff --git a/railties/lib/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index fdea5bf52b..779f933785 100644 --- a/railties/lib/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'generators/rails/resource/resource_generator' +require 'rails/generators/rails/resource/resource_generator' module Rails module Generators diff --git a/railties/lib/generators/rails/scaffold_controller/USAGE b/railties/lib/rails/generators/rails/scaffold_controller/USAGE index 673f69bc81..673f69bc81 100644 --- a/railties/lib/generators/rails/scaffold_controller/USAGE +++ b/railties/lib/rails/generators/rails/scaffold_controller/USAGE diff --git a/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb index 49af2974cd..49af2974cd 100644 --- a/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb diff --git a/railties/lib/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb index 874e96a2b4..bbdce669dc 100644 --- a/railties/lib/generators/rails/scaffold_controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb @@ -46,7 +46,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| if @<%= orm_instance.save %> - format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully created.') } + format.html { redirect_to(@<%= file_name %>, :notice => '<%= human_name %> was successfully created.') } format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> } else format.html { render :action => "new" } @@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| if @<%= orm_instance.update_attributes("params[:#{file_name}]") %> - format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully updated.') } + format.html { redirect_to(@<%= file_name %>, :notice => '<%= human_name %> was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } diff --git a/railties/lib/generators/rails/session_migration/USAGE b/railties/lib/rails/generators/rails/session_migration/USAGE index 564d1ffd78..564d1ffd78 100644 --- a/railties/lib/generators/rails/session_migration/USAGE +++ b/railties/lib/rails/generators/rails/session_migration/USAGE diff --git a/railties/lib/generators/rails/session_migration/session_migration_generator.rb b/railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb index 258cc5b4a0..258cc5b4a0 100644 --- a/railties/lib/generators/rails/session_migration/session_migration_generator.rb +++ b/railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb diff --git a/railties/lib/generators/rails/stylesheets/USAGE b/railties/lib/rails/generators/rails/stylesheets/USAGE index 59e5495d0b..59e5495d0b 100644 --- a/railties/lib/generators/rails/stylesheets/USAGE +++ b/railties/lib/rails/generators/rails/stylesheets/USAGE diff --git a/railties/lib/generators/rails/stylesheets/stylesheets_generator.rb b/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb index ce68443c39..ce68443c39 100644 --- a/railties/lib/generators/rails/stylesheets/stylesheets_generator.rb +++ b/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb diff --git a/railties/lib/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css index ea3dc9b8b5..ea3dc9b8b5 100644 --- a/railties/lib/generators/rails/stylesheets/templates/scaffold.css +++ b/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css diff --git a/railties/lib/generators/test_unit.rb b/railties/lib/rails/generators/test_unit.rb index 62b9afaa2c..62b9afaa2c 100644 --- a/railties/lib/generators/test_unit.rb +++ b/railties/lib/rails/generators/test_unit.rb diff --git a/railties/lib/generators/test_unit/controller/controller_generator.rb b/railties/lib/rails/generators/test_unit/controller/controller_generator.rb index b57a6e794f..20f3bd8965 100644 --- a/railties/lib/generators/test_unit/controller/controller_generator.rb +++ b/railties/lib/rails/generators/test_unit/controller/controller_generator.rb @@ -1,8 +1,9 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators class ControllerGenerator < Base + argument :actions, :type => :array, :default => [], :banner => "action action" check_class_collision :suffix => "ControllerTest" def create_test_files diff --git a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb new file mode 100644 index 0000000000..0d4185846d --- /dev/null +++ b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb @@ -0,0 +1,18 @@ +require 'test_helper' + +class <%= class_name %>ControllerTest < ActionController::TestCase +<% if actions.empty? -%> + # Replace this with your real tests. + test "the truth" do + assert true + end +<% else -%> +<% for action in actions -%> + test "should get <%= action %>" do + get :<%= action %> + assert_response :success + end + +<% end -%> +<% end -%> +end diff --git a/railties/lib/generators/test_unit/helper/helper_generator.rb b/railties/lib/rails/generators/test_unit/helper/helper_generator.rb index 9ecfaa45ab..4ea80bf7be 100644 --- a/railties/lib/generators/test_unit/helper/helper_generator.rb +++ b/railties/lib/rails/generators/test_unit/helper/helper_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/helper/templates/helper_test.rb b/railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb index 591e40900e..591e40900e 100644 --- a/railties/lib/generators/test_unit/helper/templates/helper_test.rb +++ b/railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb diff --git a/railties/lib/generators/test_unit/integration/integration_generator.rb b/railties/lib/rails/generators/test_unit/integration/integration_generator.rb index d9d9b3bf1d..32d0fac029 100644 --- a/railties/lib/generators/test_unit/integration/integration_generator.rb +++ b/railties/lib/rails/generators/test_unit/integration/integration_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/integration/templates/integration_test.rb b/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb index 2c57158b1c..2c57158b1c 100644 --- a/railties/lib/generators/test_unit/integration/templates/integration_test.rb +++ b/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb diff --git a/railties/lib/generators/test_unit/mailer/mailer_generator.rb b/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb index a0d73db1b0..1a49286d41 100644 --- a/railties/lib/generators/test_unit/mailer/mailer_generator.rb +++ b/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators @@ -9,13 +9,6 @@ module TestUnit def create_test_files template "functional_test.rb", File.join('test/functional', class_path, "#{file_name}_test.rb") end - - def create_fixtures_files - actions.each do |action| - @action, @path = action, File.join(file_path, action) - template "fixture", File.join("test/fixtures", @path) - end - end end end end diff --git a/railties/lib/generators/test_unit/mailer/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb index a2b1f1ed05..80ac7f0feb 100644 --- a/railties/lib/generators/test_unit/mailer/templates/functional_test.rb +++ b/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb @@ -3,12 +3,11 @@ require 'test_helper' class <%= class_name %>Test < ActionMailer::TestCase <% for action in actions -%> test "<%= action %>" do - @expected.subject = <%= action.to_s.humanize.inspect %> - @expected.to = "to@example.org" - @expected.from = "from@example.com" - @expected.body = read_fixture("<%= action %>") - - assert_equal @expected, <%= class_name %>.<%= action %> + mail = <%= class_name %>.<%= action %> + assert_equal <%= action.to_s.humanize.inspect %>, mail.subject + assert_equal ["to@example.org"], mail.to + assert_equal ["from@example.com"], mail.from + assert_match "Hi", mail.body.encoded end <% end -%> diff --git a/railties/lib/generators/test_unit/model/model_generator.rb b/railties/lib/rails/generators/test_unit/model/model_generator.rb index 469306e6c5..609b815683 100644 --- a/railties/lib/generators/test_unit/model/model_generator.rb +++ b/railties/lib/rails/generators/test_unit/model/model_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml index a30132bc99..a30132bc99 100644 --- a/railties/lib/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml diff --git a/railties/lib/generators/test_unit/model/templates/unit_test.rb b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb index 3e0bc29d3a..3e0bc29d3a 100644 --- a/railties/lib/generators/test_unit/model/templates/unit_test.rb +++ b/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb diff --git a/railties/lib/generators/test_unit/observer/observer_generator.rb b/railties/lib/rails/generators/test_unit/observer/observer_generator.rb index 14181f4e49..6cc1158c21 100644 --- a/railties/lib/generators/test_unit/observer/observer_generator.rb +++ b/railties/lib/rails/generators/test_unit/observer/observer_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/observer/templates/unit_test.rb b/railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb index 03f6d5666e..03f6d5666e 100644 --- a/railties/lib/generators/test_unit/observer/templates/unit_test.rb +++ b/railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb diff --git a/railties/lib/generators/test_unit/performance/performance_generator.rb b/railties/lib/rails/generators/test_unit/performance/performance_generator.rb index 0d9c646b26..99edda5461 100644 --- a/railties/lib/generators/test_unit/performance/performance_generator.rb +++ b/railties/lib/rails/generators/test_unit/performance/performance_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/performance/templates/performance_test.rb b/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb index 362e3dc09f..362e3dc09f 100644 --- a/railties/lib/generators/test_unit/performance/templates/performance_test.rb +++ b/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb diff --git a/railties/lib/generators/test_unit/plugin/plugin_generator.rb b/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb index 05adf58c4f..4d65cd7d89 100644 --- a/railties/lib/generators/test_unit/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt b/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt index 3e0bc29d3a..3e0bc29d3a 100644 --- a/railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +++ b/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt diff --git a/railties/lib/generators/test_unit/plugin/templates/test_helper.rb b/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb index 2ca36a1e44..2ca36a1e44 100644 --- a/railties/lib/generators/test_unit/plugin/templates/test_helper.rb +++ b/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb diff --git a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb index a95916ae13..c0315c7fe6 100644 --- a/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'generators/test_unit' +require 'rails/generators/test_unit' require 'rails/generators/resource_helpers' module TestUnit diff --git a/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb index 9380aa49b6..4f8ddbffcf 100644 --- a/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb @@ -1,6 +1,10 @@ require 'test_helper' class <%= controller_class_name %>ControllerTest < ActionController::TestCase + setup do + @<%= file_name %> = <%= table_name %>(:one) + end + <% unless options[:singleton] -%> test "should get index" do get :index @@ -16,30 +20,30 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase test "should create <%= file_name %>" do assert_difference('<%= class_name %>.count') do - post :create, :<%= file_name %> => <%= table_name %>(:one).attributes + post :create, :<%= file_name %> => @<%= file_name %>.attributes end assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>)) end test "should show <%= file_name %>" do - get :show, :id => <%= table_name %>(:one).to_param + get :show, :id => @<%= file_name %>.to_param assert_response :success end test "should get edit" do - get :edit, :id => <%= table_name %>(:one).to_param + get :edit, :id => @<%= file_name %>.to_param assert_response :success end test "should update <%= file_name %>" do - put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => <%= table_name %>(:one).attributes + put :update, :id => @<%= file_name %>.to_param, :<%= file_name %> => @<%= file_name %>.attributes assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>)) end test "should destroy <%= file_name %>" do assert_difference('<%= class_name %>.count', -1) do - delete :destroy, :id => <%= table_name %>(:one).to_param + delete :destroy, :id => @<%= file_name %>.to_param end assert_redirected_to <%= table_name %>_path diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/lib/rails/info.rb index 5a496f6536..5a496f6536 100644 --- a/railties/builtin/rails_info/rails/info.rb +++ b/railties/lib/rails/info.rb diff --git a/railties/builtin/rails_info/rails/info_controller.rb b/railties/lib/rails/info_controller.rb index 196eeb4a6c..196eeb4a6c 100644 --- a/railties/builtin/rails_info/rails/info_controller.rb +++ b/railties/lib/rails/info_controller.rb diff --git a/railties/builtin/routes.rb b/railties/lib/rails/info_routes.rb index bd58034d8f..bd58034d8f 100644 --- a/railties/builtin/routes.rb +++ b/railties/lib/rails/info_routes.rb diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 96a07844e5..0d68abb323 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -179,7 +179,7 @@ module Rails include Initializable - ABSTRACT_RAILTIES = %w(Rails::Plugin Rails::Engine Rails::Application) + ABSTRACT_RAILTIES = %w(Rails::Railtie Rails::Plugin Rails::Engine Rails::Application) class << self def subclasses @@ -187,23 +187,18 @@ module Rails end def inherited(base) - unless abstract_railtie?(base) + unless base.abstract_railtie? base.send(:include, self::Configurable) subclasses << base end end - def railtie_name(railtie_name = nil) - @railtie_name = railtie_name if railtie_name - @railtie_name ||= default_name + def railtie_name(*) + ActiveSupport::Deprecation.warn "railtie_name is deprecated and has no effect", caller end - def railtie_names - subclasses.map { |p| p.railtie_name } - end - - def log_subscriber(log_subscriber) - Rails::LogSubscriber.add(railtie_name, log_subscriber) + def log_subscriber(name, log_subscriber) + Rails::LogSubscriber.add(name, log_subscriber) end def rake_tasks(&blk) @@ -218,14 +213,8 @@ module Rails @generators end - protected - - def abstract_railtie?(base) - ABSTRACT_RAILTIES.include?(base.name) - end - - def default_name - ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name)) + def abstract_railtie? + ABSTRACT_RAILTIES.include?(name) end end diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb index 828ccec3d0..16eccaccc4 100644 --- a/railties/lib/rails/railtie/configuration.rb +++ b/railties/lib/rails/railtie/configuration.rb @@ -3,11 +3,8 @@ require 'rails/configuration' module Rails class Railtie class Configuration - attr_accessor :cookie_secret - def initialize - @session_store = :cookie_store - @session_options = {} + @@options ||= {} end # Holds generators configuration: @@ -48,76 +45,18 @@ module Rails end def respond_to?(name) - super || name.to_s =~ config_key_regexp - end - - def metal_loader - @metal_loader ||= Rails::Application::MetalLoader.new - end - - def session_store(*args) - if args.empty? - case @session_store - when :disabled - nil - when :active_record_store - ActiveRecord::SessionStore - when Symbol - ActionDispatch::Session.const_get(@session_store.to_s.camelize) - else - @session_store - end - else - @session_store = args.shift - @session_options = args.shift || {} - end + super || @@options.key?(name.to_sym) end private def method_missing(name, *args, &blk) - if name.to_s =~ config_key_regexp - return $2 == '=' ? options[$1] = args.first : options[$1] - end - super - end - - def session_options - return @session_options unless @session_store == :cookie_store - @session_options.merge(:secret => @cookie_secret) - end - - def config_key_regexp - bits = config_keys.map { |n| Regexp.escape(n.to_s) }.join('|') - /^(#{bits})(?:=)?$/ - end - - def config_keys - (Railtie.railtie_names + Engine.engine_names).map { |n| n.to_s }.uniq - end - - def options - @@options ||= Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new } - end - - def default_middleware - require 'action_dispatch' - ActionDispatch::MiddlewareStack.new.tap do |middleware| - middleware.use('::ActionDispatch::Static', lambda { Rails.public_path }, :if => lambda { serve_static_assets }) - middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency }) - middleware.use('::Rack::Runtime') - middleware.use('::Rails::Rack::Logger') - middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }) - middleware.use("::ActionDispatch::RemoteIp", lambda { action_dispatch.ip_spoofing_check }, lambda { action_dispatch.trusted_proxies }) - middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header }) - middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes }) - middleware.use('::ActionDispatch::Cookies') - middleware.use(lambda { session_store }, lambda { session_options }) - middleware.use('::ActionDispatch::Flash', :if => lambda { session_store }) - middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? }) - middleware.use('ActionDispatch::ParamsParser') - middleware.use('::Rack::MethodOverride') - middleware.use('::ActionDispatch::Head') + if name.to_s =~ /=$/ + @@options[$`.to_sym] = args.first + elsif @@options.key?(name) + @@options[name] + else + super end end end diff --git a/railties/lib/rails/railties_path.rb b/railties/lib/rails/railties_path.rb deleted file mode 100644 index e291fc23ea..0000000000 --- a/railties/lib/rails/railties_path.rb +++ /dev/null @@ -1 +0,0 @@ -RAILTIES_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index abf9b33ae5..f2fee45594 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -66,13 +66,14 @@ namespace :doc do task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" } desc "Remove plugin documentation" - task :clobber_plugins do + task :clobber_plugins do rm_rf 'doc/plugins' rescue nil end desc "Generate Rails guides" task :guides do - require File.join(RAILTIES_PATH, "guides/rails_guides") + # FIXME: Reaching outside lib directory is a bad idea + require File.expand_path('../../../../guides/rails_guides', __FILE__) RailsGuides::Generator.new(Rails.root.join("doc/guides")).generate end @@ -92,7 +93,7 @@ namespace :doc do files.include("#{plugin_base}/lib/**/*.rb") if File.exist?("#{plugin_base}/README") - files.include("#{plugin_base}/README") + files.include("#{plugin_base}/README") options << "--main '#{plugin_base}/README'" end files.include("#{plugin_base}/CHANGELOG") if File.exist?("#{plugin_base}/CHANGELOG") diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index dbe2ac54ed..cd9516033e 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -2,18 +2,18 @@ namespace :rails do namespace :freeze do desc "The rails:freeze:gems is deprecated, please use bundle install instead" task :gems do - puts "The rails:freeze:gems is deprecated, please use bundle install instead" + abort "The rails:freeze:gems is deprecated, please use bundle install instead" end desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' task :edge do - puts 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' + abort 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' end end desc 'The unfreeze command has been deprecated, please use bundler commands instead' task :unfreeze do - puts 'The unfreeze command has been deprecated, please use bundler commands instead' + abort 'The unfreeze command has been deprecated, please use bundler commands instead' end desc "Update both configs, scripts and public/javascripts from Rails" @@ -25,7 +25,7 @@ namespace :rails do template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} require 'rails/generators' - require 'generators/rails/app/app_generator' + require 'rails/generators/rails/app/app_generator' generator = Rails::Generators::AppGenerator.new [ Rails.root ], {}, :destination_root => Rails.root generator.apply template, :verbose => false end @@ -38,7 +38,7 @@ namespace :rails do def app_generator @app_generator ||= begin require 'rails/generators' - require 'generators/rails/app/app_generator' + require 'rails/generators/rails/app/app_generator' gen = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true }, :destination_root => Rails.root gen.send(:valid_app_const?) diff --git a/railties/lib/rails/tasks/misc.rake b/railties/lib/rails/tasks/misc.rake index 48fce92215..0926707a04 100644 --- a/railties/lib/rails/tasks/misc.rake +++ b/railties/lib/rails/tasks/misc.rake @@ -15,8 +15,6 @@ end desc 'Explain the current environment' task :about do - $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" - require 'rails/info' puts Rails::Info end @@ -26,12 +24,12 @@ namespace :time do task :all do build_time_zone_list(:all) end - + desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6' task :us do build_time_zone_list(:us_zones) end - + desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time' task :local do require 'active_support' @@ -41,7 +39,7 @@ namespace :time do offset = jan_offset < jul_offset ? jan_offset : jul_offset build_time_zone_list(:all, offset) end - + # to find UTC -06:00 zones, OFFSET can be set to either -6, -6:00 or 21600 def build_time_zone_list(method, offset = ENV['OFFSET']) require 'active_support' diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 2ed5353755..6522c94ad6 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -4,14 +4,18 @@ abort("Abort testing: Your Rails environment is not running in test mode!") unle require 'test/unit' require 'active_support/core_ext/kernel/requires' +require 'active_support/test_case' +require 'action_controller/test_case' +require 'action_dispatch/testing/integration' -# TODO: Figure out how to get the Rails::BacktraceFilter into minitest/unit if defined?(Test::Unit::Util::BacktraceFilter) && ENV['BACKTRACE'].nil? require 'rails/backtrace_cleaner' Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit } end if defined?(ActiveRecord) + require 'active_record/test_case' + class ActiveSupport::TestCase include ActiveRecord::TestFixtures self.fixture_path = "#{Rails.root}/test/fixtures/" diff --git a/railties/lib/rails/test_unit/railtie.rb b/railties/lib/rails/test_unit/railtie.rb index d99325a6d8..e3fafc4b9d 100644 --- a/railties/lib/rails/test_unit/railtie.rb +++ b/railties/lib/rails/test_unit/railtie.rb @@ -1,7 +1,5 @@ module Rails class TestUnitRailtie < Rails::Railtie - railtie_name :test_unit - config.generators do |c| c.test_framework :test_unit, :fixture => true, :fixture_replacement => nil diff --git a/railties/railties.gemspec b/railties/railties.gemspec index b9d2739539..aea07efe96 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.homepage = 'http://www.rubyonrails.org' s.rubyforge_project = 'rails' - s.files = Dir['CHANGELOG', 'README', 'bin/**/*', 'builtin/**/*', 'guides/**/*', 'lib/**/{*,.[a-z]*}'] + s.files = Dir['CHANGELOG', 'README', 'bin/**/*', 'guides/**/*', 'lib/**/{*,.[a-z]*}'] s.require_path = 'lib' s.bindir = 'bin' s.executables = ['rails'] diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index aa66dbb9be..d04a2aa1f3 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -1,7 +1,6 @@ ORIG_ARGV = ARGV.dup require File.expand_path("../../../load_paths", __FILE__) -$:.unshift File.expand_path("../../builtin/rails_info", __FILE__) require 'stringio' require 'test/unit' diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 54cd751f4e..1b6c657d6d 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -228,5 +228,32 @@ module ApplicationTests get "/" assert_equal File.expand_path(__FILE__), last_response.headers["X-Lighttpd-Send-File"] end + + test "protect from forgery is the default in a new app" do + require "rails" + require "action_controller/railtie" + + class MyApp < Rails::Application + config.session_store :disabled + + routes.draw do + match "/" => "omg#index" + end + + class ::OmgController < ActionController::Base + protect_from_forgery + + def index + render :inline => "<%= csrf_meta_tag %>" + end + end + end + + require 'rack/test' + extend Rack::Test::Methods + + get "/" + assert last_response.body =~ /csrf\-param/ + end end end diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb index 511b8b629a..589e515d05 100644 --- a/railties/test/application/paths_test.rb +++ b/railties/test/application/paths_test.rb @@ -51,8 +51,6 @@ module ApplicationTests assert_path @paths.config.environment, "config", "environments", "development.rb" assert_equal root("app", "controllers"), @paths.app.controllers.to_a.first - assert_equal Pathname.new(File.dirname(__FILE__)).join("..", "..", "builtin", "rails_info").expand_path, - Pathname.new(@paths.app.controllers.to_a[1]).expand_path end test "booting up Rails yields a list of paths that are eager" do @@ -80,21 +78,5 @@ module ApplicationTests assert_not_in_load_path "tmp" assert_not_in_load_path "tmp", "cache" end - - test "controller paths include builtin in development mode" do - Rails.env.replace "development" - assert Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ } - end - - test "controller paths does not have builtin_directories in test mode" do - Rails.env.replace "test" - assert !Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ } - end - - test "controller paths does not have builtin_directories in production mode" do - Rails.env.replace "production" - assert !Rails::Application::Configuration.new("/").paths.app.controllers.paths.any? { |p| p =~ /builtin/ } - end - end end diff --git a/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb b/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb index 7a4edb8bcb..a7d079a1bc 100644 --- a/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb +++ b/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb @@ -1,4 +1,4 @@ -require 'generators/active_record' +require 'rails/generators/active_record' module ActiveRecord module Generators diff --git a/railties/test/fixtures/lib/rails_generators/foobar/foobar_generator.rb b/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb index d1de8c56fa..d1de8c56fa 100644 --- a/railties/test/fixtures/lib/rails_generators/foobar/foobar_generator.rb +++ b/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 3585e6e7c0..44e0640552 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -1,8 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/app/app_generator' - -# TODO This line shouldn't be required -require 'generators/rails/model/model_generator' +require 'rails/generators/rails/app/app_generator' class ActionsTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 4fc26563ff..95ca2acf2c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' require 'generators/generators_test_helper' -require 'generators/rails/app/app_generator' +require 'rails/generators/rails/app/app_generator' class AppGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 79a4e5bf17..be99dc068d 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -1,10 +1,12 @@ require 'generators/generators_test_helper' -require 'generators/rails/controller/controller_generator' +require 'rails/generators/rails/controller/controller_generator' class ControllerGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper arguments %w(Account foo bar) + setup :copy_routes + def test_help_does_not_show_invoked_generators_options_if_they_already_exist content = run_generator ["--help"] assert_no_match /Helper options\:/, content @@ -23,8 +25,6 @@ class ControllerGeneratorTest < Rails::Generators::TestCase Object.send :remove_const, :ObjectController end - # No need to spec content since it's already spec'ed on helper generator. - # def test_invokes_helper run_generator assert_file "app/helpers/account_helper.rb" @@ -49,8 +49,13 @@ class ControllerGeneratorTest < Rails::Generators::TestCase def test_invokes_default_template_engine run_generator - assert_file "app/views/account/foo.html.erb", /app\/views\/account\/foo/ - assert_file "app/views/account/bar.html.erb", /app\/views\/account\/bar/ + assert_file "app/views/account/foo.html.erb", %r(app/views/account/foo\.html\.erb) + assert_file "app/views/account/bar.html.erb", %r(app/views/account/bar\.html\.erb) + end + + def test_add_routes + run_generator + assert_file "config/routes.rb", /get "account\/foo"/, /get "account\/bar"/ end def test_invokes_default_template_engine_even_with_no_action diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index f3fd688e4f..26f975a191 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/generator/generator_generator' +require 'rails/generators/rails/generator/generator_generator' class GeneratorGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 32be99b144..d8bdb344f2 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -26,4 +26,11 @@ module GeneratorsTestHelper end end end + + def copy_routes + routes = File.expand_path("../../../lib/rails/generators/rails/app/templates/config/routes.rb", __FILE__) + destination = File.join(destination_root, "config") + FileUtils.mkdir_p(destination) + FileUtils.cp File.expand_path(routes), destination + 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 6d7168738e..f0bfebd57f 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/helper/helper_generator' +require 'rails/generators/rails/helper/helper_generator' ObjectHelper = Class.new AnotherObjectHelperTest = Class.new diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb index d7fc324c88..cf282a0911 100644 --- a/railties/test/generators/integration_test_generator_test.rb +++ b/railties/test/generators/integration_test_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/integration_test/integration_test_generator' +require 'rails/generators/rails/integration_test/integration_test_generator' class IntegrationTestGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index e6fc1bbb5c..81d6afa221 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/mailer/mailer_generator' +require 'rails/generators/rails/mailer/mailer_generator' class MailerGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper @@ -28,20 +28,22 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_invokes_default_test_framework run_generator - 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/ + assert_file "test/functional/notifier_test.rb" do |test| + assert_match /class NotifierTest < ActionMailer::TestCase/, test + assert_match /test "foo"/, test + assert_match /test "bar"/, test + end end def test_invokes_default_template_engine run_generator assert_file "app/views/notifier/foo.text.erb" do |view| - assert_match /app\/views\/notifier\/foo/, view + assert_match %r(app/views/notifier/foo\.text\.erb), view assert_match /<%= @greeting %>/, view end assert_file "app/views/notifier/bar.text.erb" do |view| - assert_match /app\/views\/notifier\/bar/, view + assert_match %r(app/views/notifier/bar\.text\.erb), view assert_match /<%= @greeting %>/, view end end diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index e3a2384885..615122c882 100644 --- a/railties/test/generators/metal_generator_test.rb +++ b/railties/test/generators/metal_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/metal/metal_generator' +require 'rails/generators/rails/metal/metal_generator' class MetalGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 811a712fd5..762f84d579 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/migration/migration_generator' +require 'rails/generators/rails/migration/migration_generator' class MigrationGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 79ce9a2a7b..f5cfd8eeca 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/model/model_generator' +require 'rails/generators/rails/model/model_generator' class ModelGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb index f327fb1282..e73dd237fb 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 'generators/rails/scaffold_controller/scaffold_controller_generator' +require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' # Mock out what we need from AR::Base. module ActiveRecord @@ -15,6 +15,20 @@ class NamedBaseTest < Rails::Generators::TestCase include GeneratorsTestHelper tests Rails::Generators::ScaffoldControllerGenerator + def test_named_generator_with_underscore + g = generator ['line_item'] + assert_name g, 'line_item', :name + assert_name g, %w(), :class_path + assert_name g, 'LineItem', :class_name + assert_name g, 'line_item', :file_path + assert_name g, 'line_item', :file_name + assert_name g, 'Line item', :human_name + assert_name g, 'line_item', :singular_name + assert_name g, 'line_items', :plural_name + assert_name g, 'line_item', :i18n_scope + assert_name g, 'line_items', :table_name + end + def test_named_generator_attributes g = generator ['admin/foo'] assert_name g, 'admin/foo', :name @@ -22,6 +36,7 @@ class NamedBaseTest < Rails::Generators::TestCase assert_name g, 'Admin::Foo', :class_name assert_name g, 'admin/foo', :file_path assert_name g, 'foo', :file_name + assert_name g, 'Foo', :human_name assert_name g, 'foo', :singular_name assert_name g, 'foos', :plural_name assert_name g, 'admin.foo', :i18n_scope @@ -36,6 +51,7 @@ class NamedBaseTest < Rails::Generators::TestCase assert_name g, 'admin/foo', :file_path assert_name g, 'foo', :file_name assert_name g, 'foo', :singular_name + assert_name g, 'Foo', :human_name assert_name g, 'foos', :plural_name assert_name g, 'admin.foo', :i18n_scope assert_name g, 'admin_foos', :table_name @@ -45,6 +61,8 @@ class NamedBaseTest < Rails::Generators::TestCase ActiveRecord::Base.pluralize_table_names = false g = generator ['admin/foo'] assert_name g, 'admin_foo', :table_name + ensure + ActiveRecord::Base.pluralize_table_names = true end def test_scaffold_plural_names diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 058a19228d..45fe8dfbd3 100644 --- a/railties/test/generators/observer_generator_test.rb +++ b/railties/test/generators/observer_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/observer/observer_generator' +require 'rails/generators/rails/observer/observer_generator' class ObserverGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index c95063a127..8fda83b36f 100644 --- a/railties/test/generators/performance_test_generator_test.rb +++ b/railties/test/generators/performance_test_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/performance_test/performance_test_generator' +require 'rails/generators/rails/performance_test/performance_test_generator' class PerformanceTestGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 065dbe1423..c1f646f7c1 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/plugin/plugin_generator' +require 'rails/generators/rails/plugin/plugin_generator' class PluginGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 959934bd71..96fd7a0a72 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -1,19 +1,11 @@ require 'generators/generators_test_helper' -require 'generators/rails/resource/resource_generator' +require 'rails/generators/rails/resource/resource_generator' class ResourceGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper arguments %w(account) - def setup - super - routes = Rails::Generators::ResourceGenerator.source_root - routes = File.join(routes, "..", "..", "app", "templates", "config", "routes.rb") - destination = File.join(destination_root, "config") - - FileUtils.mkdir_p(destination) - FileUtils.cp File.expand_path(routes), destination - end + setup :copy_routes def test_help_with_inherited_options content = run_generator ["--help"] diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index f971598d18..77ed63b1bb 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/scaffold_controller/scaffold_controller_generator' +require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' module Unknown module Generators diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index a7e9c8a231..6cf2efca45 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -1,19 +1,11 @@ require 'generators/generators_test_helper' -require 'generators/rails/scaffold/scaffold_generator' +require 'rails/generators/rails/scaffold/scaffold_generator' class ScaffoldGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper arguments %w(product_line title:string price:integer) - def setup - super - routes = Rails::Generators::ResourceGenerator.source_root - routes = File.join(routes, "..", "..", "app", "templates", "config", "routes.rb") - destination = File.join(destination_root, "config") - - FileUtils.mkdir_p(destination) - FileUtils.cp File.expand_path(routes), destination - end + setup :copy_routes def test_scaffold_on_invoke run_generator diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index de28b4c75b..9fee948d7c 100644 --- a/railties/test/generators/session_migration_generator_test.rb +++ b/railties/test/generators/session_migration_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/session_migration/session_migration_generator' +require 'rails/generators/rails/session_migration/session_migration_generator' class SessionMigrationGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index 718fcb1fa7..aaeb686daa 100644 --- a/railties/test/generators/stylesheets_generator_test.rb +++ b/railties/test/generators/stylesheets_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'generators/rails/stylesheets/stylesheets_generator' +require 'rails/generators/rails/stylesheets/stylesheets_generator' class StylesheetsGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 2975e3e3ef..16f8f43b99 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -1,6 +1,6 @@ require 'generators/generators_test_helper' -require 'generators/rails/model/model_generator' -require 'generators/test_unit/model/model_generator' +require 'rails/generators/rails/model/model_generator' +require 'rails/generators/test_unit/model/model_generator' require 'mocha' class GeneratorsTest < Rails::Generators::TestCase diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index d904d7b461..05ec359f61 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -1,9 +1,6 @@ require 'abstract_unit' require 'action_controller' -require 'rails/info' -require 'rails/info_controller' - module ActionController class Base include ActionController::Testing diff --git a/railties/test/railties/railtie_test.rb b/railties/test/railties/railtie_test.rb index 9fefb285b4..546bf5e143 100644 --- a/railties/test/railties/railtie_test.rb +++ b/railties/test/railties/railtie_test.rb @@ -32,28 +32,25 @@ module RailtiesTest end test "config name is available for the railtie" do - class Foo < Rails::Railtie ; config.foo.greetings = "hello" ; end + class Foo < Rails::Railtie + config.foo = ActiveSupport::OrderedOptions.new + config.foo.greetings = "hello" + end assert_equal "hello", Foo.config.foo.greetings end test "railtie configurations are available in the application" do - class Foo < Rails::Railtie ; config.foo.greetings = "hello" ; end + class Foo < Rails::Railtie + config.foo = ActiveSupport::OrderedOptions.new + config.foo.greetings = "hello" + end require "#{app_path}/config/application" assert_equal "hello", AppTemplate::Application.config.foo.greetings end - test "railtie config merges are deep" do - class Foo < Rails::Railtie ; config.foo.greetings = 'hello' ; end - class Bar < Rails::Railtie - config.foo.bar = "bar" - end - assert_equal "hello", Bar.config.foo.greetings - assert_equal "bar", Bar.config.foo.bar - end - test "railtie can add log subscribers" do begin - class Foo < Rails::Railtie ; log_subscriber(Rails::LogSubscriber.new) ; end + class Foo < Rails::Railtie ; log_subscriber(:foo, Rails::LogSubscriber.new) ; end assert_kind_of Rails::LogSubscriber, Rails::LogSubscriber.log_subscribers[0] ensure Rails::LogSubscriber.log_subscribers.clear |