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.
精彩评论