dud*_*n90 5 ruby ruby-on-rails bundler gemfile
我正在与一个开发团队合作,我们都在使用我们的存储库中的相同Gemfile.因为我在Mac上工作,而其他人正在使用Ubuntu,我们在我们的存储库中也有一个Gemfile.local.example文件,它具有适用于每个操作系统的通知宝石,所有这些都被注释掉了.
我没有评论我的操作系统的宝石并保存为新文件,而不是版本控制Gemfile.local.现在我想"捆绑安装"从两个文件安装gem.
我找不到任何关于这样做的好文档.
我同意使用两个Gemfiles是不好的做法,并且已经找到了一个解决方案,它涉及RUBY_PLATFORM常量以及platform我的Gemfile中的标志.这可能不是最优雅的解决方案,但它对我有用.
这是我的代码的一大块好奇的读者:
group :development, :test do
# Mac OSX notifications
gem 'growl_notify' if RUBY_PLATFORM.downcase.include?("darwin")
gem 'growl' if RUBY_PLATFORM.downcase.include?("darwin")
# Gnome notifications => aka for Linux
gem 'libnotify' if RUBY_PLATFORM.downcase.include?("linux")
# Guard-spork doesn't work with windows but it's
# awesome for other Operating Systems.
gem 'guard-spork' if RUBY_PLATFORM.downcase.include?('darwin') || RUBY_PLATFORM.downcase.include?('linux')
# Windows Rubies (RubyInstaller)
platforms :mswin, :mingw do
# Windows notifications
gem 'rb-notifu'
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2409 次 |
| 最近记录: |