Class: LicenseFinder::Trash

Inherits:
PackageManager show all
Defined in:
lib/license_finder/package_managers/trash.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?, #package_management_command, #prepare, #project_root?

Constructor Details

This class inherits a constructor from LicenseFinder::PackageManager

Class Method Details

.package_management_commandObject



6
7
8
# File 'lib/license_finder/package_managers/trash.rb', line 6

def package_management_command
  'trash'
end

.takes_priority_overObject



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

def takes_priority_over
  Go15VendorExperiment
end

Instance Method Details

#current_packagesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/license_finder/package_managers/trash.rb', line 23

def current_packages
  dependencies_path = project_path.join('trash.lock')

  YAML.load_file(dependencies_path).fetch('import').map do |package_hash|
    import_path = package_hash.fetch('package')
    license_path = project_path.join('vendor', import_path)

    GoPackage.from_dependency({
                                'ImportPath' => import_path,
                                'InstallPath' => license_path,
                                'Rev' => package_hash.fetch('version'),
                                'Homepage' => repo_name(import_path)
                              }, nil, true)
  end
end

#possible_package_pathsObject



19
20
21
# File 'lib/license_finder/package_managers/trash.rb', line 19

def possible_package_paths
  [project_path.join('vendor.conf')]
end

#prepare_commandObject



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

def prepare_command
  'trash'
end

#repo_name(name) ⇒ Object



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

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