开发者

What is the correct way to specify gems that I only want included in certain os environments?

开发者 https://www.devze.com 2023-02-16 16:46 出处:网络
Recently I started add this to my Gemfile. gem \"autotest\" gem \"autotest-growl\" # So you get friendly noti开发者_JS百科ces

Recently I started add this to my Gemfile.

  gem "autotest"
  gem "autotest-growl" # So you get friendly noti开发者_JS百科ces
  gem "autotest-fsevent" if `uname`.chomp == "Darwin" # Autotest OSX Specific gems.  So autotests runs better and uses less processor on a Mac

Unfortunately the Gemfile.lock file still ended up on the non mac CI and is now failing the build, meaning the if statement became pointless.

What is the correct way to specify gems that I only want included in certain os environments?

Edit: Platforms looks cool, unfortunately I want to make it so I can specify gems for OSX but not for our linux server. Further suggestions?


See the platforms section of the Gemfile documentation. Note that this does not give you all options, notably you cannot specify Gems specific to Mac.


platforms :mswin do
  # windows specific gems
end

platforms :ruby do
  # non-windows gems
end

See this section in the Gemfile manual for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消