license_finder 2.1.0.rc4 → 2.1.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -1
  3. data/CHANGELOG.rdoc +17 -0
  4. data/features/features/report/composite_spec.rb +13 -0
  5. data/features/features/report/diff_spec.rb +8 -8
  6. data/features/features/report/subproject_spec.rb +3 -3
  7. data/features/fixtures/nuget/{packages/Microsoft.AspNet.Mvc.4.0.30506.0 → .nuget}/.keep +0 -0
  8. data/lib/license_finder/cli/main.rb +1 -1
  9. data/lib/license_finder/configuration.rb +2 -1
  10. data/lib/license_finder/license/definitions.rb +21 -0
  11. data/lib/license_finder/license/templates/MPL2.txt +373 -0
  12. data/lib/license_finder/package.rb +4 -0
  13. data/lib/license_finder/package_manager.rb +2 -1
  14. data/lib/license_finder/package_managers/bower_package.rb +4 -0
  15. data/lib/license_finder/package_managers/bundler_package.rb +4 -0
  16. data/lib/license_finder/package_managers/cocoa_pods_package.rb +4 -0
  17. data/lib/license_finder/package_managers/go_dep.rb +7 -1
  18. data/lib/license_finder/package_managers/go_package.rb +8 -6
  19. data/lib/license_finder/package_managers/go_vendor.rb +56 -0
  20. data/lib/license_finder/package_managers/go_workspace.rb +49 -14
  21. data/lib/license_finder/package_managers/gradle.rb +1 -1
  22. data/lib/license_finder/package_managers/gradle_package.rb +4 -0
  23. data/lib/license_finder/package_managers/maven_package.rb +4 -0
  24. data/lib/license_finder/package_managers/merged_package.rb +4 -0
  25. data/lib/license_finder/package_managers/npm_package.rb +4 -0
  26. data/lib/license_finder/package_managers/nuget.rb +16 -3
  27. data/lib/license_finder/package_managers/nuget_package.rb +3 -0
  28. data/lib/license_finder/package_managers/pip_package.rb +4 -0
  29. data/lib/license_finder/package_managers/rebar_package.rb +3 -0
  30. data/lib/license_finder/reports/csv_report.rb +5 -1
  31. data/lib/license_finder/reports/merged_report.rb +2 -1
  32. data/lib/license_finder/version.rb +1 -1
  33. data/license_finder.gemspec +1 -0
  34. data/{features/fixtures/nuget/packages/NUnit.2.6.4 → spec/fixtures/all_pms/.nuget}/.keep +0 -0
  35. data/spec/lib/license_finder/cli/main_spec.rb +10 -0
  36. data/spec/lib/license_finder/configuration_spec.rb +1 -1
  37. data/spec/lib/license_finder/license/definitions_spec.rb +12 -0
  38. data/spec/lib/license_finder/package_managers/bower_package_spec.rb +1 -0
  39. data/spec/lib/license_finder/package_managers/bundler_package_spec.rb +1 -0
  40. data/spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb +1 -0
  41. data/spec/lib/license_finder/package_managers/go_dep_spec.rb +29 -0
  42. data/spec/lib/license_finder/package_managers/go_package_spec.rb +33 -0
  43. data/spec/lib/license_finder/package_managers/go_vendor_spec.rb +99 -0
  44. data/spec/lib/license_finder/package_managers/go_workspace_spec.rb +186 -46
  45. data/spec/lib/license_finder/package_managers/gradle_package_spec.rb +1 -0
  46. data/spec/lib/license_finder/package_managers/gradle_spec.rb +2 -1
  47. data/spec/lib/license_finder/package_managers/maven_package_spec.rb +1 -0
  48. data/spec/lib/license_finder/package_managers/merged_package_spec.rb +5 -1
  49. data/spec/lib/license_finder/package_managers/npm_package_spec.rb +1 -0
  50. data/spec/lib/license_finder/package_managers/nuget_package_spec.rb +9 -0
  51. data/spec/lib/license_finder/package_managers/nuget_spec.rb +41 -0
  52. data/spec/lib/license_finder/package_managers/pip_package_spec.rb +1 -0
  53. data/spec/lib/license_finder/package_managers/rebar_package_spec.rb +1 -0
  54. data/spec/lib/license_finder/reports/csv_report_spec.rb +6 -0
  55. metadata +24 -8
  56. data/features/fixtures/nuget/packages/Ninject.MVC4.3.2.1.0/.keep +0 -0
  57. data/features/fixtures/nuget/packages/repositories.config +0 -6
  58. data/spec/fixtures/all_pms/packages/.keep +0 -0
