mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove generator environment until we have a gem manifest.
This commit is contained in:
parent
21019304f0
commit
f68e7a3987
7 changed files with 24 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
|||
RAILS_ENV.replace "generators"
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
|
||||
require "#{RAILS_ROOT}/config/environment"
|
||||
|
||||
if ARGV.size == 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
RAILS_ENV.replace "generators"
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'generators'))
|
||||
require "#{RAILS_ROOT}/config/environment"
|
||||
|
||||
if ARGV.size == 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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 @@ Rails::Initializer.run do |config|
|
|||
# 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
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# 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 @@ Run `rake gems:install` to install the missing gems.
|
|||
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 @@ end
|
|||
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 @@ class InitializerGeneratorsTests < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue