bin/rails uses the new generator.

This commit is contained in:
José Valim
2009-06-17 13:00:59 +02:00
parent b6f826376a
commit 5ff80e7433
3 changed files with 6 additions and 14 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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