Class: LicenseScout::DependencyManager::Cargo

Inherits:
Base
  • Object
show all
Defined in:
lib/license_scout/dependency_manager/cargo.rb

Instance Attribute Summary

Attributes inherited from Base

#directory

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from LicenseScout::DependencyManager::Base

Instance Method Details

#dependenciesObject


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/license_scout/dependency_manager/cargo.rb', line 43

def dependencies
  dependency_data.map do |crate_data|
    dep_name = crate_data["name"]
    dep_version = crate_data["version"]
    dep_license = crate_data["license"]

    dependency = new_dependency(dep_name, dep_version, nil)
    dependency.add_license(dep_license, "https://crates.io/crates/#{dep_name}/#{dep_version}")

    dependency
  end.compact
end

#detected?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/license_scout/dependency_manager/cargo.rb', line 39

def detected?
  File.exist?(cargo_file_path) && File.exist?(cargo_lockfile_path)
end

#install_commandObject


35
36
37
# File 'lib/license_scout/dependency_manager/cargo.rb', line 35

def install_command
  "cargo build"
end

#nameObject


23
24
25
# File 'lib/license_scout/dependency_manager/cargo.rb', line 23

def name
  "rust_cargo"
end

#signatureObject


31
32
33
# File 'lib/license_scout/dependency_manager/cargo.rb', line 31

def signature
  "Cargo and Cargo.lock files"
end

#typeObject


27
28
29
# File 'lib/license_scout/dependency_manager/cargo.rb', line 27

def type
  "rust"
end