Sha256: c6288f03414c7d914f47d9ee02dbec5f104d37b6748be0f5ab1ba5ef16390c43

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'tomlrb'

module LicenseFinder
  class Dep < PackageManager
    def possible_package_paths
      [project_path.join('Gopkg.lock')]
    end

    def current_packages
      toml = Tomlrb.load_file(detected_package_path)
      projects = toml['projects']

      return [] if projects.nil?

      projects.map do |project|
        GoPackage.from_dependency({
                                    'ImportPath' => project['name'],
                                    'InstallPath' => project_path.join('vendor', project['name']),
                                    'Rev' => project['revision'],
                                    'Homepage' => repo_name(project['name'])
                                  }, nil, true)
      end
    end

    def repo_name(name)
      name.split('/')[0..2].join('/')
    end

    def self.takes_priority_over
      Go15VendorExperiment
    end

    def prepare_command
      'dep ensure -vendor-only'
    end

    def package_management_command
      'dep'
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/package_managers/dep.rb
license_finder-7.0.1 lib/license_finder/package_managers/dep.rb
license_finder-7.0.0 lib/license_finder/package_managers/dep.rb
license_finder-6.15.0 lib/license_finder/package_managers/dep.rb
gitlab-license_finder-6.14.2.1 lib/license_finder/package_managers/dep.rb
license_finder-6.14.2 lib/license_finder/package_managers/dep.rb
license_finder-6.14.1 lib/license_finder/package_managers/dep.rb
license_finder-6.13.0 lib/license_finder/package_managers/dep.rb
license_finder-6.12.2 lib/license_finder/package_managers/dep.rb
license_finder-6.12.1 lib/license_finder/package_managers/dep.rb
license_finder-6.12.0 lib/license_finder/package_managers/dep.rb