Sha256: 7b4327c4d295b9568c0395765c42749b5ebeacc42e9de9effa713947bf09958c
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'json' module LicenseFinder class GoDep < PackageManager def initialize(options = {}) super @full_version = options[:go_full_version] end def current_packages json = JSON.parse(detected_package_path.read) # godep includes subpackages as a seperate dependency, we can de-dup that dependencies_info = json['Deps'].map do |dep_json| { 'Homepage' => homepage(dep_json), 'ImportPath' => import_path(dep_json), 'InstallPath' => dep_json['InstallPath'], 'Rev' => dep_json['Rev'] } end dependencies_info.uniq.map do |info| GoPackage.from_dependency(info, install_prefix, @full_version) end end def self.takes_priority_over Go15VendorExperiment end def possible_package_paths [project_path.join('Godeps/Godeps.json')] end def self.package_management_command 'godep' end private def install_prefix go_path = if workspace_dir.directory? workspace_dir else Pathname(ENV['GOPATH'] || ENV['HOME'] + '/go') end go_path.join('src') end def workspace_dir project_path.join('Godeps/_workspace') end def homepage(dependency_json) import_path dependency_json end def import_path(dependency_json) import_path = dependency_json['ImportPath'] return import_path unless import_path.include?('github.com') import_path.split('/')[0..2].join('/') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
license_finder-5.4.1 | lib/license_finder/package_managers/go_dep.rb |