Sha256: 1c2f7806a6c93a38d1ff30a582d9f26e4728864c9685d6aec419776fcc0f4059

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

require 'license_finder/package'

module LicenseFinder
  class GoPackage < Package
    def package_manager
      'Go'
    end

    class << self
      def from_dependency(hash, prefix, full_version)
        name = hash['ImportPath']
        install_path = hash['InstallPath']
        install_path ||= install_path(prefix.join(name))
        version = full_version ? hash['Rev'].gsub('+incompatible', '') : hash['Rev'][0..6]
        homepage = hash['Homepage']
        new(name, version, install_path: install_path, package_manager: 'Go', homepage: homepage)
      end

      private

      def install_path(path)
        Pathname(path).cleanpath.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
license_finder-6.3.0 lib/license_finder/packages/go_package.rb