Conflict between longstanding gemfury Hash extension and tilt 1.3.5
Closed this issue · 4 comments
After a bundle update to a related library upgraded tilt from 1.3.3 to 1.3.5, I am unable to compile assets for the asset pipeline. The message received is as follows:
Error compiling CSS asset
ArgumentError: wrong number of arguments (0 for 1)
(in x/app/assets/stylesheets/application.css)
x/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/gemfury-0.4.10/lib/gemfury.rb:39:in `path'
Consulting the relevant gemfury code, gemfury.rb extends class Hash as follows:
class Hash
# Access nested hashes as a period-separated path
def path(path, separator = '.')
path.split(separator).inject(self) do |hash, part|
hash.is_a?(Hash) ? hash[part] : nil
end
end
end
This class extension is not new within gemfury.
When I revert tilt back to 1.3.3, things work fine. The problem also occurs with 1.3.4. Am just about to look into the changelog for tilt 1.3.5 but any thoughts are appreciated.
It appears that this change is the culprit:
@@ -41,6 +41,7 @@ def initialize(file=nil, line=1, options={}, &block)
[options, line, file].compact.each do |arg|
case
when arg.respond_to?(:to_str) ; @file = arg.to_str
+ when arg.respond_to?(:path) ; @file = arg.path
when arg.respond_to?(:to_int) ; @line = arg.to_int
when arg.respond_to?(:to_hash) ; @options = arg.to_hash.dup
else raise TypeError
@@ -91,6 +92,15 @@ def eval_file
... having a Hash passed in that's been monkey-patched to respond to path but requiring an argument is causing the compilation failure.
I'm going to revert back to 1.3.3 for the time being but am happy to help address if there is a desired workaround.
Thanks for the report. I've pushed a fix which I believe will fix this.
Can you test with the latest master branch and see if it fixes your problem?
Just tested against master and all is well. Thanks for the fix, will look for next release.
I've released Tilt 1.3.6 today.