mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge pull request #414 from asanghi/lh5796
config.generators.orm = false when skipping active record. LightHouse #5796
This commit is contained in:
@@ -52,13 +52,13 @@ module Rails
|
||||
:integration_tool => nil,
|
||||
:javascripts => true,
|
||||
:javascript_engine => nil,
|
||||
:orm => nil,
|
||||
:orm => false,
|
||||
:performance_tool => nil,
|
||||
:resource_controller => :controller,
|
||||
:scaffold_controller => :scaffold_controller,
|
||||
:stylesheets => true,
|
||||
:stylesheet_engine => nil,
|
||||
:test_framework => nil,
|
||||
:test_framework => false,
|
||||
:template_engine => :erb
|
||||
},
|
||||
|
||||
|
||||
@@ -120,6 +120,14 @@ module Rails
|
||||
options[:skip_active_record] ? "" : "gem '#{gem_for_database}'\n"
|
||||
end
|
||||
|
||||
def include_all_railties?
|
||||
!options[:skip_active_record] && !options[:skip_test_unit]
|
||||
end
|
||||
|
||||
def comment_if(value)
|
||||
options[value] ? '#' : ''
|
||||
end
|
||||
|
||||
def rails_gemfile_entry
|
||||
if options.dev?
|
||||
<<-GEMFILE.strip_heredoc
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
require File.expand_path('../boot', __FILE__)
|
||||
|
||||
<% unless options[:skip_active_record] -%>
|
||||
<% if include_all_railties? -%>
|
||||
require 'rails/all'
|
||||
<% else -%>
|
||||
# Pick the frameworks you want:
|
||||
# require "active_record/railtie"
|
||||
<%= comment_if :skip_active_record %> require "active_record/railtie"
|
||||
require "action_controller/railtie"
|
||||
require "action_mailer/railtie"
|
||||
require "active_resource/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
<%= comment_if :skip_test_unit %> require "rails/test_unit/railtie"
|
||||
<% end -%>
|
||||
|
||||
# If you have a Gemfile, require the gems listed there, including any gems
|
||||
@@ -50,10 +50,6 @@ module <%= app_const_base %>
|
||||
# config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs)
|
||||
<% end -%>
|
||||
|
||||
<% if options[:skip_test_unit] -%>
|
||||
config.generators.test_framework = false
|
||||
<% end -%>
|
||||
|
||||
# Configure the default encoding used in templates for Ruby 1.9.
|
||||
config.encoding = "utf-8"
|
||||
|
||||
|
||||
@@ -227,9 +227,13 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||
|
||||
def test_test_unit_is_removed_from_frameworks_if_skip_test_unit_is_given
|
||||
run_generator [destination_root, "--skip-test-unit"]
|
||||
assert_file "config/application.rb" do |file|
|
||||
assert_match /config.generators.test_framework = false/, file
|
||||
end
|
||||
assert_file "config/application.rb", /#\s+require\s+["']rails\/test_unit\/railtie["']/
|
||||
end
|
||||
|
||||
def test_no_active_record_or_test_unit_if_skips_given
|
||||
run_generator [destination_root, "--skip-test-unit", "--skip-active-record"]
|
||||
assert_file "config/application.rb", /#\s+require\s+["']rails\/test_unit\/railtie["']/
|
||||
assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
|
||||
end
|
||||
|
||||
def test_new_hash_style
|
||||
|
||||
Reference in New Issue
Block a user