@@ -18,6 +18,7 @@ module LicenseFinder
18
18
  its(:groups) { should == [] } # no way to get groups from gradle?
19
19
  its(:children) { should == [] } # no way to get children from gradle?
20
20
  its(:install_path) { should be_nil }
21
+ its(:package_manager) { should eq 'Gradle' }
21
22
 
22
23
  describe "when file name has a funny format, possibly because it is a jar saved in the project" do
23
24
  it "uses a reasonable name and default version" do
@@ -27,10 +27,11 @@ module LicenseFinder
27
27
  it 'sets the working directory to project_path, if provided' do
28
28
  subject = Gradle.new(project_path: Pathname('/Users/foo/bar'))
29
29
  expect(Dir).to receive(:chdir).with(Pathname('/Users/foo/bar')) { |&block| block.call }
30
- expect(subject).to receive(:capture).with('gradle downloadLicenses').and_return(['', true])
30
+ expect(subject).to receive(:capture).with('gradle --console plain downloadLicenses').and_return(['', true])
31
31
  subject.current_packages
32
32
  end
33
33
 
34
+
34
35
  context 'when dependencies are found' do
35
36
  let(:content) do
36
37
  [
@@ -18,6 +18,7 @@ module LicenseFinder
18
18
  its(:groups) { should == [] } # no way to get groups from maven?
19
19
  its(:children) { should == [] } # no way to get children from maven?
20
20
  its(:install_path) { should be_nil }
21
+ its(:package_manager) { should eq 'Maven' }
21
22
 
22
23
  describe "#license_names_from_spec" do
23
24
  it "returns the license" do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module LicenseFinder
4
4
  describe MergedPackage do
5
- let(:package) { Package.new('foo', '1.0.0', spec_licenses: ['MIT']) }
5
+ let(:package) { Package.new('foo', '1.0.0', spec_licenses: ['MIT'], install_path: '/tmp/foo') }
6
6
  let(:subproject_paths) { 'path/to/project/with/foo' }
7
7
 
8
8
  subject { MergedPackage.new(package, [subproject_paths]) }
@@ -24,6 +24,10 @@ module LicenseFinder
24
24
  expect(subject.subproject_paths[0]).to end_with(subproject_paths)
25
25
  end
26
26
 
27
+ it 'returns the install path' do
28
+ expect(subject.install_path).to eq('/tmp/foo')
29
+ end
30
+
27
31
  describe '#eql?' do
28
32
  it 'returns true when the package names are equal' do
29
33
  p1 = MergedPackage.new(Package.new('foo', '1.0.0'), ['/path/to/package1'])
@@ -26,6 +26,7 @@ module LicenseFinder
26
26
  its(:groups) { should == [] } # TODO: put devDependencies in 'dev' group?
27
27
  its(:children) { should == ["coffee-script"] }
28
28
  its(:install_path) { should eq "some/node/package/path" }
29
+ its(:package_manager) { should eq 'Npm' }
29
30
 
30
31
  describe '#license_names_from_spec' do
31
32
  let(:node_module1) { {"license" => "MIT"} }
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ module LicenseFinder
4
+ describe NugetPackage do
5
+ subject { described_class.new 'nuget_package' }
6
+
7
+ its(:package_manager) { should == 'Nuget' }
8
+ end
9
+ end
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'fakefs/spec_helpers'
3
+ require 'zip'
3
4
 
4
5
  module LicenseFinder
5
6
  describe Nuget do
@@ -23,6 +24,18 @@ module LicenseFinder
23
24
  nuget = Nuget.new project_path: Pathname.new("app")
24
25
  expect(nuget.assemblies.map(&:name)).to match_array ['Assembly1', 'Assembly1.Tests', 'Assembly2']
25
26
  end
27
+
28
+ context 'when packages.config is in .nuget directory' do
29
+ before do
30
+ FileUtils.mkdir_p 'app/.nuget'
31
+ FileUtils.touch 'app/.nuget/packages.config'
32
+ end
33
+
34
+ it "finds dependencies all subdirectories containing a packages.config" do
35
+ nuget = Nuget.new project_path: Pathname.new("app")
36
+ expect(nuget.assemblies.map(&:name)).to include('.nuget')
37
+ end
38
+ end
26
39
  end
27
40
 
28
41
  describe "#current_packages" do
@@ -76,6 +89,34 @@ module LicenseFinder
76
89
  CoolNewDependency)
