Automatico
Automatico

Reputation: 12916

Updating Gemfile.lock without installing gems

Is there a way to force an update of the Gemfile.lock without installing the gems that have changed?

Upvotes: 38

Views: 15293

Answers (3)

Arnaud Meuret
Arnaud Meuret

Reputation: 984

UPDATE: This is still supported by the current (2.4) version but has been deprecated in favour of the lock command.

Force your specific requirement using:

bundle inject rmagick "=1.7.1"

Upvotes: 3

Christopher Oezbek
Christopher Oezbek

Reputation: 26313

Instead of

bundle install

do the following:

bundle lock

This will just update the Gemfile.lock, but not attempt to install the files locally.

If you want to prepare a Gemfile.lock for a remote or deployment platform you must add it using

bundle lock --add-platform ...

Latest docs at https://bundler.io/v1.16/man/bundle-lock.1.html

Upvotes: 9

alexwlchan
alexwlchan

Reputation: 6098

Run bundle lock --update.

I found an answer in a blog post by Chris Blunt: “Rails on Docker: Quickly Create or Update Your Gemfile.lock”:

Today, I discovered a way to save the hours wasted downloading gems: bundler’s lock command.

This gem of a command resolves your app’s dependencies and writes out the appropriate Gemfile.lock – without installing any of the gems themselves.

According to the changelog, this command was added in Bundler 1.10.0.pre, released about eight months after this question was asked.

Upvotes: 52

Related Questions