class LicenseScout::DependencyManager::Base
Attributes
Public Class Methods
@param directory [String] The fully-qualified path to the directory to be inspected
# File lib/license_scout/dependency_manager/base.rb, line 42 def initialize(directory) @directory = directory @deps = nil end
Public Instance Methods
Implementation's of this method in sub-classes are the methods that are responsible for all the heavy-lifting when it comes to determining the dependencies (and their licenses). They should return an array of `LicenseScout::Dependency`.
@return [Array<LicenseScout::Dependency>]
# File lib/license_scout/dependency_manager/base.rb, line 97 def dependencies [] end
Whether or not we were able to detect that this dependency manager is currently in use in our directory
@return [Boolean]
# File lib/license_scout/dependency_manager/base.rb, line 81 def detected? raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#detected?` method") end
The command to run to install dependency if one or more is missing
@return [String]
# File lib/license_scout/dependency_manager/base.rb, line 88 def install_command raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#install_command` method") end
The unique name of this Dependency
Manager. In general, the name should follow the `<TYPE>_<NAME` pattern where:
* <TYPE> is the value of DependencyManager#type * <NAME> is the name of the dependency manager.
@example Go's various package managers
Name Reference -------- ----------------------------------------------- go_mod [`gomod`](https://golang.org/cmd/go/#hdr-The_go_mod_file) go_dep [`godep`](https://github.com/tools/godep) go_godep [`dep`](https://github.com/golang/dep) go_glide [`glide`](https://github.com/Masterminds/glide)
@return [String]
# File lib/license_scout/dependency_manager/base.rb, line 60 def name raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#name` method") end
A human-readable description of the files/folders that indicate this dependency manager is in use.
@return [String]
# File lib/license_scout/dependency_manager/base.rb, line 74 def signature raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#signature` method") end
The “type” of dependencies this manager manages. This can be the language, tool, etc.
@return [String]
# File lib/license_scout/dependency_manager/base.rb, line 67 def type raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#type` method") end
Private Instance Methods
A helper that allows you to quickly create a new Dependency
(with the type)
@param name [String] The name of the dependency @param version [String] The version of the dependency @param path [String] The path to the dependency on the local system
@return [LicenseScout::Dependency] @api private
# File lib/license_scout/dependency_manager/base.rb, line 111 def new_dependency(name, version, path) LicenseScout::Log.debug("[#{type}] Found #{name} #{version}#{" #{path}" unless path.nil?}") Dependency.new(name, version, path, type) end