Sha256: 71e891d8bb3a9845267501cc0ff909008d25869539b6c76bed7bd65b7ba292eb

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

module LicenseFinder
  class PipPackage < Package
    def self.license_names_from_spec(spec)
      license = spec["license"]

      return [license] if license && license != "UNKNOWN"

      spec.
        fetch("classifiers", []).
        select { |c| c.start_with?("License") }.
        map { |c| c.gsub(/^License.*::\s*(.*)$/, '\1') }
    end

    def initialize(name, version, install_path, spec, options={})
      super(
        name,
        version,
        options.merge(
          summary: spec["summary"],
          description: spec["description"],
          homepage: spec["home_page"],
          spec_licenses: self.class.license_names_from_spec(spec),
          install_path: install_path
        )
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
license_finder-2.0.0.rc2 lib/license_finder/package_managers/pip_package.rb