Sha256: bdbe8a31f7c1e8e286b980f2d97d78d775ba0d6f1179bce26479d498660dd52a

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

module LicenseFinder
  # Super-class that adapts data from different package management
  # systems (gems, npm, pip, etc.) to a common interface.
  #
  # For guidance on adding a new system use the shared behavior
  #     it_behaves_like "it conforms to interface required by PackageSaver"
  # and see BundlerPackage, PipPackage and NpmPackage
  class Package
    def license
      @license ||= determine_license
    end

    private

    def determine_license
      license_from_spec || license_from_files || default_license
    end

    def license_from_files
      license_files.map(&:license).compact.first
    end

    def license_files
      PossibleLicenseFiles.find(install_path)
    end

    def default_license
      "other"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
license_finder-0.9.5.1-java lib/license_finder/package.rb
license_finder-0.9.5.1 lib/license_finder/package.rb
license_finder-0.9.5 lib/license_finder/package.rb
license_finder-0.9.5-java lib/license_finder/package.rb