Skip to content
This repository
Browse code

Skip assets options in environments files when --skip-sprockets is used

Conflicts:

	railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
	railties/test/generators/app_generator_test.rb
  • Loading branch information...
commit 47bef336ecc01b63fdc0264c0e442b46f1559ba9 1 parent 0479789
Guillermo Iguaran authored December 11, 2011
11  railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
@@ -22,9 +22,20 @@
22 22
   # Only use best-standards-support built into browsers
23 23
   config.action_dispatch.best_standards_support = :builtin
24 24
 
  25
+  <%- unless options.skip_active_record? -%>
  26
+  # Raise exception on mass assignment protection for ActiveRecord models
  27
+  config.active_record.mass_assignment_sanitizer = :strict
  28
+
  29
+  # Log the query plan for queries taking more than this (works
  30
+  # with SQLite, MySQL, and PostgreSQL)
  31
+  config.active_record.auto_explain_threshold_in_seconds = 0.5
  32
+  <%- end -%>
  33
+
  34
+  <%- unless options.skip_sprockets? -%>
25 35
   # Do not compress assets
26 36
   config.assets.compress = false
27 37
 
28 38
   # Expands the lines which load the assets
29 39
   config.assets.debug = true
  40
+  <%- end -%>
30 41
 end
4  railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
@@ -11,6 +11,7 @@
11 11
   # Disable Rails's static asset server (Apache or nginx will already do this)
12 12
   config.serve_static_assets = false
13 13
 
  14
+  <%- unless options.skip_sprockets? -%>
14 15
   # Compress JavaScripts and CSS
15 16
   config.assets.compress = true
16 17
 
@@ -22,6 +23,7 @@
22 23
 
23 24
   # Defaults to Rails.root.join("public/assets")
24 25
   # config.assets.manifest = YOUR_PATH
  26
+  <%- end -%>
25 27
 
26 28
   # Specifies the header that your server uses for sending files
27 29
   # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
@@ -42,8 +44,10 @@
42 44
   # Enable serving of images, stylesheets, and JavaScripts from an asset server
43 45
   # config.action_controller.asset_host = "http://assets.example.com"
44 46
 
  47
+  <%- unless options.skip_sprockets? -%>
45 48
   # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46 49
   # config.assets.precompile += %w( search.js )
  50
+  <%- end -%>
47 51
 
48 52
   # Disable delivery errors, bad email addresses will be ignored
49 53
   # config.action_mailer.raise_delivery_errors = false
12  railties/test/generators/app_generator_test.rb
@@ -180,6 +180,18 @@ def test_generator_if_skip_sprockets_is_given
180 180
       assert_match(/#\s+require\s+["']sprockets\/railtie["']/, content)
181 181
       assert_no_match(/config\.assets\.enabled = true/, content)
182 182
     end
  183
+    assert_file "Gemfile" do |content|
  184
+      assert_no_match(/sass-rails/, content)
  185
+      assert_no_match(/coffee-rails/, content)
  186
+      assert_no_match(/uglifier/, content)
  187
+    end
  188
+    assert_file "config/environments/development.rb" do |content|
  189
+      assert_no_match(/config\.assets\.debug = true/, content)
  190
+    end
  191
+    assert_file "config/environments/production.rb" do |content|
  192
+      assert_no_match(/config\.assets\.digest = true/, content)
  193
+      assert_no_match(/config\.assets\.compress = true/, content)
  194
+    end
183 195
     assert_file "test/performance/browsing_test.rb"
184 196
   end
185 197
 

0 notes on commit 47bef33

Please sign in to comment.
Something went wrong with that request. Please try again.