Class: LicenseFinder::Dep

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PackageManager

#active?, #command_exists?, #current_packages_with_relations, #detected_package_path, id, #initialize, #installed?, #prepare, #project_root?

Constructor Details

This class inherits a constructor from LicenseFinder::PackageManager

Class Method Details

.takes_priority_overObject



31
32
33
# File 'lib/license_finder/package_managers/dep.rb', line 31

def self.takes_priority_over
  Go15VendorExperiment
end

Instance Method Details

#current_packagesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/license_finder/package_managers/dep.rb', line 11

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

#package_management_commandObject



39
40
41
# File 'lib/license_finder/package_managers/dep.rb', line 39

def package_management_command
  'dep'
end

#possible_package_pathsObject



7
8
9
# File 'lib/license_finder/package_managers/dep.rb', line 7

def possible_package_paths
  [project_path.join('Gopkg.lock')]
end

#prepare_commandObject



35
36
37
# File 'lib/license_finder/package_managers/dep.rb', line 35

def prepare_command
  'dep ensure -vendor-only'
end

#repo_name(name) ⇒ Object



27
28
29
# File 'lib/license_finder/package_managers/dep.rb', line 27

def repo_name(name)
  name.split('/')[0..2].join('/')
end