Class: LicenseFinder::Rebar

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

Instance Method Summary collapse

Methods inherited from PackageManager

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

Constructor Details

#initialize(options = {}) ⇒ Rebar

Returns a new instance of Rebar.



5
6
7
8
9
# File 'lib/license_finder/package_managers/rebar.rb', line 5

def initialize(options = {})
  super
  @command = options[:rebar_command] || package_management_command
  @deps_path = Pathname(options[:rebar_deps_dir] || File.join(project_path, '_build/default/lib'))
end

Instance Method Details

#current_packagesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/license_finder/package_managers/rebar.rb', line 11

def current_packages
  rebar_deps.map do |name, version|
    licenses, homepage = dep_info(name)
    RebarPackage.new(
      name,
      version,
      install_path: @deps_path.join(name),
      homepage: homepage,
      spec_licenses: licenses.nil? ? [] : [licenses],
      logger: logger
    )
  end
end

#package_management_commandObject



25
26
27
# File 'lib/license_finder/package_managers/rebar.rb', line 25

def package_management_command
  'rebar3'
end

#possible_package_pathsObject



29
30
31
# File 'lib/license_finder/package_managers/rebar.rb', line 29

def possible_package_paths
  [project_path.join('rebar.config')]
end