Skip to content

Commit a3dd3c0

Browse files
committed
Use Bundler.load.specs instead of reading Gemfile.lock
1 parent 2d3f7c5 commit a3dd3c0

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

lib/tapioca/commands/annotations.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ def execute
4141

4242
#: -> Array[GemInfo]
4343
def list_gemfile_gems
44-
say("Listing gems from Gemfile.lock... ", [:blue, :bold])
45-
gemfile = Bundler.read_file("Gemfile.lock")
46-
parser = Bundler::LockfileParser.new(gemfile)
47-
gem_info = parser.specs.map { |spec| GemInfo.from_spec(spec) }
44+
say("Listing gems from bundle... ", [:blue, :bold])
45+
specs = Bundler.load.specs
46+
gem_info = specs.map { |spec| GemInfo.from_spec(spec) }
4847
say("Done", :green)
4948
gem_info
5049
end

lib/tapioca/gem_info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class GemInfo < T::Struct
99
class << self
1010
extend(T::Sig)
1111

12-
#: (Bundler::LazySpecification spec) -> GemInfo
12+
#: (Gem::Specification spec) -> GemInfo
1313
def from_spec(spec)
1414
new(name: spec.name, version: spec.version)
1515
end

spec/tapioca/cli/annotations_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AnnotationsTest < SpecWithProject
2222

2323
assert_stdout_equals(<<~OUT, result)
2424
Retrieving index from central repository... Done
25-
Listing gems from Gemfile.lock... Done
25+
Listing gems from bundle... Done
2626
Removing annotations for gems that have been removed... Nothing to do
2727
Fetching gem annotations from central repository... Nothing to do
2828
OUT

0 commit comments

Comments
 (0)