How to use gems not in a Gemfile when working with bundler?

前端 未结 6 1358
失恋的感觉
失恋的感觉 2020-12-28 15:18

When using bundler with a project in general and Rails specifically, you have access only to gems defined in your Gemfile. While this makes sense, it can be limiting. Mostly

6条回答
  •  梦毁少年i
    2020-12-28 16:02

    You can use something like this in your Gemfile:

    gem 'foo' if ENV['ENABLE_FOO_GEM']
    

    Then just set ENABLE_FOO_GEM in your environment.

    export ENABLE_FOO_GEM=1
    

    The gem will be disabled by default, but easily turned on (permanently) by anyone who wants to use it.

提交回复
热议问题