bundler-inject icon indicating copy to clipboard operation
bundler-inject copied to clipboard

Added ability to save original Gemfile.lock

Open d-lebed opened this issue 3 years ago • 6 comments

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?

d-lebed avatar Dec 01 '21 10:12 d-lebed

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 avatar Dec 01 '21 14:12 Fryguy

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

Fryguy avatar Dec 01 '21 18:12 Fryguy

@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.

d-lebed avatar Dec 07 '21 10:12 d-lebed

No problem 😊

Fryguy avatar Dec 07 '21 14:12 Fryguy

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

choosen avatar Oct 06 '22 21:10 choosen

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

lain0 avatar Jun 25 '24 19:06 lain0