For some Rails applications, I'd like to have a safe-guard when I deploy to check if I have some gems configured to be looked up at a local path.
A little bit of context may help to understand.
When I'm in development mode, I want to have a gem in "local mode". In my Gemfile it is configured like this : gem 'my_gem', '~> 0.9', :path => './path/to/my_gem'.
In production, I want to be like this : gem 'my_gem', '~> 0.9', :git => '[email protected]:my_gem.git'.
I've tried to make a shell script (or function) to read the Gemfile.lock and exit with an error if the gem is in "local mode".
My deployment scripts could use this to abort if I've forgotten to switch back to the proper mode.
Any help will be appreciated. Thanks
Use
group :development do
gem 'my_gem_for_development', '~> 0.9', :require => './path/to/my_gem/lib/my_gem.rb' , :path => './path/to/my_gem/lib'
end
group :production do
gem 'my_gem', '~> 0.9', :git => '[email protected]:my_gem.git'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With