Sha256: ad752abd66ee25b4b76977b6ad92cefb6ea94e98358503545f3f1ffbd7f193c7

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

Stored size: 536 Bytes

Contents

require 'json'

module LicenseFinder
  class GoDep < PackageManager
    def current_packages
      json = JSON.parse(package_path.read)
      json['Deps'].map { |dep| GoPackage.from_dependency(dep, install_prefix) }
    end

    def package_path
      project_path.join('Godeps/Godeps.json')
    end

    private

    def install_prefix
      go_path = workspace_dir.exist? ? workspace_dir : Pathname(ENV['GOPATH'])
      go_path.join('src')
    end

    def workspace_dir
      project_path.join('Godeps/_workspace')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-2.1.0.rc2 lib/license_finder/package_managers/go_dep.rb
license_finder-2.1.0.rc1 lib/license_finder/package_managers/go_dep.rb