Closed niallsmart closed 11 years ago
Hi, just to give you an update on this, I did had a look at it, but I am not 100% sure yet this properly fix the issue. I'll investigate a bit more soon enough and that should be in next release (0.3.1).
@j15e OK. Anything I can help with? (BTW the push request does include a test case)
I saw the unit test, that is fine, but I would like to make sure it does fix the issue and I currently can't run the tests before your changes to options.rb
.
I get an encoding error when running your test case on a previous options.rb
version.
$ git checkout fix-match-sorting
$ rake
# Running tests:
Finished tests in 5.303939s, 19.2310 tests/s, 27.9038 assertions/s.
102 tests, 148 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Which is fine, but then I would like to make sure the unit test was "failing properly" before changes :
$ git checkout fix-match-sorting
$ git checkout master -- lib/sinatra/assetpack/options.rb
$ rake
# Running tests:
[ 29/102] AppTest#test_returns_file_of_requested_type_when_mixed_type_assets_of_varying_extension_are_present
1) Error:
test_returns_file_of_requested_type_when_mixed_type_assets_of_varying_extension_are_present(AppTest):
ArgumentError: invalid byte sequence in UTF-8
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/jsmin-1.0.1/lib/jsmin.rb:94:in `minify'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/engines/jsmin.rb:5:in `js'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/compressor.rb:23:in `compress'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/package.rb:94:in `minify'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/class_methods.rb:32:in `block (3 levels) in add_compressed_routes!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/tilt-1.4.1/lib/tilt.rb:127:in `fetch'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/class_methods.rb:31:in `block (2 levels) in add_compressed_routes!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `block in compile!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `[]'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (3 levels) in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:966:in `route_eval'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (2 levels) in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:987:in `block in process_route'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `process_route'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:948:in `block in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `each'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1059:in `block in dispatch!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1056:in `dispatch!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `block in call!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `call!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:870:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:175:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1949:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `block in call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1726:in `synchronize'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in `request'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:230:in `process_request'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:57:in `get'
test/unit_test.rb:49:in `block in <class:AppTest>'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'
[ 46/102] BuildTest#test_build = 0.00 s
2) Error:
test_build(BuildTest):
ArgumentError: invalid byte sequence in UTF-8
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/jsmin-1.0.1/lib/jsmin.rb:94:in `minify'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/engines/jsmin.rb:5:in `js'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/compressor.rb:23:in `compress'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/package.rb:94:in `minify'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/class_methods.rb:32:in `block (3 levels) in add_compressed_routes!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/tilt-1.4.1/lib/tilt.rb:127:in `fetch'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/class_methods.rb:31:in `block (2 levels) in add_compressed_routes!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in `block in compile!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `[]'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (3 levels) in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:966:in `route_eval'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in `block (2 levels) in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:987:in `block in process_route'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in `process_route'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:948:in `block in route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `each'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in `route!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1059:in `block in dispatch!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1056:in `dispatch!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `block in call!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `call!'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:870:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:175:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1949:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `block in call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1726:in `synchronize'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `call'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in `request'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:230:in `process_request'
/Users/jean-philippedoyle/.rvm/gems/ruby-2.0.0-p247/gems/rack-test-0.6.2/lib/rack/test.rb:57:in `get'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/builder.rb:13:in `build_get'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/builder.rb:17:in `build_package!'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/builder.rb:5:in `block in build!'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/builder.rb:5:in `each'
/Hookt/sinatra-assetpack/lib/sinatra/assetpack/builder.rb:5:in `build!'
test/build_test.rb:11:in `block in <class:BuildTest>'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
/Users/jean-philippedoyle/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'
Finished tests in 3.866660s, 26.3794 tests/s, 35.4311 assertions/s.
102 tests, 137 assertions, 0 failures, 2 errors, 0 skips
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
@j15e actually, that's a good repro :) it's trying to parse the PNG file (a_package/package.png
) instead of the JS/CSS resource.
Oh yeah perfect, didn't saw it at first! Merged, thanks.
:+1:
Just released 0.3.1 with this fix
We're using AssetPack on a project organized "by layer" versus "by type". This means we sometimes have two files with the same basename in a given directory (e.g., "todo.coffee" and "todo.scss").
AssetPack's selection of local files has a bug which prevents it from serving the right file, as it doesn't currently consider dynamic file extensions when sorting the matches found in
dyn_local_file_for
.This pull request fixes that bug and adds new tests to cover this scenario.