In my team, some people like to use the pry-rails
gem and others don't like it.
Is there a way to have a secondary Gemfile for development where I don't commit it to git and is still read by bundler
?
You can run:
BUNDLE_GEMFILE=/path/to/another/gemfile bundle install
Or in Gemfile (will create conflict with committed Gemfile.lock) :
gem 'pry-rails' if ENV['WITH_PRY']
And populate WITH_PRY env variable to enable pry.
Another solution to avoid Gemfile.lock conflict with Rails app :
# In Gemfile
group :dev_with_pry do
gem 'pry-rails'
end
And add dev_with_pry to RAILS_GROUPS env variable, this will install the gem but not require it.
Gemfile.lock
that some developers are going to have to remember not to commit, as Tom Lord already pointed out above.
As per the specifications shared you can manage by having two gemfiles and requiring them based on environment.
Gemfile
source 'https://rubygems.org'
gemfiles = [ 'Gemfile1', 'Gemfile2' ]
gemfiles.each do |gemfile|
instance_eval File.read(gemfile)
end
end
Now you can have two separate Gemfile such as
Gemfile1
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'pry'
Then other gems can be added in Gemfile2
Gemfile 2
source 'https://rubygems.org'
https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
Hope it Helps!!
Gemfile.lock
and accidentally checking it into source control!pry-rails
in your gemfile for everybody, and people who don't like it can explicitly suppress it withexport DISABLE_PRY_RAILS=1
in their.bash_profile
. pry-rails already supports this opt-out, you don't need to introduce a second gemfile just to selectively include/exclude this gem.