Class: LicenseScout::DependencyManager::Mix
- Defined in:
- lib/license_scout/dependency_manager/mix.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) ⇒ Mix
constructor
A new instance of Mix.
- #install_command ⇒ Object
- #name ⇒ Object
- #signature ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(directory) ⇒ Mix
Returns a new instance of Mix.
26 27 28 29 30 |
# File 'lib/license_scout/dependency_manager/mix.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/mix.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 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 52 def dependencies parse_packaged_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. packaged_dependencies.map do |dep_name, dep_version| dep_path = Dir.glob(File.join(directory, "**", "deps", dep_name)).first dependency = new_dependency(dep_name, dep_version, dep_path) Array(hex_info(dep_name).dig("meta", "licenses")).each do |license| dependency.add_license(license, "https://hex.pm/api/packages/#{dep_name}") end dependency end.compact end |
#detected? ⇒ Boolean
48 49 50 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 48 def detected? File.exist?(mix_lock_path) end |
#install_command ⇒ Object
44 45 46 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 44 def install_command "mix deps.get" end |
#name ⇒ Object
32 33 34 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 32 def name "elixir_mix" end |
#signature ⇒ Object
40 41 42 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 40 def signature "mix.lock file" end |
#type ⇒ Object
36 37 38 |
# File 'lib/license_scout/dependency_manager/mix.rb', line 36 def type "elixir" end |