Skip to content

Added ability to save original Gemfile.lock #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

d-lebed
Copy link

@d-lebed d-lebed commented Dec 1, 2021

I understand that this probably will never be merged to master, so it's more like "feature request"
It also requires refinements, proper tests, etc… I'll work on that if you'll say that this feature may be merged once it's ready and stable.

The main idea here is to keep Gemfile.lock "pristine" when working using gem overrides. If bundler_inject.enable_pristine option set to true this creates another Gemfile.lock.local near original one and uses it by default. So you don't need to remove overrides each time you want to commit changes.

What do you think?

@Fryguy
Copy link
Member

Fryguy commented Dec 1, 2021

This is a cool idea. We had a similar problem recently with building ManageIQ where I accidentally committed my overrides to the lock. @bdunne What do you think?

@Fryguy Fryguy added the enhancement New feature or request label Dec 1, 2021
@Fryguy
Copy link
Member

Fryguy commented Dec 1, 2021

@d-lebed Can you add some specs for these cases (particularly for the "not able to be resolved" case, which is pretty interesting)?

@d-lebed
Copy link
Author

d-lebed commented Dec 7, 2021

@Fryguy I'm sorry for the delay. Have some work to do. I'll continue working on this one once I'll have some free time.

@Fryguy
Copy link
Member

Fryguy commented Dec 7, 2021

No problem 😊

@choosen
Copy link

choosen commented Oct 6, 2022

I don't use gem overwrites, but it can be done also by my solution, by pointing on local gem path source.

To deliver actually described feature you can use following method, without installing bundler-inject.

Add new GemfileDev file with content:

gemfile_content = File.open('Gemfile', 'r').read # you can also load your ~/GemfileDev (gemfile) to similar eval
eval(gemfile_content)

gem 'pry'

then call (or set in shell) ENV variable:
BUNDLE_GEMFILE=GemfileDeveloper bundle

It will create separate GemfileDev.lock and you should add those GemfileDev* to git ignore.
Then you can run BUNDLE_GEMFILE=GemfileDeveloper rspec or BUNDLE_GEMFILE=GemfileDeveloper rails s (with binstubs or with prepending bundle exec)

Actually I don't see bundler-inject so helpful if Gemfile.lock will change, so I like your idea @d-lebed

PS. Greetings to juliancheal ! I cannot mention you guy @ github :D

@lain0
Copy link

lain0 commented Jun 25, 2024

bundler 2.4.7 has option bundle --gemfile that supports usage of Gemfile-custom with output Gemfile-custom.lock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants