emancu/toml-rb

Debian package is broken

Closed this issue · 3 comments

Hello there,

I realize that this is not directly your fault, since you most likely didn't package the ruby-toml-rb package that is in debian and ubuntu. However, it seems that the cause of their mistake is that they did not include the init.rb file when they packaged it. I must ask you, why is the file outside of the lib directory?

It appears that it's only required by lib/toml-rb.rb on the first line. Can we just move that there? I don't understand the point of the init file at all.

Here's the error I get:

irb(main):001:0> require 'toml-rb'
LoadError: cannot load such file -- /usr/lib/ruby/init
 from /usr/lib/ruby/vendor_ruby/toml-rb.rb:1:in `require_relative'
 from /usr/lib/ruby/vendor_ruby/toml-rb.rb:1:in `<top (required)>'
 from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
 from (irb):1
 from /usr/bin/irb:11:in `<main>'

Here's a question I submitted to the Ubuntu package: https://answers.launchpad.net/ubuntu/+source/ruby-toml-rb/+question/661049

From what I can see, there are two ways to fix this:

  1. Wait for the debian/ubuntu developers to fix their tooling to include init.rb in their package.
  2. We move the things in init.rb to lib/toml-rb.rb and release a new version, and they will pick it up in 6-12 months.

I suspect the second option would be faster than the first option. If you agree, then I can submit a PR for it.

Thanks!

Sure, go ahead and send a PR!

@stefansundin Pushed new version v1.1.1

Thanks for taking care of this issue!

Thank you, I can confirm that it is working if I replace the file.

$ sudo apt install ruby-toml-rb
$ ruby -e 'require "toml-rb"; puts TomlRB.parse("[test]")'
/usr/lib/ruby/vendor_ruby/toml-rb.rb:1:in `require_relative': cannot load such file -- /usr/lib/ruby/init (LoadError)
	from /usr/lib/ruby/vendor_ruby/toml-rb.rb:1:in `<top (required)>'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'
$ sudo curl -o /usr/lib/ruby/vendor_ruby/toml-rb.rb https://raw.githubusercontent.com/emancu/toml-rb/master/lib/toml-rb.rb
$ ruby -e 'require "toml-rb"; puts TomlRB.parse("[test]")'
{"test"=>{}}

Now I just have to convince someone to update the package..