Sha256: 062da7b1bd3f3f749ff97f0ceb29e647dbd0ef9b1f892aa893470fb413168046

Contents?: true

Size: 684 Bytes

Versions: 21

Compression:

Stored size: 684 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'] : 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

21 entries across 21 versions & 1 rubygems

Version Path
license_finder-6.2.0 lib/license_finder/packages/go_package.rb
license_finder-6.1.2 lib/license_finder/packages/go_package.rb
license_finder-6.1.0 lib/license_finder/packages/go_package.rb
license_finder-6.0.0 lib/license_finder/packages/go_package.rb
license_finder-5.11.1 lib/license_finder/packages/go_package.rb
license_finder-5.11.0 lib/license_finder/packages/go_package.rb
license_finder-5.10.2 lib/license_finder/packages/go_package.rb
license_finder-5.10.1 lib/license_finder/packages/go_package.rb
license_finder-5.10.0 lib/license_finder/packages/go_package.rb
license_finder-5.9.2 lib/license_finder/packages/go_package.rb
license_finder-5.9.1 lib/license_finder/packages/go_package.rb
license_finder-5.9.0 lib/license_finder/packages/go_package.rb
license_finder-5.8.0 lib/license_finder/packages/go_package.rb
license_finder-5.7.1 lib/license_finder/packages/go_package.rb
license_finder-5.7.0 lib/license_finder/packages/go_package.rb
license_finder-5.6.2 lib/license_finder/packages/go_package.rb
license_finder-5.6.1 lib/license_finder/packages/go_package.rb
license_finder-5.6.0 lib/license_finder/packages/go_package.rb
license_finder-5.5.2 lib/license_finder/packages/go_package.rb
license_finder-5.5.1 lib/license_finder/packages/go_package.rb