如何添加Mac特定的宝石捆绑在Mac上,但不是在Linux上? [英] How to add Mac-specific gems to bundle on Mac but not on Linux?
问题描述
我在Mac上开发Rails应用程序,而我是新手,因此我只是将这些宝石添加到 Gemfile 中:
group:test::development do
gem'rspec-rails'
gem'rb-fsevent'
gem'growl'
end
但是我的生产服务器运行Linux,所以即使它们没有分组在 在运行 它通过运行 编辑: bundler wiki提供了有关如何将平台作为参数。 其他任何(优雅)方法? I'm developing a Rails app on a Mac, and I'm new to testing, so I just added these gems to my Gemfile: But my production server runs Linux, so even if they aren't grouped in Setting It worked by running Edit: The bundler wiki provides details on how to use platform as a parameter. Any other (elegant) approaches? Gemfile actually is a regular ruby file, so you can use something like
这篇关于如何添加Mac特定的宝石捆绑在Mac上,但不是在Linux上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!:production
,bundler( v1.0.21 )仍会尝试安装它们。 ...并且很明显失败!
extconf.rb:19:'< main>':只支持Darwin(Mac OS X)系统(RuntimeError) code $ <
bundle install $之前将
RAILS_ENV
设置为生产c $ c> 不起作用。
bundle install --without development test code>,但这些宝石如何才能被bundler仅考虑到您的操作系统?
相同的解决方案在捆绑商问题#663 中给出,所以我尝试:
group:test,:development do
gem'rspec-rails'
platforms:达尔文do
gem'rb-fsevent'
gem'growl'
end
end
bundle install
不起作用,但即使我们回到原点并执行
bundle install --without darwin
,结果是'darwin'不是有效的平台。
可用选项为:[:ruby,:ruby_18,:ruby_19,:mri,:mri_18,:mri_19,:rbx,:jruby,:mswin,:mingw,:mingw_18,::mingw_19]
pre $ case $ RUBY_PLATFORM
当/ darwin /
gem'foo'
当/ win32 /
gem'bar'
结束
group :test, :development do
gem 'rspec-rails'
gem 'rb-fsevent'
gem 'growl'
end
:production
, bundler (v1.0.21) still attempts to install them. ...and fails, obviously!
extconf.rb:19:in '<main>': Only Darwin (Mac OS X) systems are supported (RuntimeError)
RAILS_ENV
to production before running bundle install
doesn't work.bundle install --without development test
, but how can these gems be taken into consideration by bundler only based on your OS?
The same solution is given in bundler issue #663, so I tried:group :test, :development do
gem 'rspec-rails'
platforms :darwin do
gem 'rb-fsevent'
gem 'growl'
end
end
bundle install
does not work, but even if we go back to square one and do
bundle install --without darwin
, the result is 'darwin' is not a valid platform.
The available options are: [:ruby, :ruby_18, :ruby_19, :mri, :mri_18, :mri_19, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19]
case RUBY_PLATFORM
when /darwin/
gem 'foo'
when /win32/
gem 'bar'
end