Reputation: 996
Usually, people will use bundle install
to install gems. But it require Gemfile and Gemfile.lock(optional).
My situation is a little different. I only have Gemfile.lock. So how can I install all these gems based on bundle
command.
I tried bundle install --deployment
. But I got Could not locate Gemfile error.
OK. I asked this question in bundler github issues. Their member gave me a good answer: https://github.com/bundler/bundler/issues/5293#issuecomment-269978731
For summary -- I CAN NOT DO THAT
I gave up to run bundle install
with Gemfile.lock only. But I still need to solve my problem. And in my Gemfile, I don't have any special options like groups, platforms, install conditionals. So I wrote a script(gem) to revert the Gemfile.lock to Gemfile for my docker image.
[SOLVED]
Upvotes: 3
Views: 2361
Reputation: 115
Have you tried simply running the gem install directly in your terminal? That way you won't need to use a Gemfile at all.
For example, with the devise gem, you can just run $ gem install devise
in your terminal and that will install the devise gem without adding it to your Gemfile.
Upvotes: 0
Reputation: 881
With only gemfile.lock
, you can run
bundle install --deployment
The only catch is that this command installs gems to the vendor/bundle instead of your normal gem bundle path. it is so because it is expected to be used only in production.
It works well all the same though.
Upvotes: 1