Programmatically determine gem's path using bundler

前端 未结 4 1413
借酒劲吻你
借酒劲吻你 2021-02-13 02:37

I know you can do

bundle show gem_name

to show the path of some gem.

How do you do that from within the code using the Bundler object?<

4条回答
  •  温柔的废话
    2021-02-13 03:30

    It turns out you actually want to use Gem for this, not Bundler.

    path = Gem.loaded_specs[NAME_OF_GEM].full_gem_path

提交回复
热议问题