Class: LicenseFinder::GoModules

Inherits:
PackageManager show all
Defined in:
lib/license_finder/package_managers/go_modules.rb

Constant Summary collapse

PACKAGES_FILE =
'go.mod'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PackageManager

#command_exists?, #current_packages_with_relations, #detected_package_path, id, #initialize, #installed?, #package_management_command, #prepare, #prepare_command, #project_root?

Constructor Details

This class inherits a constructor from LicenseFinder::PackageManager

Class Method Details

.takes_priority_overObject



10
11
12
# File 'lib/license_finder/package_managers/go_modules.rb', line 10

def takes_priority_over
  Go15VendorExperiment
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/license_finder/package_managers/go_modules.rb', line 15

def active?
  mod_files?
end

#current_packagesObject



19
20
21
22
23
24
25
26
27
# File 'lib/license_finder/package_managers/go_modules.rb', line 19

def current_packages
  packages = packages_info.map do |package|
    name, version, install_path = package.split(',')
    read_package(install_path, name, version) if install_path.to_s != ''
  end.compact
  packages.reject do |package|
    Pathname(package.install_path).cleanpath == Pathname(project_path).cleanpath
  end
end