【问题标题】:Telling Bundler to exclude certain gems from a particular gem's installation告诉 Bundler 从特定 gem 的安装中排除某些 gem
【发布时间】:2012-02-23 21:14:13
【问题描述】:

在 gemfile 中,有没有办法告诉 Bundler:

gem 'twitter-bootstrap-rails', :exclude therubyracer

我需要安装 twitter-bootstrap-rails,但它会自动拉入 therubyracer,因此 bundle install 失败并且引导程序不包含在项目中,因为这是一台 Windows 机器。我安装了 execjs 无济于事。

我尝试列出正在生产的therubyracerbundle install --without production,也无济于事。

therubyracer gem on windows”也是这个问题,但那里的建议都没有改变我得到的错误。

我的旧帖子是“When I do "bundle update", I get an error from a gem not in my gemfile. How do I ignore this dependency?”。

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 bundler twitter-bootstrap


    【解决方案1】:

    Bundler 中没有此选项。

    所以你有以下选择:

    • 不要使用twitter-bootstrap-rails。您可以将编译好的 css 和 js 文件复制到 vendor/assets 下的正确目录中。您将失去更改较少变量的能力。或者您可以使用 compass_twitter_bootstrap gem,它使用 sass 而不是 less。

    • less gem 的维护者使用execjs 而不是commonjstherubyracer。如果可能的话,这可能意味着对维护者进行重大重构。

    • 在您的 Gemfile 中使用 :platform 选项,仅在 OSX 或 Linux 上安装。然后需要您可以手动使用的部件,无需加载less。这可能行不通。

    【讨论】:

    • 那太蹩脚了 :-( Bundler 在不久的将来会有排除功能的机会吗?
    • 哇,这太可怕了。因此,如果有人依赖于你 100% 可以验证的东西不会被调用,那么你只需要分叉 gem 以从 gemfile 中删除该行以避免使用该依赖项。哇。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-20
    • 1970-01-01
    • 2013-05-02
    • 1970-01-01
    • 2014-12-14
    • 1970-01-01
    相关资源
    最近更新 更多