Class: LicenseFinder::GoModules
Constant Summary
collapse
- PACKAGES_FILE =
'go.sum'
Class Method Summary
collapse
Instance Method Summary
collapse
command_exists?, #current_packages_with_relations, #detected_package_path, #initialize, installed?, package_management_command, #prepare, #project_root?
Class Method Details
.takes_priority_over ⇒ Object
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
19
20
21
|
# File 'lib/license_finder/package_managers/go_modules.rb', line 19
def active?
sum_files?
end
|
#current_packages ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/license_finder/package_managers/go_modules.rb', line 23
def current_packages
info_output, _stderr, _status = Cmd.run("GO111MODULE=on go list -m -mod=vendor -f '{{.Path}},{{.Version}},{{.Dir}}' all")
packages_info = info_output.split("\n")
packages = packages_info.map do |package|
name, version, install_path = package.split(',')
read_package(install_path, name, version)
end
packages.reject do |package|
Pathname(package.install_path).cleanpath == Pathname(project_path).cleanpath
end
end
|
#prepare_command ⇒ Object
15
16
17
|
# File 'lib/license_finder/package_managers/go_modules.rb', line 15
def prepare_command
'GO111MODULE=on go mod tidy && GO111MODULE=on go mod vendor'
end
|