Class: GemChangelogDiff::LockfileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_changelog_diff/lockfile_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(rubygems_client: RubygemsClient.new) ⇒ LockfileParser

Returns a new instance of LockfileParser.



7
8
9
# File 'lib/gem_changelog_diff/lockfile_parser.rb', line 7

def initialize(rubygems_client: RubygemsClient.new)
  @rubygems_client = rubygems_client
end

Instance Method Details

#detect(lockfile_path: "Gemfile.lock") ⇒ Object



11
12
13
14
15
16
17
# File 'lib/gem_changelog_diff/lockfile_parser.rb', line 11

def detect(lockfile_path: "Gemfile.lock")
  content = File.read(lockfile_path)
  parser = Bundler::LockfileParser.new(content)
  find_outdated(parser.specs)
rescue Errno::ENOENT
  raise Error, "Lockfile not found: #{lockfile_path}"
end