review fixes

This commit is contained in:
Aditya Sanghi
2011-05-06 20:59:15 +05:30
parent 9b5c29038d
commit cdf1842caa
3 changed files with 11 additions and 6 deletions

View File

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

View File

@@ -1,14 +1,14 @@
require File.expand_path('../boot', __FILE__)
<% if !options[:skip_active_record] && !options[:skip_test_unit] -%>
<% if include_all_railties? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
<%= options[:skip_active_record] ? "#" : "" %> 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"
<%= options[:skip_test_unit] ? "#" : "" %> 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
@@ -59,8 +59,6 @@ module <%= app_const_base %>
<% unless options[:skip_active_record] -%>
# Enable IdentityMap for Active Record, to disable set to false or remove the line below.
config.active_record.identity_map = true
<% else -%>
config.generators.orm = false
<% end -%>
# Enable the asset pipeline

View File

@@ -163,7 +163,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
run_generator [destination_root, "--skip-active-record"]
assert_file "config/application.rb" do |file|
assert_match /#\s+require\s+["']active_record\/railtie["']/, file
assert_match /config.generators.orm = false/, file
end
end