license_finder 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b89e81bf9762d6270dbe27ac9b6fd761c72e632
4
- data.tar.gz: 209a586dd42f207bb7036ad500b47ed96f77680c
3
+ metadata.gz: 97a98ebf99d7ffa7add150f9535d3470c19ca3b7
4
+ data.tar.gz: 556f7292ccfc2680808fe56e640b6f796ca6cf7d
5
5
  SHA512:
6
- metadata.gz: f7c4a0d0c0822c4e98b1389c08f01e78f8615f7db41a8d666c12d4d5a448f0a34c57659e4af2864f142c3e856f03a7e00d90706a77961824163786a001ac52d4
7
- data.tar.gz: 57311b8fef2641b63b76af1e867cb91789da2c197ead56c9a8bb1d6173acddba0e752ae3c112f2f3ebc845a36d03e4dd1010fc18a5a61d4184517e528185b7ff
6
+ metadata.gz: 0479b1b8712313d04e79f4e67fd8907ecb4bd8c56a9e4f0135894fdff6ce6973b4e6d153bc34341bc6442d7b9ebb07f542d66d3893122d8547b4bcf01fe014ef
7
+ data.tar.gz: feabe7ffe099290471374e30a5db5997446e7dc6a3bfeee9be2efa4c0cf71f5fb4195c3e9a45f8e0eaa32102ba910aaf4377399684f67160cc5c79e6b28be2f3
@@ -1,3 +1,5 @@
1
+ sudo: false
2
+
1
3
  rvm:
2
4
  - 1.9.3
3
5
  - 2.0
