Sha256: 80887aea6daba3b0af2cb981389eef91180d723b99ccd2519ea976a25afbe106
Contents?: true
Size: 852 Bytes
Versions: 2
Compression:
Stored size: 852 Bytes
Contents
module Hrw module Scanner class PackageLock attr_reader :package_manager # Class constructor # # @param [String] root The path to the project root # @param [String] lockfile # The name for the lock file, default is `Pipfile.lock` def initialize(root = Dir.pwd, lockfile = 'package-lock.json') @package_manager = 'npm' @root = root @lockfile = lockfile end # Scan the lock file # @return [Hash] Dependencies def scan deps = [] obj = JSON.parse(File.read(File.join(@root, @lockfile))) return deps unless obj.key?('dependencies') obj['dependencies'].each_pair do |name, pkg| deps << { name: name, version: pkg['version'] } end deps end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hrw-0.3.9 | lib/hrw/scanner/package_lock.rb |
hrw-0.3.8 | lib/hrw/scanner/package_lock.rb |