Skip to content

sassc-rails not working with jruby 9k #92

Closed
@gkosmr

Description

@gkosmr

I tried to precompile assets with jruby9 and got the error below.
It works fine with version 1.2.1 of sassc-rails. As the stacktrace indicates the problem is in template.rb when calling safe_merge (which was introduced in version 1.3.0) in a block passed to Hash#merge.

It works fine with ruby (tested with 2.3.0 and 2.4.1).

Using hsh1.merge(hsh2) { |*args| fn(*args) } does not work in jruby, while it does in ruby. On the other hand hsh1.merge(hsh2){ |args| fn(*args) } works in jruby but not in ruby.

Since we know exactly what is passed to block in merge function, i suggest calls to safe_merge are changed to: hsh1.merge(hsh2){ |key, left, right| sage_merge(key, left, right) }.

I can prepare the pull request, if you agree with the change.

Stacktrace:

rake aborted!
ArgumentError: wrong number of arguments (1 for 3)
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sassc-rails-1.3.0/lib/sassc/rails/template.rb:29:in safe_merge' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sassc-rails-1.3.0/lib/sassc/rails/template.rb:29:in block in call'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sassc-rails-1.3.0/lib/sassc/rails/template.rb:18:in call' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/sass_processor.rb:30:in call'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in call_processor' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in block in call_processors'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in call_processors' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in load_from_unloaded'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in block in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in block in initialize'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:23:in block in call'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/utils.rb:200:in dfs' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/bundle.rb:24:in call'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in call_processor' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in block in call_processors'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in call_processors' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in load_from_unloaded'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in block in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in fetch_asset_from_dependency_cache'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in block in initialize'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in load' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in find_asset'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in find_all_linked_assets' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:134:in block in find'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:133:in find' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in compile'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in block in define' /home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in with_logger'
/home/gasper/.rvm/gems/jruby-9.0.5.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in block in define' /home/gasper/.rvm/gems/jruby-9.0.5.0@global/gems/rake-12.0.0/exe/rake:27:in '
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions