gem which cannot find gem despite it being installed

后端 未结 3 1252
陌清茗
陌清茗 2021-01-12 10:20

I\'ve built my first gem but I don\'t seem to be able to get it to install correctly. I can issue the command

sudo gem install ceilingfish-toto
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 10:52

    It's not the hyphen.

    gem which searches for library files in gems, not gems. Compare:

    $ 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
    

    Peachy. Note the existance 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
    

    There is 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 throws an error even when ceilingfish-toto is installed because there is no lib/ceilingfish-toto.rb file (there's not even a lib folder).

提交回复
热议问题