77
90
  expect(nuget.current_packages.map(&:name).uniq).to match_array(deps)
78
91
  end
92
+
93
+ # 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
95
+ 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
106
+ File.write("app/packages/ObscureDependency.nuspec", obscure_dependency_nuspec)
107
+ Dir.chdir 'app/packages' do
108
+ Zip::File.open('ObscureDependency.1.3.15.nupkg', Zip::File::CREATE) do |zipfile|
109
+ zipfile.add('ObscureDependency.nuspec', 'ObscureDependency.nuspec')
110
+ end
111
+ end
112
+ end
113
+
114
+ it "include the licenseUrl from the nuspec file" do
115
+ nuget = Nuget.new project_path: Pathname.new("app")
116
+ obscure_dep = nuget.current_packages.select { |dep| dep.name == 'ObscureDependency' }.first
117
+ expect(obscure_dep.license_names_from_spec).to eq(['http://www.opensource.org/licenses/mit-license.php'])
118
+ end
119
+ end
79
120
  end
80
121
  end
81
122
  end
@@ -23,6 +23,7 @@ module LicenseFinder
23
23
  its(:groups) { should == [] } # TODO: any way to extract install_requires and tests_require from `pip list` or `pip show`?
24
24
  its(:children) { should == ["achild"] }
25
25
  its(:install_path) { should eq "jasmine/install/path" }
26
+ its(:package_manager) { should eq 'Pip' }
26
27
 
27
28
 
28
29
  describe '#license_names_from_spec' do
@@ -19,5 +19,6 @@ module LicenseFinder
19
19
  its(:groups) { should == [] }
20
20
  its(:children) { should == [] }
21
21
  its(:install_path) { should eq "deps/uuid" }
22
+ its(:package_manager) { should eq 'Rebar' }
22
23
  end
23
24
  end
@@ -29,6 +29,12 @@ module LicenseFinder
29
29
  expect(subject.to_s).to eq("gem_a,1.0,/tmp/gems/gem_a-1.0\n")
30
30
  end
31
31
 
32
+ it 'supports package_manager column' do
33
+ dep = NugetPackage.new('gem_a', '1.0')
34
+ subject = described_class.new([dep], columns: %w[name version package_manager])
35
+ expect(subject.to_s).to eq("gem_a,1.0,Nuget\n")
36
+ end
37
+
32
38
  it "does not include columns that should only be in merged reports" do
33
39
  dep = Package.new('gem_a', '1.0')
34
40
  subject = described_class.new([dep], columns: %w[subproject_paths])
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.rc4
4
+ version: 2.1.0.rc5
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-01-27 00:00:00.000000000 Z
23
+ date: 2016-02-19 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
@@ -106,6 +106,20 @@ dependencies:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 0.6.7
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubyzip
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: pry
111
125
  requirement: !ruby/object:Gem::Requirement
@@ -256,12 +270,9 @@ files:
256
270
  - features/fixtures/multi-module-gradle/module1/build.gradle
257
271
  - features/fixtures/multi-module-gradle/module2/build.gradle
258
272
  - features/fixtures/multi-module-gradle/settings.gradle
273
+ - features/fixtures/nuget/.nuget/.keep
259
274
  - features/fixtures/nuget/Fun.Test/packages.config
260
275
  - features/fixtures/nuget/Fun/packages.config
261
- - features/fixtures/nuget/packages/Microsoft.AspNet.Mvc.4.0.30506.0/.keep
262
- - features/fixtures/nuget/packages/NUnit.2.6.4/.keep
263
- - features/fixtures/nuget/packages/Ninject.MVC4.3.2.1.0/.keep
264
- - features/fixtures/nuget/packages/repositories.config
265
276
  - features/fixtures/pom.xml
