Closed Dextro closed 11 years ago
fixed. Apparently my Ruby version was too old.
In the 1.8 series, only 1.8.7+ is supported. What version did you have?
I got the error with the default in Mountain Lion: ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
I ran into this issue today too. Pathname#binread
was introduced in ruby 1.9 and is not available in 1.8.7, so this is a 1.8.7 compatibility issue with librarian.
librarian-0.0.26/lib/librarian/chef/manifest_reader.rb @ line 49:
if IO.respond_to?(:binread)
def binread(path)
path.binread
end
else
def binread(path)
path.read
end
end
The issue is that thor is monkey-patching IO
to define binread
but does not define Pathname#binread
.
/Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor/core_ext/io_binary_read.rb @ line 4:
def binread(file, *args)
raise ArgumentError, "wrong number of arguments (#{1 + args.size} for 1..3)" unless args.size < 3
File.open(file, 'rb') do |f|
f.read(*args)
end
end unless method_defined? :binread
Librarian can deal with it by instead checking:
if Pathname.method_defined? :binread
I don't know how or if this applies to the master branch, since lib/librarian/chef/manifest_reader.rb
no longer exists.
This issue started sometime after thor-0.17.0 and before or at 0.18.1.
Thanks for reminding me why I'm not a fan of monkey-patches in libraries.
This should be fixed in librarian-chef master here: https://github.com/applicationsonline/librarian-chef/commit/76cb3cbee990fced59836578bb07d2dd9411133d
Anyone want to check if this is fixed in librarian-chef v0.0.1
?
$ librarian-chef install /Library/Ruby/Gems/1.8/gems/librarian-0.0.26/lib/librarian/chef/manifest_reader.rb:49:in
binread': undefined method
binread' for #Pathname:0x10ec38b60 (NoMethodError)