Class: LicenseFinder::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/license_finder/package.rb

Overview

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 Method Summary collapse

Instance Method Summary collapse

Class Method Details

.license_names_from_standard_spec(spec) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/license_finder/package.rb', line 9

def self.license_names_from_standard_spec(spec)
  licenses = spec["licenses"] || [spec["license"]].compact
  licenses = [licenses] unless licenses.is_a?(Array)
  licenses.map do |license|
    if license.is_a? Hash
      license["type"]
    else
      license
    end
  end
end

Instance Method Details

#licenseObject



21
22
23
# File 'lib/license_finder/package.rb', line 21

def license
  @license ||= determine_license
end