266
277
  - features/fixtures/rebar.config
267
278
  - features/fixtures/single-module-gradle/build.gradle
@@ -300,6 +311,7 @@ files:
300
311
  - lib/license_finder/license/templates/ISC.txt
301
312
  - lib/license_finder/license/templates/LGPL.txt
302
313
  - lib/license_finder/license/templates/MIT.txt
314
+ - lib/license_finder/license/templates/MPL2.txt
303
315
  - lib/license_finder/license/templates/NewBSD.txt
304
316
  - lib/license_finder/license/templates/Python.txt
305
317
  - lib/license_finder/license/templates/Ruby.txt
@@ -318,6 +330,7 @@ files:
318
330
  - lib/license_finder/package_managers/cocoa_pods_package.rb
319
331
  - lib/license_finder/package_managers/go_dep.rb
320
332
  - lib/license_finder/package_managers/go_package.rb
333
+ - lib/license_finder/package_managers/go_vendor.rb
321
334
  - lib/license_finder/package_managers/go_workspace.rb
322
335
  - lib/license_finder/package_managers/gradle.rb
323
336
  - lib/license_finder/package_managers/gradle_dependency_finder.rb
@@ -356,13 +369,13 @@ files:
356
369
  - release/instructions.md
357
370
  - spec/dummy_app/Gemfile
358
371
  - spec/fixtures/all_pms/.envrc
372
+ - spec/fixtures/all_pms/.nuget/.keep
359
373
  - spec/fixtures/all_pms/Gemfile
360
374
  - spec/fixtures/all_pms/Godeps/Godeps.json
361
375
  - spec/fixtures/all_pms/Podfile
362
376
  - spec/fixtures/all_pms/bower.json
363
377
  - spec/fixtures/all_pms/build.gradle
364
378
  - spec/fixtures/all_pms/package.json
365
- - spec/fixtures/all_pms/packages/.keep
366
379
  - spec/fixtures/all_pms/pom.xml
367
380
  - spec/fixtures/all_pms/rebar.config
368
381
  - spec/fixtures/all_pms/requirements.txt
@@ -411,6 +424,8 @@ files:
411
424
  - spec/lib/license_finder/package_managers/cocoa_pods_package_spec.rb
412
425
  - spec/lib/license_finder/package_managers/cocoa_pods_spec.rb
413
426
  - spec/lib/license_finder/package_managers/go_dep_spec.rb
427
+ - spec/lib/license_finder/package_managers/go_package_spec.rb
428
+ - spec/lib/license_finder/package_managers/go_vendor_spec.rb
414
429
  - spec/lib/license_finder/package_managers/go_workspace_spec.rb
415
430
  - spec/lib/license_finder/package_managers/gradle_package_spec.rb
416
431
  - spec/lib/license_finder/package_managers/gradle_spec.rb
@@ -419,6 +434,7 @@ files:
419
434
  - spec/lib/license_finder/package_managers/merged_package_spec.rb
420
435
  - spec/lib/license_finder/package_managers/npm_package_spec.rb
421
436
  - spec/lib/license_finder/package_managers/npm_spec.rb
437
+ - spec/lib/license_finder/package_managers/nuget_package_spec.rb
422
438
  - spec/lib/license_finder/package_managers/nuget_spec.rb
423
439
  - spec/lib/license_finder/package_managers/pip_package_spec.rb
424
440
  - spec/lib/license_finder/package_managers/pip_spec.rb
@@ -460,7 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
460
476
  version: 1.3.1
461
477
  requirements: []
462
478
  rubyforge_project:
463
- rubygems_version: 2.4.8
479
+ rubygems_version: 2.5.1
464
480
  signing_key:
465
481
  specification_version: 4
466
482
  summary: Audit the OSS licenses of your application's dependencies.
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <repositories>
3
- <repository path="..\Fun.Javascript.Test\packages.config" />
4
- <repository path="..\Fun.Test\packages.config" />
5
- <repository path="..\Fun\packages.config" />
6
- </repositories>
File without changes