提交 5ff80e74 编写于 作者: J José Valim

bin/rails uses the new generator.

上级 b6f82637
......@@ -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
......@@ -27,7 +27,7 @@ def self.source_root
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
......
......@@ -2,7 +2,6 @@
require 'rbconfig'
require 'digest/md5'
require 'active_support/secure_random'
require 'rails/version'
module Rails::Generators
class App < Base
......@@ -48,7 +47,9 @@ def create_root
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册