How can I use multiple gemfiles for my application?

I work with a development team and we all use the same Gemfile from our repository. Since I work on a Mac and others use Ubuntu, we have the Gemfile.local.example file in our repository, as well as the corresponding notification headers for each OS, all commented out.

I did not comment on gems for my OS and saved as a new file, and not in version control, Gemfile.local. Now I would like to install "bundle install" to install gems from both files.

I can not find good documentation on this.

+5
source share
4 answers

, Gemfiles - , , RUBY_PLATFORM platform Gemfile. MOST, .

:

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
+5

Gemfile , groups : , OS X Ubuntu?

Gemfiles. Gemfile bundle config (man page), , .

+7

- (, OS X), RVM gemsets . mac , .

RVM gemset, rvm use. gemset, , gemset.

https://rvm.io//

+1

Gemfile, Gemfile.lock. , .

Remember that you can use Ruby to distinguish which sections are loading Bundle.setup, and you can use groups to define things that are specific to a particular platform.

Gemfile.lockmust provide specific requirements for application deployment. It should be in the version control system, so there is no confusion as to which version the application will run with. If there are platform issues here, you should be careful with what you use, and where required, block dependencies only with the group :development.

0
source

All Articles