@@ -1,3 +1,15 @@
1
+ === 2.1.1 / 2016-06-09
2
+
3
+ Features:
4
+
5
+ * GoWorkspace now detects some non-standard package names with only two path parts. (#226)
6
+
7
+ Bugfixes:
8
+
9
+ * NuGet now appropriately returns a Pathname from #package_path (previously was a String) (#227)
10
+ * NuGet now correctly chooses a directory with vendored .nupkg packages
11
+
12
+
1
13
  === 2.1.0 / 2016-04-01
2
14
 
3
15
  * Features
data/README.md CHANGED
@@ -20,17 +20,17 @@ report.
20
20
  * Python Eggs (via `pip`)
21
21
  * Node.js (via `npm`)
22
22
  * Bower
23
+ * Nuget (without license discovery)
24
+ * Godep
25
+ * Go workspace (via a `.envrc` file)
26
+ * Go submodules
27
+ * Java (via `maven`)
28
+ * Java (via `gradle`)
23
29
 
24
30
  ### Experimental project types
25
31
 
26
- * Java (via `maven`)
27
- * Java (via `gradle`)
28
32
  * Erlang (via `rebar`)
29
33
  * Objective-C (+ CocoaPods)
30
- * Nuget (without license discovery)
31
- * Godep
32
- * Go workspace (via a `.envrc` file)
33
-
34
34
 
35
35
  ## Installation
36
36
 
@@ -13,6 +13,8 @@ module LicenseFinder
13
13
  def current_packages
14
14
  go_list_packages = go_list
15
15
  git_modules.map do |submodule|
16
+ # We are filtering the non-standard packages because the word "net"
17
+ # seems to be common that can give false positive when filtering the git submodules
16
18
  import_path = go_list_packages.select { |gp|
17
19
  submodule.install_path =~ /#{repo_name(gp)}$/
18
20
  }.first
@@ -69,9 +71,11 @@ module LicenseFinder
69
71
  ENV['GOPATH'] = nil
70
72
  val = capture('go list -f \'{{join .Deps "\n"}}\' ./...')
71
73
  raise 'go list failed' unless val.last
72
- # Select non-standard packages. Standard packages tend to be short
73
- # and have less than two slashes
74
- val.first.lines.map(&:strip).select { |l| l.split("/").length > 2 }
74
+ # Select non-standard packages. Non-standard packages typically
75
+ # have a period somewhere in the namespace (github.com, gopkg.in,
76
+ # etc.).
77
+ #
78
+ val.first.lines.map(&:strip).select { |l| l =~ /.+\..+\// }
75
79
  end
76
80
  end
77
81
 
@@ -4,7 +4,13 @@ require 'zip'
4
4
  module LicenseFinder
5
5
  class Nuget < PackageManager
6
6
  def package_path
7
- project_path.join('.nuget')
7
+ path = project_path.join("**/*.nupkg")
8
+ nuget_dir = Dir[path].map{|pkg| File.dirname(pkg)}.uniq
9
+ if nuget_dir.length == 0
10
+ project_path.join(".nuget")
11
+ else
12
+ Pathname(nuget_dir.first)
13
+ end
8
14
  end
9
15
 
10
16
  def assemblies
@@ -1,3 +1,3 @@
1
1
  module LicenseFinder
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -35,6 +35,7 @@ module LicenseFinder
35
35
  let(:go_list_output) {
36
36
  <<HERE
37
37
  encoding/json
38
+ gopkg.in/yaml.v2
38
39
  github.com/onsi/ginkgo
39
40
  HERE
40
41
  }
@@ -54,8 +55,9 @@ HERE
54
55
  it 'returns the skip the standard libs and return lines of the output' do
55
56
  allow(subject).to receive(:capture).with('go list -f \'{{join .Deps "\n"}}\' ./...').and_return([go_list_output, true])
56
57
  packages = subject.send(:go_list)
57
- expect(packages.count).to eq(1)
58
- expect(packages.first).to eq('github.com/onsi/ginkgo')
58
+ expect(packages.count).to eq(2)
59
+ expect(packages).to include 'github.com/onsi/ginkgo'
60
+ expect(packages).to include 'gopkg.in/yaml.v2'
59
61
  end
60
62
 
61
63
  it 'sets gopath to the envrc path' do
@@ -3,6 +3,10 @@ require 'fakefs/spec_helpers'
3
3
  require 'zip'
4
4
 
5
5
  module LicenseFinder
6
+ def self.broken_fakefs?
7
+ RUBY_PLATFORM =~ /java/ || RUBY_VERSION =~ /^(1\.9|2\.0)/
8
+ end
9
+
6
10
  describe Nuget do
7
11
 
8
12
  it_behaves_like "a PackageManager"
@@ -36,6 +40,23 @@ module LicenseFinder
36
40
  expect(nuget.assemblies.map(&:name)).to include('.nuget')
37
41
  end
38
42
  end
43
+
44
+ end
45
+
46
+ describe "#package_path" do
47
+ include FakeFS::SpecHelpers
48
+
49
+ context 'when .nupkg files exist, but are not in .nuget directory' do
50
+ before do
51
+ FileUtils.mkdir_p 'app/vendor'
52
+ FileUtils.touch 'app/vendor/package.nupkg'
53
+ end
54
+
55
+ it "returns vendored director" do
56
+ nuget = Nuget.new project_path: Pathname.new("app")
57
+ expect(nuget.package_path).to eq Pathname('/app/vendor')
58
+ end
59
+ end
39
60
  end
40
61
 
41
62
  describe "#current_packages" do
@@ -91,18 +112,18 @@ module LicenseFinder
91
112
  end
92
113
 
93
114
  # cannot run on JRuby due to https://github.com/fakefs/fakefs/issues/303
94
- context 'when there is a .nupkg file', :skip => RUBY_PLATFORM =~ /java/ do
115
+ context 'when there is a .nupkg file', :skip => LicenseFinder.broken_fakefs? do
95
116
  before do
96
- obscure_dependency_nuspec = <<-HERE
97
- <?xml version="1.0"?>
98
- <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
99
- <metadata>
100
- <id>ObscureDependency</id>
101
- <version>1.3.15</version>
102
- <licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
103
- </metadata>
104
- </package>
105
- HERE
117
+ obscure_dependency_nuspec = <<-EOXML
118
+ <?xml version="1.0"?>
119
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
120
+ <metadata>
121
+ <id>ObscureDependency</id>
122
+ <version>1.3.15</version>
123
+ <licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
124
+ </metadata>
125
+ </package>
126
+ EOXML
106
127
  File.write("app/packages/ObscureDependency.nuspec", obscure_dependency_nuspec)
107
128
  Dir.chdir 'app/packages' do
108
129
  Zip::File.open('ObscureDependency.1.3.15.nupkg', Zip::File::CREATE) do |zipfile|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Maine
@@ -20,7 +20,7 @@ authors:
20
20
  autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2016-04-01 00:00:00.000000000 Z
23
+ date: 2016-06-09 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler