如何避免在Windows中安装gem?

时间:2012-04-16 11:49:52

标签: ruby-on-rails bundler

在我的Gemfile中,我有以下一行:

gem "thin", :group => [:staging, :production]

当我在开发中运行bundle install时,它实际上安装了thin,这在Widows框中是一个问题,因为thin依赖于无法编译的eventmachine。有没有办法避免在Windows中一起安装这些宝石?

我们确实尝试过跑步:

bundle install --without staging production
无论如何,它试图安装瘦。

解决此问题的正确方法是什么?

2 个答案:

答案 0 :(得分:2)

我这样做。丑陋但有效

if RUBY_PLATFORM != "i386-mingw32" # if Windows
  gem "thin"
end

答案 1 :(得分:1)

黑客可能会这样做:

gem "thin", :group => [:staging, :production], :platforms => :ruby

http://gembundler.com/man/gemfile.5.html#PLATFORMS-platforms-

  

有许多Gemfile平台:

     

红宝石

     

Ruby(MRI)或Rubinius,但不是Windows