diff options
-rwxr-xr-x | railties/bin/rails | 13 | ||||
-rw-r--r-- | railties/lib/generator/base.rb | 2 | ||||
-rw-r--r-- | railties/lib/generator/generators/app.rb (renamed from railties/lib/generator/generators/app.thor) | 5 |
3 files changed, 6 insertions, 14 deletions
diff --git a/railties/bin/rails b/railties/bin/rails index 5e4fb38dba..cd173e51b6 100755 --- a/railties/bin/rails +++ b/railties/bin/rails @@ -7,14 +7,5 @@ if %w(--version -v).include? ARGV.first exit(0) end -freeze = ARGV.any? { |option| %w(--freeze -f).include?(option) } - -app_path = ARGV.first - -require File.dirname(__FILE__) + '/../lib/rails_generator' - -require 'rails_generator/scripts/generate' -Rails::Generator::Base.use_application_sources! -Rails::Generator::Scripts::Generate.new.run(ARGV, :generator => 'app') - -Dir.chdir(app_path) { `rake rails:freeze:gems`; puts "froze" } if freeze +require File.dirname(__FILE__) + '/../lib/generator/generators/app' +Rails::Generators::App.start diff --git a/railties/lib/generator/base.rb b/railties/lib/generator/base.rb index ea1e5a0402..5f51f93520 100644 --- a/railties/lib/generator/base.rb +++ b/railties/lib/generator/base.rb @@ -27,7 +27,7 @@ module Rails klass_name.gsub!(/^Rails::Generators::/, '') klass_name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') klass_name.gsub!(/([a-z\d])([A-Z])/,'\1_\2') - File.join(File.dirname(__FILE__), 'templates', klass_name.downcase) + File.expand_path(File.join(File.dirname(__FILE__), 'templates', klass_name.downcase)) end end diff --git a/railties/lib/generator/generators/app.thor b/railties/lib/generator/generators/app.rb index 84f0504519..408a73a1e8 100644 --- a/railties/lib/generator/generators/app.thor +++ b/railties/lib/generator/generators/app.rb @@ -2,7 +2,6 @@ require File.dirname(__FILE__) + '/../base' require 'rbconfig' require 'digest/md5' require 'active_support/secure_random' -require 'rails/version' module Rails::Generators class App < Base @@ -48,7 +47,9 @@ module Rails::Generators self.root = File.expand_path(app_path, root) empty_directory '.' - app_name # Sets the app name + app_name # Sets the app name + source_root # Sets the source root + FileUtils.cd(root) end |