Skip to content

Commit

Permalink
Merge pull request #11 from Sirupsen/os-specific-gems
Browse files Browse the repository at this point in the history
OS-specific gems
  • Loading branch information
bbatsov committed Oct 22, 2011
2 parents 28928a9 + eb3520e commit b55ae16
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,34 @@ the same purpose of the named scope and returns and
## Bundler

* Put gems used only for development or testing in the appropriate group in the Gemfile.
* Avoid OS specific gems. Bundler has no facilities to deal with those properly.
* Use only established gems in your projects. If you're contemplating
on including some little-known gem you should do a careful review of
its source code first.
its source code first.
* OS-specific gems will by default result in a constantly changing `Gemfile.lock`
for projects with multiple developers using different operating systems.
Add all OS X specific gems to a `darwin` group in the Gemfile, and all Linux
specific gems to a `linux` group:

```Ruby
# Gemfile
group :darwin do
gem 'rb-fsevent'
gem 'growl'
end

group :linux do
gem 'rb-inotify'
end
```

To require the appropriate gems in the right environment, add the
following to `config/application.rb`:

```Ruby
platform = RUBY_PLATFORM.match(/(linux|darwin)/)[0].to_sym
Bundler.require(platform)
```

* Do not remove the `Gemfile.lock` from version control. This is not
some randomly generated file - it makes sure that all of your team
members get the same gem versions when they do a `bundle install`.
Expand Down

0 comments on commit b55ae16

Please sign in to comment.