Class: GemChangelogDiff::LockfileParser
- Inherits:
-
Object
- Object
- GemChangelogDiff::LockfileParser
- Defined in:
- lib/gem_changelog_diff/lockfile_parser.rb
Overview
Detects outdated gems by comparing Gemfile.lock specs to RubyGems.
Instance Method Summary collapse
-
#detect(lockfile_path: "Gemfile.lock") ⇒ Array<OutdatedGem>
Parses the lockfile and returns gems with newer versions available.
-
#initialize(rubygems_client: RubygemsClient.new) ⇒ LockfileParser
constructor
A new instance of LockfileParser.
Constructor Details
#initialize(rubygems_client: RubygemsClient.new) ⇒ LockfileParser
Returns a new instance of LockfileParser.
8 9 10 |
# File 'lib/gem_changelog_diff/lockfile_parser.rb', line 8 def initialize(rubygems_client: RubygemsClient.new) @rubygems_client = rubygems_client end |
Instance Method Details
#detect(lockfile_path: "Gemfile.lock") ⇒ Array<OutdatedGem>
Parses the lockfile and returns gems with newer versions available.
16 17 18 19 20 21 22 |
# File 'lib/gem_changelog_diff/lockfile_parser.rb', line 16 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 |