Class: Licensed::Sources::Pipenv

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

Instance Attribute Summary

Attributes inherited from Source

#config

Instance Method Summary collapse

Methods inherited from Source

#dependencies, #ignored?, inherited, #initialize, type

Constructor Details

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

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/licensed/sources/pipenv.rb', line 6

def enabled?
  Licensed::Shell.tool_available?("pipenv") && File.exist?(@config.pwd.join("Pipfile.lock"))
end

#enumerate_dependenciesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/licensed/sources/pipenv.rb', line 10

def enumerate_dependencies
  pakages_from_pipfile_lock.map do |package_name|
    package = package_info(package_name)
    location = File.join(package["Location"], package["Name"].gsub("-", "_") +  "-" + package["Version"] + ".dist-info")
    Dependency.new(
      name: package["Name"],
      version: package["Version"],
      path: location,
      metadata: {
        "type"        => Pipenv.type,
        "summary"     => package["Summary"],
        "homepage"    => package["Home-page"]
      }
    )
  end
end