Reputation: 3108
I have moved some of my common fucntionality to a seperate gem and have been using that. In production I include the gem directly from github.
#common
gem 'engine', path: '../engine'
#gem 'engine', branch: 'master', git: 'source to engine.git'
The problem is when I get to development mod I comment out the second line and revert it back before checking in. This is kind of irritating to do every time I've to check in. I cannot add the gemfile to gitignore as the app is still under development and we keep modifying this file all the time.
I tried grouping them separately using
group :development, :test do
gem 'engine', path: '../engine'
group :production do
gem 'engine', branch: 'master', git: 'source to engine.git'
But it throws an error saying that I cannot define a gem twice. I don't understand what I'm doing wrong here.
Please help me with this.
Upvotes: 0
Views: 52
Reputation: 16507
The gem is really defined twice in the two groups, since Gemfile parser just see into a group anyway. Try to close the gem for production environment under if
condition:
group :development, :test do
if ENV[ 'RAILS_ENV' ] != 'production'
gem 'engine', path: '../engine'
end
end
group :production do
if ENV[ 'RAILS_ENV' ] == 'production'
gem 'engine', branch: 'master', git: 'source to engine.git'
end
end
Upvotes: 1