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

Remove generator environment until we have a gem manifest.

上级 21019304
RAILS_ENV.replace "generators"
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"
if ARGV.size == 0
......
RAILS_ENV.replace "generators"
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"
if ARGV.size == 0
......
RAILS_ENV.replace "generators"
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
require "#{RAILS_ROOT}/config/environment"
if ARGV.size == 0
......
......@@ -42,4 +42,23 @@
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
# Configure generators default options.
config.generators do |g|
# Scaffold configuration
g.helper = true
g.layout = true
g.stylesheets = true
# ORM configuration
g.orm = :active_record
g.timestamps = true
# Template engine configuration
g.template_engine = :erb
# Test framework configuration
g.test_framework = :test_unit
g.fixtures = true
end
end
# Settings specified here will take precedence over those in config/environment.rb
# No need to reload in generators environment, so do cache classes.
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Configure generators options (below are default values, delete them if you want).
config.generators do |g|
g.helper = true
g.layout = true
g.orm = :active_record
g.stylesheets = true
g.template_engine = :erb
g.test_framework = :test_unit
g.timestamps = true
end
......@@ -569,10 +569,9 @@ def self.run(initializer = nil, config = nil)
end
end
# Load generators if RAILS_ENV == "generators"
# Configure generators if they were already loaded
Initializer.default.add :initialize_generators do
if RAILS_ENV == "generators"
require "generators"
if defined?(Rails::Generators)
Rails::Generators.no_color! unless config.generators.colorize_logging
Rails::Generators.aliases.merge! config.generators.aliases
Rails::Generators.options.merge! config.generators.options
......
......@@ -293,7 +293,6 @@ def load_plugins!
class InitializerGeneratorsTests < Test::Unit::TestCase
def setup
@old_env_value = RAILS_ENV.dup
@configuration = Rails::Configuration.new
@initializer = Rails::Initializer.default
@initializer.config = @configuration
......@@ -349,16 +348,9 @@ def test_generators_raise_no_method_error_non_setters
end
end
def test_generators_are_not_invoked_with_other_environments
@configuration.generators.test_framework = :rspec
@initializer.run(:initialize_generators)
assert_equal :test_unit, Rails::Generators.options[:test_framework]
end
protected
def teardown
RAILS_ENV.replace @old_env_value
Rails::Generators.clear_aliases!
Rails::Generators.clear_options!
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册