As requested, an answer involving a separate file:
Use a non-default Gemfile as a developer. This is the least intrusive solution for the project but probably also the least convenient for the developers.
Create a Gemfile.custom
alongside the Gemfile
, containing developer specific gems:
eval File.read(__dir__ + '/Gemfile')
group :development do
gem 'ph_app', path: ENV['PH_APP_HOME']
end
The Gemfile.custom
should be ignored by version control.
The eval
is an ordinary Ruby instruction. Together with File.read
it will cause the other file to be read and its contents be interpreted. You can use the bundler DSL in that other file without doing anything special.
Execute this from the project root to start using the alternate Gemfile:
bundle config --global gemfile Gemfile.custom
Using --global
will set the value for all projects on the developer's machine (for that user). And here is why developers might not like this solution very much: Every bundled project on their machines will need a Gemfile.custom
.
Alternatively, the custom Gemfile option can be supplied to a bundler command. That way, other projects will not be affected, but every bundler command will have to be amended with the option. Binstubs might make this more convenient, but I did not try that.
Note that the entries for custom gems in Gemfile.custom.lock will differ on a per developer basis. Developers will need to be careful when adding their changes to version control.