Class: LicenseScout::DependencyManager::Rebar
- Defined in:
- lib/license_scout/dependency_manager/rebar.rb
Instance Attribute Summary collapse
-
#packaged_dependencies ⇒ Object
readonly
Returns the value of attribute packaged_dependencies.
Attributes inherited from Base
Instance Method Summary collapse
- #dependencies ⇒ Object
- #detected? ⇒ Boolean
-
#initialize(directory) ⇒ Rebar
constructor
A new instance of Rebar.
- #install_command ⇒ Object
- #name ⇒ Object
- #signature ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(directory) ⇒ Rebar
Returns a new instance of Rebar.
26 27 28 29 30 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 26 def initialize(directory) super(directory) @packaged_dependencies = {} end |
Instance Attribute Details
#packaged_dependencies ⇒ Object (readonly)
Returns the value of attribute packaged_dependencies.
24 25 26 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 24 def packaged_dependencies @packaged_dependencies end |
Instance Method Details
#dependencies ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 52 def dependencies # Some dependencies are obtained via 'pkg' identifier of rebar. These # dependencies include their version in the rebar.lock file. Here we # parse the rebar.lock and remember all the versions we find. parse_packaged_dependencies Dir.glob("#{project_deps_dir}/*").map do |dep_dir| next unless File.directory?(dep_dir) dep_name = File.basename(dep_dir) # First check if this dependency is coming from the parent software. # If so we do not need to worry about its version or licenses because # it will be covered under the parent software's license. next if File.directory?(File.join(directory, "apps", dep_name)) # Or skip if the dep name is the project name next if File.exist?(File.join(directory, "_build/default/rel", dep_name)) # While determining the dependency version we first check the cache we # built from rebar.lock for the dependencies that come via 'pkg' # keyword. If this information is not available we try to determine # the dependency version via git. dep_version = if packaged_dependencies.key?(dep_name) packaged_dependencies[dep_name] else git_rev_parse(dep_dir) end new_dependency(dep_name, dep_version, dep_dir) end.compact end |
#detected? ⇒ Boolean
48 49 50 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 48 def detected? File.exist?() end |
#install_command ⇒ Object
44 45 46 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 44 def install_command "rebar get-deps" end |
#name ⇒ Object
32 33 34 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 32 def name "erlang_rebar" end |
#signature ⇒ Object
40 41 42 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 40 def signature "rebar.config file" end |
#type ⇒ Object
36 37 38 |
# File 'lib/license_scout/dependency_manager/rebar.rb', line 36 def type "erlang" end |