Commit 6ca1ff6
committed
Use the path returned from
`Gem::SpecFetcher.fetcher.spec_for_dependency` returns
`Gem::Specification`, `Gem::Source` tuples.
https://github.com/fedora-ruby/gem-compare/blob/6b221bcf37b30a9dda05d0a2d7d677bee52ef097/lib/rubygems/comparator.rb#L251
```ruby
irb(main):001> gem_name = "pg"
=> "pg"
irb(main):002> version = "1.6.0"
=> "1.6.0"
irb(main):003> dep = Gem::Dependency.new gem_name, version
=> Gem::Dependency.new("pg", Gem::Requirement.new(["= 1.6.0"]), :runtime)
irb(main):004> specs_and_sources, _errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
=>
[[[Gem::Specification.new do |s|
...
irb(main):017> specs_and_sources.map { it.map(&:class) }
=> [[Gem::Specification, Gem::Source], [Gem::Specification, Gem::Source]]
```
`Gem::Source#download` will return the local gem file path:
```ruby
irb(main):013> specs_and_sources.first.last.download specs_and_sources.first.first
Fetching pg-1.6.0-aarch64-linux.gem
=> "/app/pg-1.6.0-aarch64-linux.gem"
```Gem::Source#download
1 parent 7c260c6 commit 6ca1ff6
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | 228 | | |
230 | | - | |
| 229 | + | |
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
234 | | - | |
| 233 | + | |
235 | 234 | | |
236 | | - | |
| 235 | + | |
237 | 236 | | |
238 | 237 | | |
239 | 238 | | |
| |||
0 commit comments