Module: Resona::Resolver
- Defined in:
- lib/resona/resolver.rb
Defined Under Namespace
Classes: ChecksumNotFound, GroupConflict
Constant Summary collapse
- DEFAULT_URI =
"https://rubygems.org"
Class Method Summary collapse
Class Method Details
.run(gemfile_path, **options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/resona/resolver.rb', line 12 def run(gemfile_path, **) check_group_conflicts([:with], [:without]) Bundler.settings.with = .fetch(:with, []) Bundler.settings.without = .fetch(:without, []) # Resolve gem dependencies using Bundler. definition = Bundler::Definition.build(gemfile_path, nil, nil) definition.resolve_remotely! # For each gem, extract necessary info. gems = definition.specs.inject({}) do |acc, spec| next acc unless spec.is_a? Bundler::EndpointSpecification name = spec.name version = spec.version.to_s checksum = spec.checksum # quite a few is empty platform = spec.platform remote_uri = spec.remote.anonymized_uri || DEFAULT_URI if checksum.nil? || checksum.empty? checksum = query_checksum(spec, remote_uri) end acc[name] = { version: version, checksum: checksum, remote_uri: remote_uri, platform: platform } acc end gems end |