diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-07 15:03:26 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-07 15:03:26 -0700 |
| commit | bc29a9d7a98fab7de435d8a06007197efa189709 (patch) | |
| tree | d43e6817b3e392059f6b6481cd54f713edd7127e /lib | |
| parent | 5f7786bb4865a9d9622c3819d8e0b5b67ebf0cfa (diff) | |
Fix nuget specs
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/license/management.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/license/management.rb b/lib/license/management.rb index 37fe1a0..9003ab1 100644 --- a/lib/license/management.rb +++ b/lib/license/management.rb @@ -12,6 +12,36 @@ require 'license/management/version' # This applies a monkey patch to the JsonReport found in the `license_finder` gem. LicenseFinder::JsonReport.prepend(License::Management::Report) +module LicenseFinder + class Nuget + def prepare_command + "mono /usr/local/bin/nuget.exe restore -Verbosity detailed" + end + + def license_urls(dependency) + filename = "#{dependency.name}.#{dependency.version}.nupkg" + files = Dir["**/#{filename}"] + + Dir.glob(File.join(Dir.home, '.nuget', 'packages', '**', '**', filename.downcase)) + + return if files.empty? + + Zip::File.open(files.first) do |zipfile| + Nuget.nuspec_license_urls(zipfile.read(dependency.name + '.nuspec')) + end + end + end + + module SharedHelpers + class Cmd + def self.run(command) + stdout, stderr, status = Open3.capture3(command) + puts command + puts stdout + [stdout, stderr, status] + end + end + end +end module License module Management |
