Class: Licensed::Sources::Pip

Inherits:
Source
  • Object
show all
Defined in:
lib/licensed/sources/pip.rb

Direct Known Subclasses

Pipenv

Constant Summary collapse

PACKAGE_INFO_SEPARATOR =
"\n---\n"

Instance Attribute Summary

Attributes inherited from Source

#config

Instance Method Summary collapse

Methods inherited from Source

#dependencies, full_type, #ignored?, inherited, #initialize, register_source, require_matched_dependency_version, #source_config, type, type_and_version

Constructor Details

This class inherits a constructor from Licensed::Sources::Source

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/licensed/sources/pip.rb', line 12

def enabled?
  !pip_command.empty? && Licensed::Shell.tool_available?(pip_command.join(""))
end

#enumerate_dependenciesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/licensed/sources/pip.rb', line 16

def enumerate_dependencies
  packages.map do |package|
    Dependency.new(
      name: package["Name"],
      version: package["Version"],
      path: package_license_location(package),
      metadata: {
        "type"        => self.class.type,
        "summary"     => package["Summary"],
        "homepage"    => package["Home-page"]
      }
    )
  end
end