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, #initialize, installed?, #prepare

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

.prepare_commandObject



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

def prepare_command
  'trash'
end

.takes_priority_overObject



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

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
# 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')
                              }, 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