Skip to content

Commit

Permalink
[Fixed] Reporting extra paths for gvt projects
Browse files Browse the repository at this point in the history
Signed-off-by: Debbie Chen <dechen@pivotal.io>
  • Loading branch information
xtreme-shane-lattanzio authored and xtreme-debbie-chen committed May 24, 2019
1 parent ad1ebf4 commit ba7d1bd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
5 changes: 2 additions & 3 deletions lib/license_finder/package_managers/gvt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
module LicenseFinder
class Gvt < PackageManager
def possible_package_paths
potential_path_list = Dir.glob project_path.join('*', 'vendor', 'manifest')
potential_path_list << project_path.join('vendor', 'manifest')
potential_path_list.map { |path| Pathname path }
potential_path = project_path.join('vendor', 'manifest')
[Pathname(potential_path)]
end

def self.package_management_command
Expand Down
File renamed without changes.
24 changes: 0 additions & 24 deletions spec/lib/license_finder/package_managers/gvt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,6 @@ module LicenseFinder
FakeFS.deactivate!
end

context 'when the \'vendor\' folder is nested in another folder' do
include FakeFS::SpecHelpers
it 'returns the packages described by \'gvt list\'' do
FileUtils.mkdir_p '/app/anything/vendor'
File.write('/app/anything/vendor/manifest', content)
allow(SharedHelpers::Cmd).to receive(:run).with('cd anything && gvt list -f "{{.Importpath}} {{.Revision}} {{.Repository}}"') do
["my-package-name 123abc example.com\npackage-name-2 456xyz anotherurl.com", '', cmd_success]
end
expect(subject.current_packages.length).to eq 2

first = subject.current_packages.first
expect(first.name).to eq 'my-package-name'
expect(first.install_path).to eq Pathname('/app/anything/vendor/my-package-name')
expect(first.version).to eq '123abc'
expect(first.homepage).to eq 'example.com'

last = subject.current_packages.last
expect(last.name).to eq 'package-name-2'
expect(last.install_path).to eq Pathname('/app/anything/vendor/package-name-2')
expect(last.version).to eq '456xyz'
expect(last.homepage).to eq 'anotherurl.com'
end
end

context 'when the \'vendor\' folder is not nested in another folder' do
include FakeFS::SpecHelpers
it "returns the packages described by 'gvt list'" do
Expand Down

0 comments on commit ba7d1bd

Please sign in to comment.