Class: LicenseFinder::Pip
- Inherits:
-
Object
- Object
- LicenseFinder::Pip
- Defined in:
- lib/license_finder/package_managers/pip.rb
Constant Summary collapse
- GET_DEPENDENCIES_PY =
<<-PYTHON.gsub(/\n+/, ";") from pip.util import get_installed_distributions dists = [(x.project_name, x.version, x.location) for x in get_installed_distributions()] dists = ["[\\\"{0}\\\", \\\"{1}\\\", \\\"{2}\\\"]".format(*dist) for dist in dists] print "[" + ",".join(dists) + "]" PYTHON
Class Method Summary collapse
Class Method Details
.active? ⇒ Boolean
28 29 30 |
# File 'lib/license_finder/package_managers/pip.rb', line 28 def self.active? requirements_path.exist? end |
.current_packages ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/license_finder/package_managers/pip.rb', line 15 def self.current_packages output = `python -c '#{GET_DEPENDENCIES_PY}'` JSON(output).map do |(name, version, install_dir)| PipPackage.new( name, version, File.join(install_dir, name), pypi_def(name, version) ) end end |