How to find the path a Ruby Gem is installed at (i.e. Gem.lib_path c.f. Gem.bin_path)

前端 未结 4 1966
灰色年华
灰色年华 2020-12-24 01:24
Gem.bin_path(\'cucumber\', \'cucumber\')

Will return the binary/executable\'s path. It seems there is no such function to return the library path.

4条回答
  •  粉色の甜心
    2020-12-24 01:51

    Try using bundle show cucumber.

    Which, from looking at the source of bundler does something like:

    spec = Bundler.load.specs.find{|s| s.name == name }
    spec.full_gem_path
    

    You are using bundler, right?

提交回复
热议问题