Sha256: 0a9801c75656c9e0c90b0107e6027ac2c27f8212fe6b308e1df455a6910f8047

Contents?: true

Size: 1.09 KB

Versions: 18

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module LicenseFinder
  class Rebar < PackageManager
    def initialize(options = {})
      super
      @command = options[:rebar_command] || Rebar.package_management_command
      @deps_path = Pathname(options[:rebar_deps_dir] || 'deps')
    end

    def current_packages
      rebar_ouput.map do |name, version_type, version_value, homepage|
        RebarPackage.new(
          name,
          "#{version_type}: #{version_value}",
          install_path: @deps_path.join(name),
          homepage: homepage,
          logger: logger
        )
      end
    end

    def self.package_management_command
      'rebar'
    end

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

    private

    def rebar_ouput
      command = "#{@command} list-deps"
      stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
      raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?

      stdout
        .each_line
        .reject { |line| line.start_with?('=') }
        .map { |line| line.split(' ') }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
license_finder-6.0.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.11.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.11.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.10.2 lib/license_finder/package_managers/rebar.rb
license_finder-5.10.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.10.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.9.2 lib/license_finder/package_managers/rebar.rb
license_finder-5.9.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.9.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.8.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.7.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.7.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.6.2 lib/license_finder/package_managers/rebar.rb
license_finder-5.6.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.6.0 lib/license_finder/package_managers/rebar.rb
license_finder-5.5.2 lib/license_finder/package_managers/rebar.rb
license_finder-5.5.1 lib/license_finder/package_managers/rebar.rb
license_finder-5.5.0 lib/license_finder/package_managers/rebar.rb