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



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

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



7
8
9
# File 'lib/license_finder/packages/go_package.rb', line 7

def package_manager
  'Go'
end

#package_urlObject



11
12
13
# File 'lib/license_finder/packages/go_package.rb', line 11

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