gem_dating icon indicating copy to clipboard operation
gem_dating copied to clipboard

use bundler to parse the Gemfile?

Open copiousfreetime opened this issue 2 years ago • 3 comments
trafficstars

Is there any particular reason to avoid having Bundler itself parse the gemfile? Bundler is already a runtime dependency of gem_dating

I think you could do something like the following at minimum

bundler_defintion = ::Bundler::Definition.build(path_to_gemfile, nil, nil)
result = GemDating::Result.new(bundler_definition.specs.map(&:name))

copiousfreetime avatar Jul 27 '23 18:07 copiousfreetime

Correction - bundler_definition.specs will return ALL the resolved spec tree, I think what you would want is bundler_definition.dependencies

copiousfreetime avatar Jul 27 '23 18:07 copiousfreetime

I agree that Bundler should be our first stop for validating a Gemfile!

When we discussed, other options came up first. Namely, using bundler outdated, or other gems like libyear-bundler.

We specifically wanted to avoid needing a valid Bundler definition, or even a parsable Gemfile. We wanted to avoid getting blocked by setting up really old rubies, gems that were privately hosted, or missing for other reasons (ex: Mimemagic pulling gems).

I'll update the readme with a section that highlights that better!

Daniel-N-Huss avatar Jul 27 '23 20:07 Daniel-N-Huss

Totally understandable, bundler does do a bunch of other things under the covers.

copiousfreetime avatar Jul 27 '23 20:07 copiousfreetime