diff --git a/railties/lib/rails/generators/active_record.rb b/activerecord/lib/generators/active_record.rb similarity index 72% rename from railties/lib/rails/generators/active_record.rb rename to activerecord/lib/generators/active_record.rb index c62f75c384e..25b982f296b 100644 --- a/railties/lib/rails/generators/active_record.rb +++ b/activerecord/lib/generators/active_record.rb @@ -8,6 +8,14 @@ module ActiveRecord class Base < Rails::Generators::NamedBase #:nodoc: include Rails::Generators::Migration + def self.source_root + @_ar_source_root ||= begin + if base_name && generator_name + File.expand_path(File.join(base_name, generator_name, 'templates'), File.dirname(__FILE__)) + end + end + end + protected # Implement the required interface for Rails::Generators::Migration. # diff --git a/railties/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/generators/active_record/migration/migration_generator.rb similarity index 93% rename from railties/lib/rails/generators/active_record/migration/migration_generator.rb rename to activerecord/lib/generators/active_record/migration/migration_generator.rb index f6159deeebb..7939977f723 100644 --- a/railties/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/generators/active_record/migration/migration_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/active_record' +require 'generators/active_record' module ActiveRecord module Generators diff --git a/railties/lib/rails/generators/active_record/migration/templates/migration.rb b/activerecord/lib/generators/active_record/migration/templates/migration.rb similarity index 100% rename from railties/lib/rails/generators/active_record/migration/templates/migration.rb rename to activerecord/lib/generators/active_record/migration/templates/migration.rb diff --git a/railties/lib/rails/generators/active_record/model/model_generator.rb b/activerecord/lib/generators/active_record/model/model_generator.rb similarity index 95% rename from railties/lib/rails/generators/active_record/model/model_generator.rb rename to activerecord/lib/generators/active_record/model/model_generator.rb index 3e72fbeca8d..2641083e0dc 100644 --- a/railties/lib/rails/generators/active_record/model/model_generator.rb +++ b/activerecord/lib/generators/active_record/model/model_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/active_record' +require 'generators/active_record' module ActiveRecord module Generators diff --git a/railties/lib/rails/generators/active_record/model/templates/migration.rb b/activerecord/lib/generators/active_record/model/templates/migration.rb similarity index 100% rename from railties/lib/rails/generators/active_record/model/templates/migration.rb rename to activerecord/lib/generators/active_record/model/templates/migration.rb diff --git a/railties/lib/rails/generators/active_record/model/templates/model.rb b/activerecord/lib/generators/active_record/model/templates/model.rb similarity index 100% rename from railties/lib/rails/generators/active_record/model/templates/model.rb rename to activerecord/lib/generators/active_record/model/templates/model.rb diff --git a/railties/lib/rails/generators/active_record/observer/observer_generator.rb b/activerecord/lib/generators/active_record/observer/observer_generator.rb similarity index 88% rename from railties/lib/rails/generators/active_record/observer/observer_generator.rb rename to activerecord/lib/generators/active_record/observer/observer_generator.rb index c1c0e3f25b0..a6b57423b8a 100644 --- a/railties/lib/rails/generators/active_record/observer/observer_generator.rb +++ b/activerecord/lib/generators/active_record/observer/observer_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/active_record' +require 'generators/active_record' module ActiveRecord module Generators diff --git a/railties/lib/rails/generators/active_record/observer/templates/observer.rb b/activerecord/lib/generators/active_record/observer/templates/observer.rb similarity index 100% rename from railties/lib/rails/generators/active_record/observer/templates/observer.rb rename to activerecord/lib/generators/active_record/observer/templates/observer.rb diff --git a/railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb b/activerecord/lib/generators/active_record/session_migration/session_migration_generator.rb similarity index 94% rename from railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb rename to activerecord/lib/generators/active_record/session_migration/session_migration_generator.rb index afcda2a98a4..59c47920667 100644 --- a/railties/lib/rails/generators/active_record/session_migration/session_migration_generator.rb +++ b/activerecord/lib/generators/active_record/session_migration/session_migration_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/active_record' +require 'generators/active_record' module ActiveRecord module Generators diff --git a/railties/lib/rails/generators/active_record/session_migration/templates/migration.rb b/activerecord/lib/generators/active_record/session_migration/templates/migration.rb similarity index 100% rename from railties/lib/rails/generators/active_record/session_migration/templates/migration.rb rename to activerecord/lib/generators/active_record/session_migration/templates/migration.rb diff --git a/railties/lib/rails/generators/erb.rb b/railties/lib/generators/erb.rb similarity index 100% rename from railties/lib/rails/generators/erb.rb rename to railties/lib/generators/erb.rb diff --git a/railties/lib/rails/generators/erb/controller/controller_generator.rb b/railties/lib/generators/erb/controller/controller_generator.rb similarity index 94% rename from railties/lib/rails/generators/erb/controller/controller_generator.rb rename to railties/lib/generators/erb/controller/controller_generator.rb index f8780d9c330..ab7b2736624 100644 --- a/railties/lib/rails/generators/erb/controller/controller_generator.rb +++ b/railties/lib/generators/erb/controller/controller_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/erb' +require 'generators/erb' module Erb module Generators diff --git a/railties/lib/rails/generators/erb/controller/templates/view.html.erb b/railties/lib/generators/erb/controller/templates/view.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/controller/templates/view.html.erb rename to railties/lib/generators/erb/controller/templates/view.html.erb diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/generators/erb/mailer/mailer_generator.rb similarity index 93% rename from railties/lib/rails/generators/erb/mailer/mailer_generator.rb rename to railties/lib/generators/erb/mailer/mailer_generator.rb index 5266259e2fc..4ec2f4c9f45 100644 --- a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +++ b/railties/lib/generators/erb/mailer/mailer_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/erb' +require 'generators/erb' module Erb module Generators diff --git a/railties/lib/rails/generators/erb/mailer/templates/view.erb b/railties/lib/generators/erb/mailer/templates/view.erb similarity index 100% rename from railties/lib/rails/generators/erb/mailer/templates/view.erb rename to railties/lib/generators/erb/mailer/templates/view.erb diff --git a/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/generators/erb/scaffold/scaffold_generator.rb similarity index 97% rename from railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb rename to railties/lib/generators/erb/scaffold/scaffold_generator.rb index de5b0e9c5d9..846540476f2 100644 --- a/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb +++ b/railties/lib/generators/erb/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/erb' +require 'generators/erb' require 'rails/generators/resource_helpers' module Erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/generators/erb/scaffold/templates/_form.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb rename to railties/lib/generators/erb/scaffold/templates/_form.html.erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/generators/erb/scaffold/templates/edit.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb rename to railties/lib/generators/erb/scaffold/templates/edit.html.erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb b/railties/lib/generators/erb/scaffold/templates/index.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/index.html.erb rename to railties/lib/generators/erb/scaffold/templates/index.html.erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/generators/erb/scaffold/templates/layout.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/layout.html.erb rename to railties/lib/generators/erb/scaffold/templates/layout.html.erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb b/railties/lib/generators/erb/scaffold/templates/new.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/new.html.erb rename to railties/lib/generators/erb/scaffold/templates/new.html.erb diff --git a/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb b/railties/lib/generators/erb/scaffold/templates/show.html.erb similarity index 100% rename from railties/lib/rails/generators/erb/scaffold/templates/show.html.erb rename to railties/lib/generators/erb/scaffold/templates/show.html.erb diff --git a/railties/lib/rails/generators/rails/app/USAGE b/railties/lib/generators/rails/app/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/app/USAGE rename to railties/lib/generators/rails/app/USAGE diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb similarity index 97% rename from railties/lib/rails/generators/rails/app/app_generator.rb rename to railties/lib/generators/rails/app/app_generator.rb index 4b73576b07d..2e34992b3be 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -5,7 +5,7 @@ require 'rails/version' unless defined?(Rails::VERSION) module Rails::Generators # We need to store the RAILS_DEV_PATH in a constant, otherwise the path # can change in Ruby 1.8.7 when we FileUtils.cd. - RAILS_DEV_PATH = File.expand_path("../../../../../..", File.dirname(__FILE__)) + RAILS_DEV_PATH = File.expand_path("../../../../..", File.dirname(__FILE__)) class AppGenerator < Base DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) @@ -35,7 +35,7 @@ module Rails::Generators :desc => "Skip Prototype files" class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false, - :desc => "Skip Git ignores and keeps" + :desc => "Skip Git ignores and keeps" # Add bin/rails options class_option :version, :type => :boolean, :aliases => "-v", :group => :rails, diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/generators/rails/app/templates/Gemfile similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/Gemfile rename to railties/lib/generators/rails/app/templates/Gemfile diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/generators/rails/app/templates/README similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/README rename to railties/lib/generators/rails/app/templates/README diff --git a/railties/lib/rails/generators/rails/app/templates/Rakefile b/railties/lib/generators/rails/app/templates/Rakefile similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/Rakefile rename to railties/lib/generators/rails/app/templates/Rakefile diff --git a/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb b/railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb rename to railties/lib/generators/rails/app/templates/app/controllers/application_controller.rb diff --git a/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb b/railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb rename to railties/lib/generators/rails/app/templates/app/helpers/application_helper.rb diff --git a/railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory b/railties/lib/generators/rails/app/templates/app/models/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/app/models/.empty_directory rename to railties/lib/generators/rails/app/templates/app/models/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory b/railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/app/views/layouts/.empty_directory rename to railties/lib/generators/rails/app/templates/app/views/layouts/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/generators/rails/app/templates/config.ru similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config.ru rename to railties/lib/generators/rails/app/templates/config.ru diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/generators/rails/app/templates/config/application.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/application.rb rename to railties/lib/generators/rails/app/templates/config/application.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/generators/rails/app/templates/config/boot.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/boot.rb rename to railties/lib/generators/rails/app/templates/config/boot.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml b/railties/lib/generators/rails/app/templates/config/databases/frontbase.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml rename to railties/lib/generators/rails/app/templates/config/databases/frontbase.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml b/railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml rename to railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/generators/rails/app/templates/config/databases/mysql.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml rename to railties/lib/generators/rails/app/templates/config/databases/mysql.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml b/railties/lib/generators/rails/app/templates/config/databases/oracle.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml rename to railties/lib/generators/rails/app/templates/config/databases/oracle.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/generators/rails/app/templates/config/databases/postgresql.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml rename to railties/lib/generators/rails/app/templates/config/databases/postgresql.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml rename to railties/lib/generators/rails/app/templates/config/databases/sqlite3.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/environment.rb b/railties/lib/generators/rails/app/templates/config/environment.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/environment.rb rename to railties/lib/generators/rails/app/templates/config/environment.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/development.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt rename to railties/lib/generators/rails/app/templates/config/environments/development.rb.tt diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/production.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt rename to railties/lib/generators/rails/app/templates/config/environments/production.rb.tt diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/generators/rails/app/templates/config/environments/test.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt rename to railties/lib/generators/rails/app/templates/config/environments/test.rb.tt diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb b/railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb rename to railties/lib/generators/rails/app/templates/config/initializers/backtrace_silencers.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt b/railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt rename to railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb b/railties/lib/generators/rails/app/templates/config/initializers/inflections.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb rename to railties/lib/generators/rails/app/templates/config/initializers/inflections.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb b/railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb rename to railties/lib/generators/rails/app/templates/config/initializers/mime_types.rb diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt b/railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt rename to railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt diff --git a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml b/railties/lib/generators/rails/app/templates/config/locales/en.yml similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/locales/en.yml rename to railties/lib/generators/rails/app/templates/config/locales/en.yml diff --git a/railties/lib/rails/generators/rails/app/templates/config/routes.rb b/railties/lib/generators/rails/app/templates/config/routes.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/config/routes.rb rename to railties/lib/generators/rails/app/templates/config/routes.rb diff --git a/railties/lib/rails/generators/rails/app/templates/db/seeds.rb b/railties/lib/generators/rails/app/templates/db/seeds.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/db/seeds.rb rename to railties/lib/generators/rails/app/templates/db/seeds.rb diff --git a/railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP b/railties/lib/generators/rails/app/templates/doc/README_FOR_APP similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/doc/README_FOR_APP rename to railties/lib/generators/rails/app/templates/doc/README_FOR_APP diff --git a/railties/lib/rails/generators/rails/app/templates/gitignore b/railties/lib/generators/rails/app/templates/gitignore similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/gitignore rename to railties/lib/generators/rails/app/templates/gitignore diff --git a/railties/lib/rails/generators/rails/app/templates/public/404.html b/railties/lib/generators/rails/app/templates/public/404.html similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/404.html rename to railties/lib/generators/rails/app/templates/public/404.html diff --git a/railties/lib/rails/generators/rails/app/templates/public/422.html b/railties/lib/generators/rails/app/templates/public/422.html similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/422.html rename to railties/lib/generators/rails/app/templates/public/422.html diff --git a/railties/lib/rails/generators/rails/app/templates/public/500.html b/railties/lib/generators/rails/app/templates/public/500.html similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/500.html rename to railties/lib/generators/rails/app/templates/public/500.html diff --git a/railties/lib/rails/generators/rails/app/templates/public/favicon.ico b/railties/lib/generators/rails/app/templates/public/favicon.ico similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/favicon.ico rename to railties/lib/generators/rails/app/templates/public/favicon.ico diff --git a/railties/lib/rails/generators/rails/app/templates/public/images/rails.png b/railties/lib/generators/rails/app/templates/public/images/rails.png similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/images/rails.png rename to railties/lib/generators/rails/app/templates/public/images/rails.png diff --git a/railties/lib/rails/generators/rails/app/templates/public/index.html b/railties/lib/generators/rails/app/templates/public/index.html similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/index.html rename to railties/lib/generators/rails/app/templates/public/index.html diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js b/railties/lib/generators/rails/app/templates/public/javascripts/application.js similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/javascripts/application.js rename to railties/lib/generators/rails/app/templates/public/javascripts/application.js diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js b/railties/lib/generators/rails/app/templates/public/javascripts/controls.js similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/javascripts/controls.js rename to railties/lib/generators/rails/app/templates/public/javascripts/controls.js diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js b/railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js rename to railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js b/railties/lib/generators/rails/app/templates/public/javascripts/effects.js similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/javascripts/effects.js rename to railties/lib/generators/rails/app/templates/public/javascripts/effects.js diff --git a/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js b/railties/lib/generators/rails/app/templates/public/javascripts/prototype.js similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js rename to railties/lib/generators/rails/app/templates/public/javascripts/prototype.js diff --git a/railties/lib/rails/generators/rails/app/templates/public/robots.txt b/railties/lib/generators/rails/app/templates/public/robots.txt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/robots.txt rename to railties/lib/generators/rails/app/templates/public/robots.txt diff --git a/railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory b/railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory rename to railties/lib/generators/rails/app/templates/public/stylesheets/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/script/about b/railties/lib/generators/rails/app/templates/script/about similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/about rename to railties/lib/generators/rails/app/templates/script/about diff --git a/railties/lib/rails/generators/rails/app/templates/script/console.tt b/railties/lib/generators/rails/app/templates/script/console.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/console.tt rename to railties/lib/generators/rails/app/templates/script/console.tt diff --git a/railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt b/railties/lib/generators/rails/app/templates/script/dbconsole.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/dbconsole.tt rename to railties/lib/generators/rails/app/templates/script/dbconsole.tt diff --git a/railties/lib/rails/generators/rails/app/templates/script/destroy b/railties/lib/generators/rails/app/templates/script/destroy similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/destroy rename to railties/lib/generators/rails/app/templates/script/destroy diff --git a/railties/lib/rails/generators/rails/app/templates/script/generate b/railties/lib/generators/rails/app/templates/script/generate similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/generate rename to railties/lib/generators/rails/app/templates/script/generate diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker b/railties/lib/generators/rails/app/templates/script/performance/benchmarker similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/performance/benchmarker rename to railties/lib/generators/rails/app/templates/script/performance/benchmarker diff --git a/railties/lib/rails/generators/rails/app/templates/script/performance/profiler b/railties/lib/generators/rails/app/templates/script/performance/profiler similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/performance/profiler rename to railties/lib/generators/rails/app/templates/script/performance/profiler diff --git a/railties/lib/rails/generators/rails/app/templates/script/plugin b/railties/lib/generators/rails/app/templates/script/plugin similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/plugin rename to railties/lib/generators/rails/app/templates/script/plugin diff --git a/railties/lib/rails/generators/rails/app/templates/script/runner b/railties/lib/generators/rails/app/templates/script/runner similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/runner rename to railties/lib/generators/rails/app/templates/script/runner diff --git a/railties/lib/rails/generators/rails/app/templates/script/server.tt b/railties/lib/generators/rails/app/templates/script/server.tt similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/script/server.tt rename to railties/lib/generators/rails/app/templates/script/server.tt diff --git a/railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory b/railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory rename to railties/lib/generators/rails/app/templates/test/fixtures/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory b/railties/lib/generators/rails/app/templates/test/functional/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/functional/.empty_directory rename to railties/lib/generators/rails/app/templates/test/functional/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory b/railties/lib/generators/rails/app/templates/test/integration/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/integration/.empty_directory rename to railties/lib/generators/rails/app/templates/test/integration/.empty_directory diff --git a/railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb b/railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb rename to railties/lib/generators/rails/app/templates/test/performance/browsing_test.rb diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb b/railties/lib/generators/rails/app/templates/test/test_helper.rb similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/test_helper.rb rename to railties/lib/generators/rails/app/templates/test/test_helper.rb diff --git a/railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory b/railties/lib/generators/rails/app/templates/test/unit/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/app/templates/test/unit/.empty_directory rename to railties/lib/generators/rails/app/templates/test/unit/.empty_directory diff --git a/railties/lib/rails/generators/rails/controller/USAGE b/railties/lib/generators/rails/controller/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/controller/USAGE rename to railties/lib/generators/rails/controller/USAGE diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/generators/rails/controller/controller_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/controller/controller_generator.rb rename to railties/lib/generators/rails/controller/controller_generator.rb diff --git a/railties/lib/rails/generators/rails/controller/templates/controller.rb b/railties/lib/generators/rails/controller/templates/controller.rb similarity index 100% rename from railties/lib/rails/generators/rails/controller/templates/controller.rb rename to railties/lib/generators/rails/controller/templates/controller.rb diff --git a/railties/lib/rails/generators/rails/generator/USAGE b/railties/lib/generators/rails/generator/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/generator/USAGE rename to railties/lib/generators/rails/generator/USAGE diff --git a/railties/lib/rails/generators/rails/generator/generator_generator.rb b/railties/lib/generators/rails/generator/generator_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/generator/generator_generator.rb rename to railties/lib/generators/rails/generator/generator_generator.rb diff --git a/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt b/railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt rename to railties/lib/generators/rails/generator/templates/%file_name%_generator.rb.tt diff --git a/railties/lib/rails/generators/rails/generator/templates/USAGE.tt b/railties/lib/generators/rails/generator/templates/USAGE.tt similarity index 100% rename from railties/lib/rails/generators/rails/generator/templates/USAGE.tt rename to railties/lib/generators/rails/generator/templates/USAGE.tt diff --git a/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory b/railties/lib/generators/rails/generator/templates/templates/.empty_directory similarity index 100% rename from railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory rename to railties/lib/generators/rails/generator/templates/templates/.empty_directory diff --git a/railties/lib/rails/generators/rails/helper/USAGE b/railties/lib/generators/rails/helper/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/helper/USAGE rename to railties/lib/generators/rails/helper/USAGE diff --git a/railties/lib/rails/generators/rails/helper/helper_generator.rb b/railties/lib/generators/rails/helper/helper_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/helper/helper_generator.rb rename to railties/lib/generators/rails/helper/helper_generator.rb diff --git a/railties/lib/rails/generators/rails/helper/templates/helper.rb b/railties/lib/generators/rails/helper/templates/helper.rb similarity index 100% rename from railties/lib/rails/generators/rails/helper/templates/helper.rb rename to railties/lib/generators/rails/helper/templates/helper.rb diff --git a/railties/lib/rails/generators/rails/integration_test/USAGE b/railties/lib/generators/rails/integration_test/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/integration_test/USAGE rename to railties/lib/generators/rails/integration_test/USAGE diff --git a/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb b/railties/lib/generators/rails/integration_test/integration_test_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb rename to railties/lib/generators/rails/integration_test/integration_test_generator.rb diff --git a/railties/lib/rails/generators/rails/mailer/USAGE b/railties/lib/generators/rails/mailer/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/mailer/USAGE rename to railties/lib/generators/rails/mailer/USAGE diff --git a/railties/lib/rails/generators/rails/mailer/mailer_generator.rb b/railties/lib/generators/rails/mailer/mailer_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/mailer/mailer_generator.rb rename to railties/lib/generators/rails/mailer/mailer_generator.rb diff --git a/railties/lib/rails/generators/rails/mailer/templates/mailer.rb b/railties/lib/generators/rails/mailer/templates/mailer.rb similarity index 100% rename from railties/lib/rails/generators/rails/mailer/templates/mailer.rb rename to railties/lib/generators/rails/mailer/templates/mailer.rb diff --git a/railties/lib/rails/generators/rails/metal/USAGE b/railties/lib/generators/rails/metal/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/metal/USAGE rename to railties/lib/generators/rails/metal/USAGE diff --git a/railties/lib/rails/generators/rails/metal/metal_generator.rb b/railties/lib/generators/rails/metal/metal_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/metal/metal_generator.rb rename to railties/lib/generators/rails/metal/metal_generator.rb diff --git a/railties/lib/rails/generators/rails/metal/templates/metal.rb b/railties/lib/generators/rails/metal/templates/metal.rb similarity index 100% rename from railties/lib/rails/generators/rails/metal/templates/metal.rb rename to railties/lib/generators/rails/metal/templates/metal.rb diff --git a/railties/lib/rails/generators/rails/migration/USAGE b/railties/lib/generators/rails/migration/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/migration/USAGE rename to railties/lib/generators/rails/migration/USAGE diff --git a/railties/lib/rails/generators/rails/migration/migration_generator.rb b/railties/lib/generators/rails/migration/migration_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/migration/migration_generator.rb rename to railties/lib/generators/rails/migration/migration_generator.rb diff --git a/railties/lib/rails/generators/rails/model/USAGE b/railties/lib/generators/rails/model/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/model/USAGE rename to railties/lib/generators/rails/model/USAGE diff --git a/railties/lib/rails/generators/rails/model/model_generator.rb b/railties/lib/generators/rails/model/model_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/model/model_generator.rb rename to railties/lib/generators/rails/model/model_generator.rb diff --git a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb b/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb similarity index 83% rename from railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb rename to railties/lib/generators/rails/model_subclass/model_subclass_generator.rb index 46497097804..99fd2f45bca 100644 --- a/railties/lib/rails/generators/rails/model_subclass/model_subclass_generator.rb +++ b/railties/lib/generators/rails/model_subclass/model_subclass_generator.rb @@ -1,5 +1,6 @@ module Rails module Generators + # TODO Deprecate me in a release > Rails 3.0 class ModelSubclassGenerator < Base desc "model_subclass is deprecated. Invoke model with --parent option instead." diff --git a/railties/lib/rails/generators/rails/observer/USAGE b/railties/lib/generators/rails/observer/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/observer/USAGE rename to railties/lib/generators/rails/observer/USAGE diff --git a/railties/lib/rails/generators/rails/observer/observer_generator.rb b/railties/lib/generators/rails/observer/observer_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/observer/observer_generator.rb rename to railties/lib/generators/rails/observer/observer_generator.rb diff --git a/railties/lib/rails/generators/rails/performance_test/USAGE b/railties/lib/generators/rails/performance_test/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/performance_test/USAGE rename to railties/lib/generators/rails/performance_test/USAGE diff --git a/railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb b/railties/lib/generators/rails/performance_test/performance_test_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/performance_test/performance_test_generator.rb rename to railties/lib/generators/rails/performance_test/performance_test_generator.rb diff --git a/railties/lib/rails/generators/rails/plugin/USAGE b/railties/lib/generators/rails/plugin/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/plugin/USAGE rename to railties/lib/generators/rails/plugin/USAGE diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/generators/rails/plugin/plugin_generator.rb similarity index 94% rename from railties/lib/rails/generators/rails/plugin/plugin_generator.rb rename to railties/lib/generators/rails/plugin/plugin_generator.rb index bc614bc5d32..ee785caf7d5 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/generators/rails/plugin/plugin_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/rails/generator/generator_generator' +require 'generators/rails/generator/generator_generator' module Rails module Generators diff --git a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt b/railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt rename to railties/lib/generators/rails/plugin/templates/MIT-LICENSE.tt diff --git a/railties/lib/rails/generators/rails/plugin/templates/README.tt b/railties/lib/generators/rails/plugin/templates/README.tt similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/README.tt rename to railties/lib/generators/rails/plugin/templates/README.tt diff --git a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt b/railties/lib/generators/rails/plugin/templates/Rakefile.tt similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt rename to railties/lib/generators/rails/plugin/templates/Rakefile.tt diff --git a/railties/lib/rails/generators/rails/plugin/templates/init.rb b/railties/lib/generators/rails/plugin/templates/init.rb similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/init.rb rename to railties/lib/generators/rails/plugin/templates/init.rb diff --git a/railties/lib/rails/generators/rails/plugin/templates/install.rb b/railties/lib/generators/rails/plugin/templates/install.rb similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/install.rb rename to railties/lib/generators/rails/plugin/templates/install.rb diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt b/railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt rename to railties/lib/generators/rails/plugin/templates/lib/%file_name%.rb.tt diff --git a/railties/lib/rails/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt b/railties/lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt rename to railties/lib/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt diff --git a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb b/railties/lib/generators/rails/plugin/templates/uninstall.rb similarity index 100% rename from railties/lib/rails/generators/rails/plugin/templates/uninstall.rb rename to railties/lib/generators/rails/plugin/templates/uninstall.rb diff --git a/railties/lib/rails/generators/rails/resource/USAGE b/railties/lib/generators/rails/resource/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/resource/USAGE rename to railties/lib/generators/rails/resource/USAGE diff --git a/railties/lib/rails/generators/rails/resource/resource_generator.rb b/railties/lib/generators/rails/resource/resource_generator.rb similarity index 94% rename from railties/lib/rails/generators/rails/resource/resource_generator.rb rename to railties/lib/generators/rails/resource/resource_generator.rb index a89ce7faed0..43c7cc85f4d 100644 --- a/railties/lib/rails/generators/rails/resource/resource_generator.rb +++ b/railties/lib/generators/rails/resource/resource_generator.rb @@ -1,5 +1,5 @@ -require 'rails/generators/rails/model/model_generator' require 'rails/generators/resource_helpers' +require 'generators/rails/model/model_generator' module Rails module Generators diff --git a/railties/lib/rails/generators/rails/scaffold/USAGE b/railties/lib/generators/rails/scaffold/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/scaffold/USAGE rename to railties/lib/generators/rails/scaffold/USAGE diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/generators/rails/scaffold/scaffold_generator.rb similarity index 81% rename from railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb rename to railties/lib/generators/rails/scaffold/scaffold_generator.rb index 779f9337853..fdea5bf52ba 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/generators/rails/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/rails/resource/resource_generator' +require 'generators/rails/resource/resource_generator' module Rails module Generators diff --git a/railties/lib/rails/generators/rails/scaffold_controller/USAGE b/railties/lib/generators/rails/scaffold_controller/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/scaffold_controller/USAGE rename to railties/lib/generators/rails/scaffold_controller/USAGE diff --git a/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb b/railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb rename to railties/lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/generators/rails/scaffold_controller/templates/controller.rb similarity index 100% rename from railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb rename to railties/lib/generators/rails/scaffold_controller/templates/controller.rb diff --git a/railties/lib/rails/generators/rails/session_migration/USAGE b/railties/lib/generators/rails/session_migration/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/session_migration/USAGE rename to railties/lib/generators/rails/session_migration/USAGE diff --git a/railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb b/railties/lib/generators/rails/session_migration/session_migration_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/session_migration/session_migration_generator.rb rename to railties/lib/generators/rails/session_migration/session_migration_generator.rb diff --git a/railties/lib/rails/generators/rails/stylesheets/USAGE b/railties/lib/generators/rails/stylesheets/USAGE similarity index 100% rename from railties/lib/rails/generators/rails/stylesheets/USAGE rename to railties/lib/generators/rails/stylesheets/USAGE diff --git a/railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb b/railties/lib/generators/rails/stylesheets/stylesheets_generator.rb similarity index 100% rename from railties/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb rename to railties/lib/generators/rails/stylesheets/stylesheets_generator.rb diff --git a/railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css b/railties/lib/generators/rails/stylesheets/templates/scaffold.css similarity index 100% rename from railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css rename to railties/lib/generators/rails/stylesheets/templates/scaffold.css diff --git a/railties/lib/rails/generators/test_unit.rb b/railties/lib/generators/test_unit.rb similarity index 100% rename from railties/lib/rails/generators/test_unit.rb rename to railties/lib/generators/test_unit.rb diff --git a/railties/lib/rails/generators/test_unit/controller/controller_generator.rb b/railties/lib/generators/test_unit/controller/controller_generator.rb similarity index 89% rename from railties/lib/rails/generators/test_unit/controller/controller_generator.rb rename to railties/lib/generators/test_unit/controller/controller_generator.rb index 39816d99905..b57a6e794fa 100644 --- a/railties/lib/rails/generators/test_unit/controller/controller_generator.rb +++ b/railties/lib/generators/test_unit/controller/controller_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/generators/test_unit/controller/templates/functional_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb rename to railties/lib/generators/test_unit/controller/templates/functional_test.rb diff --git a/railties/lib/rails/generators/test_unit/helper/helper_generator.rb b/railties/lib/generators/test_unit/helper/helper_generator.rb similarity index 88% rename from railties/lib/rails/generators/test_unit/helper/helper_generator.rb rename to railties/lib/generators/test_unit/helper/helper_generator.rb index 4ea80bf7be2..9ecfaa45ab5 100644 --- a/railties/lib/rails/generators/test_unit/helper/helper_generator.rb +++ b/railties/lib/generators/test_unit/helper/helper_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb b/railties/lib/generators/test_unit/helper/templates/helper_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/helper/templates/helper_test.rb rename to railties/lib/generators/test_unit/helper/templates/helper_test.rb diff --git a/railties/lib/rails/generators/test_unit/integration/integration_generator.rb b/railties/lib/generators/test_unit/integration/integration_generator.rb similarity index 88% rename from railties/lib/rails/generators/test_unit/integration/integration_generator.rb rename to railties/lib/generators/test_unit/integration/integration_generator.rb index 32d0fac0294..d9d9b3bf1df 100644 --- a/railties/lib/rails/generators/test_unit/integration/integration_generator.rb +++ b/railties/lib/generators/test_unit/integration/integration_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb b/railties/lib/generators/test_unit/integration/templates/integration_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb rename to railties/lib/generators/test_unit/integration/templates/integration_test.rb diff --git a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb b/railties/lib/generators/test_unit/mailer/mailer_generator.rb similarity index 93% rename from railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb rename to railties/lib/generators/test_unit/mailer/mailer_generator.rb index 7353e5d61ab..ef350a62245 100644 --- a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +++ b/railties/lib/generators/test_unit/mailer/mailer_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/mailer/templates/fixture b/railties/lib/generators/test_unit/mailer/templates/fixture similarity index 100% rename from railties/lib/rails/generators/test_unit/mailer/templates/fixture rename to railties/lib/generators/test_unit/mailer/templates/fixture diff --git a/railties/lib/rails/generators/test_unit/mailer/templates/unit_test.rb b/railties/lib/generators/test_unit/mailer/templates/unit_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/mailer/templates/unit_test.rb rename to railties/lib/generators/test_unit/mailer/templates/unit_test.rb diff --git a/railties/lib/rails/generators/test_unit/model/model_generator.rb b/railties/lib/generators/test_unit/model/model_generator.rb similarity index 94% rename from railties/lib/rails/generators/test_unit/model/model_generator.rb rename to railties/lib/generators/test_unit/model/model_generator.rb index 609b8156831..469306e6c53 100644 --- a/railties/lib/rails/generators/test_unit/model/model_generator.rb +++ b/railties/lib/generators/test_unit/model/model_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/generators/test_unit/model/templates/fixtures.yml similarity index 100% rename from railties/lib/rails/generators/test_unit/model/templates/fixtures.yml rename to railties/lib/generators/test_unit/model/templates/fixtures.yml diff --git a/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb b/railties/lib/generators/test_unit/model/templates/unit_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/model/templates/unit_test.rb rename to railties/lib/generators/test_unit/model/templates/unit_test.rb diff --git a/railties/lib/rails/generators/test_unit/observer/observer_generator.rb b/railties/lib/generators/test_unit/observer/observer_generator.rb similarity index 88% rename from railties/lib/rails/generators/test_unit/observer/observer_generator.rb rename to railties/lib/generators/test_unit/observer/observer_generator.rb index 6cc1158c21a..14181f4e494 100644 --- a/railties/lib/rails/generators/test_unit/observer/observer_generator.rb +++ b/railties/lib/generators/test_unit/observer/observer_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb b/railties/lib/generators/test_unit/observer/templates/unit_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/observer/templates/unit_test.rb rename to railties/lib/generators/test_unit/observer/templates/unit_test.rb diff --git a/railties/lib/rails/generators/test_unit/performance/performance_generator.rb b/railties/lib/generators/test_unit/performance/performance_generator.rb similarity index 88% rename from railties/lib/rails/generators/test_unit/performance/performance_generator.rb rename to railties/lib/generators/test_unit/performance/performance_generator.rb index 99edda54611..0d9c646b268 100644 --- a/railties/lib/rails/generators/test_unit/performance/performance_generator.rb +++ b/railties/lib/generators/test_unit/performance/performance_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb b/railties/lib/generators/test_unit/performance/templates/performance_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/performance/templates/performance_test.rb rename to railties/lib/generators/test_unit/performance/templates/performance_test.rb diff --git a/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb b/railties/lib/generators/test_unit/plugin/plugin_generator.rb similarity index 84% rename from railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb rename to railties/lib/generators/test_unit/plugin/plugin_generator.rb index 4d65cd7d893..05adf58c4f0 100644 --- a/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb +++ b/railties/lib/generators/test_unit/plugin/plugin_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' module TestUnit module Generators diff --git a/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt b/railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt similarity index 100% rename from railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt rename to railties/lib/generators/test_unit/plugin/templates/%file_name%_test.rb.tt diff --git a/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb b/railties/lib/generators/test_unit/plugin/templates/test_helper.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb rename to railties/lib/generators/test_unit/plugin/templates/test_helper.rb diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb similarity index 93% rename from railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb rename to railties/lib/generators/test_unit/scaffold/scaffold_generator.rb index c0315c7fe6f..a95916ae139 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/generators/test_unit/scaffold/scaffold_generator.rb @@ -1,4 +1,4 @@ -require 'rails/generators/test_unit' +require 'generators/test_unit' require 'rails/generators/resource_helpers' module TestUnit diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/generators/test_unit/scaffold/templates/functional_test.rb similarity index 100% rename from railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb rename to railties/lib/generators/test_unit/scaffold/templates/functional_test.rb diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index e8c7a0993b5..45ae1fd30ab 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -87,18 +87,6 @@ module Rails @options ||= DEFAULT_OPTIONS.dup end - def self.gems_generators_paths #:nodoc: - return [] unless defined?(Gem) && Gem.respond_to?(:loaded_specs) - Gem.loaded_specs.inject([]) do |paths, (name, spec)| - paths += Dir[File.join(spec.full_gem_path, "lib/{generators,rails_generators}")] - end - end - - def self.plugins_generators_paths #:nodoc: - return [] unless defined?(Rails.root) && Rails.root - Dir[File.join(Rails.root, "vendor", "plugins", "*", "lib", "{generators,rails_generators}")] - end - # Hold configured generators fallbacks. If a plugin developer wants a # generator group to fallback to another group in case of missing generators, # they can add a fallback. @@ -126,31 +114,6 @@ module Rails @subclasses ||= [] end - # Generators load paths used on lookup. The lookup happens as: - # - # 1) lib generators - # 2) vendor/plugin generators - # 3) vendor/gems generators - # 4) ~/rails/generators - # 5) rubygems generators - # 6) builtin generators - # - # TODO Remove hardcoded paths for all, except (6). - # - def self.load_paths - @load_paths ||= begin - paths = [] - paths += Dir[File.join(Rails.root, "lib", "{generators,rails_generators}")] if defined?(Rails.root) && Rails.root - paths += Dir[File.join(Thor::Util.user_home, ".rails", "{generators,rails_generators}")] - paths += self.plugins_generators_paths - paths += self.gems_generators_paths - paths << File.expand_path(File.join(File.dirname(__FILE__), "generators")) - paths.uniq! - paths - end - end - load_paths # Cache load paths. Needed to avoid __FILE__ pointing to wrong paths. - # Rails finds namespaces similar to thor, it only adds one rule: # # Generators names must end with "_generator.rb". This is required because Rails @@ -170,6 +133,12 @@ module Rails def self.find_by_namespace(name, base=nil, context=nil) #:nodoc: base = "rails" unless base || context || name.to_s.include?(?:) + lookups = [] + lookups << "#{base}:#{name}" if base + lookups << "#{name}:#{context}" if context + lookups << "#{name}" + lookups << "rails:#{name}" unless base || context || name.to_s.include?(?:) + # Mount regexps to lookup regexps = [] regexps << /^#{base}:[\w:]*#{name}$/ if base @@ -183,7 +152,7 @@ module Rails return klass if klass # Try to require other generators by looking in load_paths - lookup(name, context) + lookup(lookups) unchecked = subclasses - checked klass = find_by_regexps(regexps, unchecked) return klass if klass @@ -255,22 +224,27 @@ module Rails # Receives namespaces in an array and tries to find matching generators # in the load path. - def self.lookup(*attempts) #:nodoc: + def self.lookup(attempts) #:nodoc: attempts.compact! attempts.uniq! - attempts = "{#{attempts.join(',')}}_generator.rb" - self.load_paths.each do |path| - Dir[File.join(path, '**', attempts)].each do |file| - begin - require file - rescue NameError => e - raise unless e.message =~ /Rails::Generator/ - warn "[WARNING] Could not load generator at #{file.inspect} because it's a Rails 2.x generator, which is not supported anymore" - rescue Exception => e - warn "[WARNING] Could not load generator at #{file.inspect}. Error: #{e.message}" - end - end + attempts.each do |attempt| + last = attempt.split(':').last + + # TODO Support rails_generators + require_generator "generators/#{attempt.gsub(':', '/')}/#{last}_generator" + require_generator "generators/#{attempt.gsub(':', '/')}_generator" + end + end + + def self.require_generator(path) + begin + require path + rescue LoadError => e + raise unless e.message =~ /#{Regexp.escape(path)}$/ + rescue NameError => e + raise unless e.message =~ /Rails::Generator/ + warn "[WARNING] Could not load generator at #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}" end end diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 37effb77db1..f4b2bd1ae90 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -17,7 +17,7 @@ module Rails def self.source_root @_rails_source_root ||= begin if base_name && generator_name - File.expand_path(File.join(File.dirname(__FILE__), base_name, generator_name, 'templates')) + File.expand_path(File.join("../../generators", base_name, generator_name, 'templates'), File.dirname(__FILE__)) end end end diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index b59ec524e85..c5651b37fa0 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -1,8 +1,8 @@ require 'generators/generators_test_helper' -require 'rails/generators/rails/app/app_generator' +require 'generators/rails/app/app_generator' # TODO This line shouldn't be required -require 'rails/generators/rails/model/model_generator' +require 'generators/rails/model/model_generator' class ActionsTest < GeneratorsTestCase tests Rails::Generators::AppGenerator diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 83de50bbb45..f961a95203a 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 'rails/generators/rails/app/app_generator' +require 'generators/rails/app/app_generator' class AppGeneratorTest < GeneratorsTestCase arguments [destination_root] diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb index 8e2fd3b9edb..501858c0485 100644 --- a/railties/test/generators/controller_generator_test.rb +++ b/railties/test/generators/controller_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'rails/generators/rails/controller/controller_generator' +require 'generators/rails/controller/controller_generator' class ControllerGeneratorTest < GeneratorsTestCase arguments %w(Account foo bar) diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index 28377f23b06..1a4c80fafb4 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 'rails/generators/rails/generator/generator_generator' +require 'generators/rails/generator/generator_generator' class GeneratorGeneratorTest < GeneratorsTestCase arguments %w(awesome) diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 54953b76c8b..1fbd60d39dc 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -10,7 +10,6 @@ Rails.application.config.root = Rails.root require 'rails/generators' require 'rails/generators/test_case' -require 'rubygems' require 'active_record' require 'action_dispatch' diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index cf187829868..268814f8858 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 'rails/generators/rails/helper/helper_generator' +require '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 88e18be5b2a..668fe13ffa1 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 'rails/generators/rails/integration_test/integration_test_generator' +require 'generators/rails/integration_test/integration_test_generator' class IntegrationTestGeneratorTest < GeneratorsTestCase arguments %w(integration) diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index ee4346eb715..50f5c7ec86c 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 'rails/generators/rails/mailer/mailer_generator' +require 'generators/rails/mailer/mailer_generator' class MailerGeneratorTest < GeneratorsTestCase arguments %w(notifier foo bar) diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb index 5d6a277561e..9f61a50c9ad 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 'rails/generators/rails/metal/metal_generator' +require 'generators/rails/metal/metal_generator' class MetalGeneratorTest < GeneratorsTestCase arguments %w(foo) diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 2fd3e5c0561..6d61250655c 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 'rails/generators/rails/migration/migration_generator' +require 'generators/rails/migration/migration_generator' class MigrationGeneratorTest < GeneratorsTestCase def test_migration diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 051a43706b5..fb1c41e6af9 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 'rails/generators/rails/model/model_generator' +require 'generators/rails/model/model_generator' class ModelGeneratorTest < GeneratorsTestCase arguments %w(Account name:string age:integer) diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb index 8c1df3b9925..01bb85a3527 100644 --- a/railties/test/generators/named_base_test.rb +++ b/railties/test/generators/named_base_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' +require 'generators/rails/scaffold_controller/scaffold_controller_generator' # Mock out what we need from AR::Base. module ActiveRecord diff --git a/railties/test/generators/observer_generator_test.rb b/railties/test/generators/observer_generator_test.rb index 44d9e4a9f3c..859c3e682ae 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 'rails/generators/rails/observer/observer_generator' +require 'generators/rails/observer/observer_generator' class ObserverGeneratorTest < GeneratorsTestCase arguments %w(account) diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb index 099575ea1d1..b5ca1ae5f61 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 'rails/generators/rails/performance_test/performance_test_generator' +require 'generators/rails/performance_test/performance_test_generator' class PerformanceTestGeneratorTest < GeneratorsTestCase arguments %w(performance) diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 2989cdb67de..94c3b56ebc4 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 'rails/generators/rails/plugin/plugin_generator' +require 'generators/rails/plugin/plugin_generator' class PluginGeneratorTest < GeneratorsTestCase arguments %w(plugin_fu) diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 15c0ca0f015..4c969e9d827 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'rails/generators/rails/resource/resource_generator' +require 'generators/rails/resource/resource_generator' class ResourceGeneratorTest < GeneratorsTestCase arguments %w(account) diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 7593c14dd9d..1188b32e76c 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 'rails/generators/rails/scaffold_controller/scaffold_controller_generator' +require '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 4ddc7b1c894..d3ff3e7c088 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -1,5 +1,5 @@ require 'generators/generators_test_helper' -require 'rails/generators/rails/scaffold/scaffold_generator' +require 'generators/rails/scaffold/scaffold_generator' class ScaffoldGeneratorTest < GeneratorsTestCase arguments %w(product_line title:string price:integer) diff --git a/railties/test/generators/session_migration_generator_test.rb b/railties/test/generators/session_migration_generator_test.rb index 251ffb19ed9..3ccda075e86 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 'rails/generators/rails/session_migration/session_migration_generator' +require 'generators/rails/session_migration/session_migration_generator' class SessionMigrationGeneratorTest < GeneratorsTestCase def test_session_migration_with_default_name diff --git a/railties/test/generators/stylesheets_generator_test.rb b/railties/test/generators/stylesheets_generator_test.rb index d9079327ba2..bc2eacbe684 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 'rails/generators/rails/stylesheets/stylesheets_generator' +require 'generators/rails/stylesheets/stylesheets_generator' class StylesheetsGeneratorTest < GeneratorsTestCase def test_copy_stylesheets