-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Deprecated] - Remove Dep package manager for jammy release
- Loading branch information
1 parent
da637b8
commit 42bed10
Showing
9 changed files
with
148 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'tomlrb' | ||
|
||
module LicenseFinder | ||
class Dep < PackageManager | ||
def possible_package_paths | ||
[project_path.join('Gopkg.lock')] | ||
end | ||
|
||
def current_packages | ||
toml = Tomlrb.load_file(detected_package_path) | ||
projects = toml['projects'] | ||
|
||
return [] if projects.nil? | ||
|
||
projects.map do |project| | ||
GoPackage.from_dependency({ | ||
'ImportPath' => project['name'], | ||
'InstallPath' => project_path.join('vendor', project['name']), | ||
'Rev' => project['revision'], | ||
'Homepage' => repo_name(project['name']) | ||
}, nil, true) | ||
end | ||
end | ||
|
||
def repo_name(name) | ||
name.split('/')[0..2].join('/') | ||
end | ||
|
||
def self.takes_priority_over | ||
Go15VendorExperiment | ||
end | ||
|
||
def prepare_command | ||
'dep ensure -vendor-only' | ||
end | ||
|
||
def package_management_command | ||
'dep' | ||
end | ||
end | ||
end | ||
# Dep has been deprecated since 2020 | ||
# | ||
# require 'tomlrb' | ||
# | ||
# module LicenseFinder | ||
# class Dep < PackageManager | ||
# def possible_package_paths | ||
# [project_path.join('Gopkg.lock')] | ||
# end | ||
# | ||
# def current_packages | ||
# toml = Tomlrb.load_file(detected_package_path) | ||
# projects = toml['projects'] | ||
# | ||
# return [] if projects.nil? | ||
# | ||
# projects.map do |project| | ||
# GoPackage.from_dependency({ | ||
# 'ImportPath' => project['name'], | ||
# 'InstallPath' => project_path.join('vendor', project['name']), | ||
# 'Rev' => project['revision'], | ||
# 'Homepage' => repo_name(project['name']) | ||
# }, nil, true) | ||
# end | ||
# end | ||
# | ||
# def repo_name(name) | ||
# name.split('/')[0..2].join('/') | ||
# end | ||
# | ||
# def self.takes_priority_over | ||
# Go15VendorExperiment | ||
# end | ||
# | ||
# def prepare_command | ||
# 'dep ensure -vendor-only' | ||
# end | ||
# | ||
# def package_management_command | ||
# 'dep' | ||
# end | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'fakefs/spec_helpers' | ||
|
||
module LicenseFinder | ||
describe Dep do | ||
it_behaves_like 'a PackageManager' | ||
describe '#current_packages' do | ||
subject { Dep.new(project_path: Pathname('/app'), logger: double(:logger, active: nil)) } | ||
let(:content) do | ||
FakeFS.without do | ||
fixture_from('gopkg.lock') | ||
end | ||
end | ||
|
||
it 'returns the packages described by Gopkg.lock' do | ||
FakeFS do | ||
FileUtils.mkdir_p '/app' | ||
File.write('/app/Gopkg.lock', content) | ||
expect(subject.current_packages.length).to eq 3 | ||
|
||
expect(subject.current_packages.first.name).to eq 'github.com/Bowery/prompt' | ||
expect(subject.current_packages.first.version).to eq '0f1139e9a1c74b57ccce6bdb3cd2f7cd04dd3449' | ||
|
||
expect(subject.current_packages[1].name).to eq 'github.com/dchest/safefile' | ||
expect(subject.current_packages[1].version).to eq '855e8d98f1852d48dde521e0522408d1fe7e836a' | ||
|
||
expect(subject.current_packages.last.name).to eq 'golang.org/x/sys' | ||
expect(subject.current_packages.last.version).to eq 'ebfc5b4631820b793c9010c87fd8fef0f39eb082' | ||
end | ||
end | ||
|
||
context 'the package does not have any projects in its toml' do | ||
before do | ||
allow(Tomlrb).to receive(:load_file).and_return({}) | ||
end | ||
|
||
it 'should return an empty array' do | ||
expect(subject.current_packages).to eq([]) | ||
end | ||
end | ||
end | ||
|
||
describe '.prepare_command' do | ||
subject { Dep.new(project_path: Pathname('/app'), logger: double(:logger, active: nil)) } | ||
it 'returns the correct prepare method' do | ||
expect(subject.prepare_command).to eq('dep ensure -vendor-only') | ||
end | ||
end | ||
|
||
describe '.package_management_command' do | ||
it 'returns the correct package management command' do | ||
expect(subject.package_management_command).to eq('dep') | ||
end | ||
end | ||
end | ||
end | ||
# Dep has been deprecated since 2020 | ||
|
||
# require 'spec_helper' | ||
# require 'fakefs/spec_helpers' | ||
# | ||
# module LicenseFinder | ||
# describe Dep do | ||
# it_behaves_like 'a PackageManager' | ||
# describe '#current_packages' do | ||
# subject { Dep.new(project_path: Pathname('/app'), logger: double(:logger, active: nil)) } | ||
# let(:content) do | ||
# FakeFS.without do | ||
# fixture_from('gopkg.lock') | ||
# end | ||
# end | ||
# | ||
# it 'returns the packages described by Gopkg.lock' do | ||
# FakeFS do | ||
# FileUtils.mkdir_p '/app' | ||
# File.write('/app/Gopkg.lock', content) | ||
# expect(subject.current_packages.length).to eq 3 | ||
# | ||
# expect(subject.current_packages.first.name).to eq 'github.com/Bowery/prompt' | ||
# expect(subject.current_packages.first.version).to eq '0f1139e9a1c74b57ccce6bdb3cd2f7cd04dd3449' | ||
# | ||
# expect(subject.current_packages[1].name).to eq 'github.com/dchest/safefile' | ||
# expect(subject.current_packages[1].version).to eq '855e8d98f1852d48dde521e0522408d1fe7e836a' | ||
# | ||
# expect(subject.current_packages.last.name).to eq 'golang.org/x/sys' | ||
# expect(subject.current_packages.last.version).to eq 'ebfc5b4631820b793c9010c87fd8fef0f39eb082' | ||
# end | ||
# end | ||
# | ||
# context 'the package does not have any projects in its toml' do | ||
# before do | ||
# allow(Tomlrb).to receive(:load_file).and_return({}) | ||
# end | ||
# | ||
# it 'should return an empty array' do | ||
# expect(subject.current_packages).to eq([]) | ||
# end | ||
# end | ||
# end | ||
# | ||
# describe '.prepare_command' do | ||
# subject { Dep.new(project_path: Pathname('/app'), logger: double(:logger, active: nil)) } | ||
# it 'returns the correct prepare method' do | ||
# expect(subject.prepare_command).to eq('dep ensure -vendor-only') | ||
# end | ||
# end | ||
# | ||
# describe '.package_management_command' do | ||
# it 'returns the correct package management command' do | ||
# expect(subject.package_management_command).to eq('dep') | ||
# end | ||
# end | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters