Sha256: 50a30f40fe499b89842c7809c328a62234fa9f3dda8e5329b201464d33aaa5d0
Contents?: true
Size: 819 Bytes
Versions: 3
Compression:
Stored size: 819 Bytes
Contents
# # Third-party libraries # require 'bundler' require 'bundler/lockfile_parser' module Hrw module Scanner # # Used to scan gem lock file # class Gemfile # 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') @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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hrw-0.2.1 | lib/hrw/scanner/gemfile.rb |
hrw-0.2.0 | lib/hrw/scanner/gemfile.rb |
hrw-0.1.0 | lib/hrw/scanner/gemfile.rb |