Restore
BUNDLED WITH
section inGemfile.lock
from git repository.
# Gemfile.lock
PATH
remote: .
specs:
(snip)
BUNDLED WITH
1.10.4
Bundler v1.10.0 or higher
tracks Bundler version in lockfile.
We should use latest Bundler, but sometimes we are afraid we have to use older Bundler.
We use Different version of Bundler between a project and a local machine.
In addition, Bundler v1.9.x
removes BUNDLED WITH
section.
RestoreBundledWith solves these conflicts.
RestoreBundledWith restores BUNDLED WITH
section from git repository.
- Track Bundler version in lockfile by smlance #3485 bundler/bundler
- Do not update BUNDLED WITH if no other changes to the lock happened #3697 bundler/bundler
$ cat Gemfile.lock
(snip)
unicorn-worker-killer
webmock
BUNDLED WITH
1.10.2
Execute bundle update
by Bundler v1.10.3.
$ bundle update
(update)
$ git diff
(snip)
@@ -291,4 +296,4 @@ DEPENDENCIES
webmock
BUNDLED WITH
- 1.10.2
+ 1.10.3
Then, execute restore-bundled-with
.
$ restore-bundled-with
(restore BUNDLED WITH section)
$ git diff
(no diff)
There is no diff, because this restores BUNDLED WITH
from git repository.
$ cat Gemfile.lock
(snip)
unicorn-worker-killer
webmock
BUNDLED WITH
1.10.2
Execute bundle update
by Bundler v1.9.9.
$ bundle update
(update)
$ git diff
(snip)
@@ -289,6 +299,3 @@ DEPENDENCIES
unicorn
unicorn-worker-killer
webmock
-
-BUNDLED WITH
- 1.10.2
Then, execute restore-bundled-with
.
$ restore-bundled-with
(restore BUNDLED WITH section)
$ git diff
(no diff)
There is no diff, because this restores BUNDLED WITH
from git repository.
system(*['bundle', 'update'])
# restore_bundled_with
lock_file_contents = File.read('Gemfile.lock')
lock = RestoreBundledWith::Lock.restore(lock_file_contents, 'Gemfile.lock')
File.write('Gemfile.lock', lock.body)
There is no diff, because this restores BUNDLED WITH
from git repository.
- Git
Commands:
restore-bundled-with delete # Delete BUNDLED WITH section
restore-bundled-with fetch # Fetch BUNDLED WITH section
restore-bundled-with help [COMMAND] # Describe available commands or one specific command
restore-bundled-with restore # Restore BUNDLED WITH section in Gemfile.lock
restore-bundled-with version # Show the RestoreBundledWith version
Usage:
restore-bundled-with restore
Options:
[--data=DATA]
[--file=FILE]
[--lockfile=LOCKFILE]
# Default: Gemfile.lock
[--ref=REF]
# Default: HEAD
[--git-path=GIT_PATH]
# Default: .
[--git-options=key:value]
[--new-line=NEW_LINE]
# Default:
[--debug], [--no-debug]
[--verbose], [--no-verbose]
Restore BUNDLED WITH section in Gemfile.lock
Add this line to your application's Gemfile:
gem 'restore_bundled_with'
And then execute:
$ bundle
Or install it yourself as:
$ gem install restore_bundled_with
After checking out the repo, run bin/setup
to install dependencies. Then, run rake
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/packsaddle/ruby-restore_bundled_with. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.