I have a Sinatra application that requires another gem I'm developing locally. I'm having trouble configuring Bundler to use my local gem code during development but my vendored gem code in production.
Ideally I could do something like this, but Bundler doesn't allow you to specify the same gem twice:
# Doesn't work:
group :development do
gem 'awesome', :path => "~/code/awesome"
end
group :production do
gem 'awesome', :path => "vendor/gems/awesome-0.0.1"
end
In the meantime I've resorted to manually vendoring the gem & updating the gem source in the Gemfile every single time I deploy, which is quite a hassle. My workflow is this:
- Point to my local gem during development (
gem 'awesome', :path => "~/code/awesome"
)
- When ready to deploy, unpack gem into
vendor/gems
- Update Gemfile to point to vendored gem (
gem 'awesome', :path => "vendor/gems/awesome-0.0.1"
)
- Run
bundle install
(to update Gemfile.lock)
- Deploy code
- Return to step 1.
What a hassle! I'd like to do something cleaner than simply writing Rake tasks to automate my current setup.
What's the best workflow for this scenario?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…