Skip to content

Commit

Permalink
Merge pull request #1926 from tobsch/master
Browse files Browse the repository at this point in the history
Accept application.js/.css to exist in a deeper directory depth by default
  • Loading branch information
spastorino committed Jul 6, 2011
2 parents 2c72830 + 139971d commit 6191368
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion railties/lib/rails/application/configuration.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize(*)
@assets = ActiveSupport::OrderedOptions.new @assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false @assets.enabled = false
@assets.paths = [] @assets.paths = []
@assets.precompile = [ /\w+\.(?!js|css).+/, "application.js", "application.css" ] @assets.precompile = [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
@assets.prefix = "/assets" @assets.prefix = "/assets"


@assets.js_compressor = nil @assets.js_compressor = nil
Expand Down
11 changes: 7 additions & 4 deletions railties/test/application/assets_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ def app


test "assets are compiled properly" do test "assets are compiled properly" do
app_file "app/assets/javascripts/application.js", "alert();" app_file "app/assets/javascripts/application.js", "alert();"
app_file "app/assets/javascripts/foo/application.js", "alert();"


capture(:stdout) do capture(:stdout) do
Dir.chdir(app_path){ `bundle exec rake assets:precompile` } Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
end end

files = Dir["#{app_path}/public/assets/application-*.js"]
file = Dir["#{app_path}/public/assets/application-*.js"][0] files << Dir["#{app_path}/public/assets/foo/application-*.js"].first
assert_not_nil file, "Expected application.js asset to be generated, but none found" files.each do |file|
assert_equal "alert();\n", File.read(file) assert_not_nil file, "Expected application.js asset to be generated, but none found"
assert_equal "alert();\n", File.read(file)
end
end end


test "assets are cleaned up properly" do test "assets are cleaned up properly" do
Expand Down

0 comments on commit 6191368

Please sign in to comment.