Sha256: d3257639e456dcaeeb87658f4f8dfb5a992cc22c49e47f8b25750f76438c6e17
Contents?: true
Size: 893 Bytes
Versions: 12
Compression:
Stored size: 893 Bytes
Contents
# # Third-party libraries # require 'bundler' require 'bundler/lockfile_parser' module Hrw module Scanner # # Used to scan gem lock file # class Gemfile attr_reader :package_manager # Initialize a scanner # # @param [String] root The path to the project root # @param [String] lockfile # The name for the lock file, default is `Gemfile.lock` def initialize(root = Dir.pwd, lockfile = 'Gemfile.lock') @package_manager = 'rubygems' @root = File.expand_path(root) @lockfile = Bundler::LockfileParser.new( File.read(File.join(@root, lockfile)) ) end # Scan the lock file # @return [Hash] def scan @lockfile.specs.map do |spec| { name: spec.name, version: spec.version.to_s } end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems