Sha256: bf3d66ba1bf9878269f01b52fd9f899d596ddacea43176cb67e6210d3280786a
Contents?: true
Size: 719 Bytes
Versions: 1
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true require 'bundler' require "bundled_gem/version" module BundledGem class LockfileReader LOCKFILE = "Gemfile.lock" def initialize(lockfile: LOCKFILE) @lockfile_content = File.read(lockfile) end # Parse `Gemfile.lock` and Retrieve specs def lockfile_specs lockfile.specs end # Get version info from `Gemfile.lock` def get_version(gem) lockfile_specs.find{ |s| s.name == gem }&.version end # Check gem is listed in `Gemfile.lock` def gem_listed?(gem) lockfile_specs.map(&:name).include? gem end private def lockfile @lockfile ||= ::Bundler::LockfileParser.new(@lockfile_content) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bundled_gems-0.0.4 | lib/bundled_gems.rb |