Skip to content
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

gems.rb and gems.locked #325

Open
svoop opened this issue Feb 7, 2022 · 7 comments
Open

gems.rb and gems.locked #325

svoop opened this issue Feb 7, 2022 · 7 comments

Comments

@svoop
Copy link

svoop commented Feb 7, 2022

It would be great if this useful gem supported the alternative gemfile names as well:

  • gems.rb (alternative for Gemfile)
  • gems.locked (alternative for Gemfile.lock)

These alternative names were introduced in 2017.

@svoop
Copy link
Author

svoop commented Feb 8, 2022

I've just seen there's an aging PR on this. It may not be the Holy Grail, but given Bundler has a major deprecation warning for the old Gemfile.lock in place for years already, would you consider merging it anyways, @postmodern ? Thanks for considering this!

@postmodern
Copy link
Member

I haven't seen any deprecation warnings yet and there isn't any immediate plans to remove Gemfile.lock support. However, I will try to add support for detecting gems.locked over Gemfile.lock.

@svoop
Copy link
Author

svoop commented Feb 9, 2022

I wrote that in a kinda misleading way: Bundler is not deprecating Gemfile (and my guess: it never will), but a "major deprecations" method prints a warning which suggests that gems.rb is the recommended naming now... or rather since April 2019:

https://github.com/rubygems/rubygems/blob/a9e305432955f56b847881187a7e01a97b6901e3/bundler/lib/bundler/shared_helpers.rb#L144

The advantage of gems.rb is proper syntax coloring which is why other such files are offering similar alternatives now e.g. rakefile.rb or capfile.rb.

(Btw, there's also a typo since gems.rb.locked does not exist, I've already created a PR fixing this.)

I wouldn't highlight this if there were an easy workaround (other than falling back to the ole Gemfile). Adding a symlink doesn't work because Bundler doesn't like to see Gemfile and gems.rb at the same time.

Thanks for taking a look! Thanks for the quick fix!

@postmodern
Copy link
Member

Take a look at the gems_locked_support branch.

@svoop
Copy link
Author

svoop commented Feb 9, 2022

@postmodern Great, looking good! There's just a tiny thing I'd change:

LOCK_FILES = %w[Gemfile.lock gems.locked]

Maybe better flip the two since Bundler uses gems.locked if both are present.

@postmodern
Copy link
Member

I did some tests and discovered that bundler 2.3.6 would prefer Gemfile.lock over gems.locked, if they both exist.

@svoop
Copy link
Author

svoop commented Feb 9, 2022

Weird, another inconsistency of Bundler since the warning suggests otherwise. Never mind, having both is bad to begin with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants