Class: LicenseFinder::GoPackage

Inherits:
Package
  • Object
show all
Defined in:
lib/license_finder/packages/go_package.rb

Instance Attribute Summary

Attributes inherited from Package

#authors, #children, #description, #groups, #homepage, #install_path, #license_names_from_spec, #logger, #manual_approval, #name, #parents, #summary, #version

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Package

#<=>, #activations, #approved?, #approved_manually!, #approved_manually?, #decide_on_license, #eql?, #hash, #initialize, #license_files, license_names_from_standard_spec, #licenses, #licenses_from_spec, #licensing, #log_activation, #missing?, #notice_files, #permitted!, #permitted?, #restricted!, #restricted?

Constructor Details

This class inherits a constructor from LicenseFinder::Package

Class Method Details

.from_dependency(hash, prefix, full_version) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/license_finder/packages/go_package.rb', line 14

def from_dependency(hash, prefix, full_version)
  name = hash['ImportPath']
  install_path = hash['InstallPath']
  install_path ||= install_path(prefix.join(name))
  version = full_version ? hash['Rev'].gsub('+incompatible', '') : hash['Rev'][0..6]
  homepage = hash['Homepage']
  new(name, version, install_path: install_path, package_manager: 'Go', homepage: homepage)
end

Instance Method Details

#package_managerObject



5
6
7
# File 'lib/license_finder/packages/go_package.rb', line 5

def package_manager
  'Go'
end

#package_urlObject



9
10
11
# File 'lib/license_finder/packages/go_package.rb', line 9

def package_url
  "https://pkg.go.dev/#{CGI.escape(name)}@#{CGI.escape(version)}"
end