【问题标题】:require all gems in Gemfile in non-Rails app?在非 Rails 应用程序中需要 Gemfile 中的所有宝石?
【发布时间】:2020-05-23 08:40:43
【问题描述】:

当我们编写 Rails 应用程序时,它需要 Gemfile 中为我们定义的所有 gem。

如何让非 Rails 应用做到这一点?

【问题讨论】:

    标签: gem bundler


    【解决方案1】:
    require 'rubygems'
    require 'bundler'
    Bundler.require(:default)
    

    以上需要特定组中的宝石,注意命名组之外的宝石在 :default 组中

    请看这里:https://bundler.io/v2.0/guides/groups.html

    【讨论】:

      猜你喜欢
      • 2018-09-24
      • 2013-05-19
      • 1970-01-01
      • 2016-04-07
      • 2013-01-18
      • 2011-02-04
      • 1970-01-01
      • 1970-01-01
      • 2011-02-12
      相关资源
      最近更新 更多