A gem that cannot find a gem even though it is installed

I built my first gem, but it seems I could not install it correctly. I can execute the command

sudo gem install ceilingfish-toto 

What makes the conclusion

 Successfully installed ceilingfish-toto-0.3.6 1 gem installed 

But when I then type gem which ceilingfish-toto . I get a conclusion

 Can't find ruby library file or shared library ceilingfish-toto 

This is very strange, because if I go and look in the folder of my gems, I see all the files installed there.

 # ls -l /opt/local/lib/ruby/gems/1.8/gems/ceilingfish-toto-0.3.6/ total 48 -rw-r--r-- 1 root admin 1053 14 Feb 17:16 LICENSE -rw-r--r-- 1 root admin 6166 14 Feb 17:16 README.md -rw-r--r-- 1 root admin 879 14 Feb 17:16 Rakefile -rw-r--r-- 1 root admin 6 14 Feb 17:16 VERSION -rw-r--r-- 1 root admin 2477 14 Feb 17:16 ceilingfish-toto.gemspec drwxr-xr-x 7 root admin 238 14 Feb 17:16 test 

Does anyone know what might cause this? I think he is complaining because there is a hyphen in the name of the gem. You can see gemspec here http://github.com/ceilingfish/toto

+6
ruby gem
source share
3 answers

gem which ceilingfish-toto looks at the pearl the required path for a file named topfish-toto.rb. Since he is not there, he returns nothing. What would work for you is gem which toto , but since lib/ not part of the gem specification, lib files are not installed, so it does not exist.

Rerunning rake gemspec can solve the problem.

As a third-party option, you can check if its name is installed by name using the gem list ceilingfish-toto , which should show you that it is installed regardless of the files it has (it will also list installed versions).

+6
source share

This is not a hyphen.

gem which searches library files in gems, not gems . For comparison:

 $ gem which haml /home/dave/.gem/ruby/1.8/gems/haml-3.0.12/lib/haml.rb $ ls haml-3.0.12/lib/h* haml haml.rb haml.rbc 

Peach. Note the existence of lib/haml.rb

 $ gem which rails ERROR: Can't find ruby library file or shared library rails $ ls rails-2.3.8/lib/r* rails_generator.rb railties_path.rb rubyprof_ext.rb ruby_version_check.rb 

No lib/rails.rb . But try:

 $ gem which railties_path # not a gem /home/dave/.gem/ruby/1.8/gems/rails-2.3.8/lib/railties_path.rb 

So, gem which ceilingfish-toto gives an error even if ceilingfish-toto installed because there is no lib/ceilingfish-toto.rb (there’s not even a lib folder there).

+7
source share

OK, so the problem here is that there was a problem with my gemspec file. From what I can say, there absolutely must be a file called lib/gem-name.rb , so in this case I needed lib/ceilingfish-toto.rb .

It is not like some other gems are working correctly. For example, mime-types or rest-client , even if they are not displayed using gem which , they really work.

I’m not sure if this is still correct, I’m sure there must be a way to get a gem with a hyphen in the name in order to behave correctly. If I find out, I will send back and let you know.

-one
source share

All Articles