Class: LicenseFinder::Pipenv

Inherits:
PackageManager show all
Defined in:
lib/license_finder/package_managers/pipenv.rb

Instance Method Summary collapse

Methods inherited from PackageManager

#active?, #command_exists?, #current_packages_with_relations, #detected_package_path, id, #installed?, #package_management_command, #prepare, #prepare_command, #project_root?, takes_priority_over

Constructor Details

#initialize(options = {}) ⇒ Pipenv

Returns a new instance of Pipenv.



8
9
10
11
# File 'lib/license_finder/package_managers/pipenv.rb', line 8

def initialize(options = {})
  super
  @lockfile = Pathname('Pipfile.lock')
end

Instance Method Details

#current_packagesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/license_finder/package_managers/pipenv.rb', line 13

def current_packages
  @current_packages ||=
    begin
      packages = {}
      each_dependency(groups: allowed_groups) do |name, data, group|
        version = canonicalize(data['version'] || 'unknown')
        package = packages.fetch(key_for(name, version)) do |key|
          packages[key] = build_package_for(name, version)
        end
        package.groups << group
      end
      packages.values
    end
end

#possible_package_pathsObject



28
29
30
# File 'lib/license_finder/package_managers/pipenv.rb', line 28

def possible_package_paths
  project_path ? [project_path.join(@lockfile)] : [@lockfile]
end