Class: LicenseFinder::Cargo

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

Instance Method Summary collapse

Methods inherited from PackageManager

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

Constructor Details

This class inherits a constructor from LicenseFinder::PackageManager

Instance Method Details

#current_packagesObject



7
8
9
10
11
12
# File 'lib/license_finder/package_managers/cargo.rb', line 7

def current_packages
  cargo_output.map do |package|
    path = Dir.glob("#{Dir.home}/.cargo/registry/src/*/#{package['name']}-#{package['version']}").first
    CargoPackage.new(package, logger: logger, install_path: path)
  end
end

#package_management_commandObject



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

def package_management_command
  'cargo'
end

#possible_package_pathsObject



22
23
24
# File 'lib/license_finder/package_managers/cargo.rb', line 22

def possible_package_paths
  [project_path.join('Cargo.lock'), project_path.join('Cargo.toml')]
end

#prepare_commandObject



18
19
20
# File 'lib/license_finder/package_managers/cargo.rb', line 18

def prepare_command
  'cargo fetch'
end