license_finder 0.9.1-java → 0.9.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +11 -1
- data/features/node_dependencies.feature +9 -0
- data/features/python_dependencies.feature +9 -0
- data/features/step_definitions/html_report_steps.rb +3 -1
- data/features/step_definitions/node_steps.rb +8 -0
- data/features/step_definitions/python_steps.rb +8 -0
- data/features/step_definitions/shared_steps.rb +48 -0
- data/lib/data/licenses/Python.txt +47 -0
- data/lib/license_finder.rb +4 -2
- data/lib/license_finder/bundle.rb +15 -9
- data/lib/license_finder/dependency_manager.rb +14 -1
- data/lib/license_finder/license/apache2.rb +1 -1
- data/lib/license_finder/license/bsd.rb +1 -1
- data/lib/license_finder/license/mit.rb +1 -1
- data/lib/license_finder/license/python.rb +8 -0
- data/lib/license_finder/npm.rb +56 -0
- data/lib/license_finder/{bundled_gem.rb → package.rb} +45 -3
- data/lib/license_finder/{bundled_gem_saver.rb → package_saver.rb} +15 -13
- data/lib/license_finder/pip.rb +59 -0
- data/lib/license_finder/reports/html_report.rb +10 -1
- data/lib/templates/html_report.erb +14 -12
- data/license_finder.gemspec +3 -1
- data/readme.md +10 -4
- data/release/manual_instructions.md +7 -6
- data/spec/lib/license_finder/bundle_spec.rb +24 -0
- data/spec/lib/license_finder/dependency_manager_spec.rb +4 -4
- data/spec/lib/license_finder/license/python_spec.rb +7 -0
- data/spec/lib/license_finder/npm_spec.rb +79 -0
- data/spec/lib/license_finder/{bundled_gem_saver_spec.rb → package_saver_spec.rb} +17 -17
- data/spec/lib/license_finder/{bundled_gem_spec.rb → package_spec.rb} +20 -2
- data/spec/lib/license_finder/pip_spec.rb +89 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/license_examples.rb +1 -1
- metadata +58 -8
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module LicenseFinder
|
4
|
-
describe
|
4
|
+
describe Package do
|
5
5
|
subject { described_class.new(gemspec) }
|
6
6
|
|
7
7
|
let(:gemspec) do
|
@@ -26,7 +26,7 @@ module LicenseFinder
|
|
26
26
|
|
27
27
|
describe "#license" do
|
28
28
|
subject do
|
29
|
-
details =
|
29
|
+
details = Package.new(gemspec)
|
30
30
|
details.stub(:license_files).and_return([license_file])
|
31
31
|
details
|
32
32
|
end
|
@@ -77,4 +77,22 @@ module LicenseFinder
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
80
|
+
|
81
|
+
describe PythonPackage do
|
82
|
+
it "calls out to Pip if no license is found using conventional means" do
|
83
|
+
allow(Pip).to receive(:license_for).and_return("PSF")
|
84
|
+
|
85
|
+
package = PythonPackage.new(OpenStruct.new(name: 'jasmine', version: '1.3.1', full_gem_path: '/foo/bar'))
|
86
|
+
|
87
|
+
expect(package.determine_license).to eq("PSF")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns other if no license could be found" do
|
91
|
+
allow(Pip).to receive(:license_for).and_return("other")
|
92
|
+
|
93
|
+
package = PythonPackage.new(OpenStruct.new(name: 'jasmine', version: '1.3.1', full_gem_path: '/foo/bar'))
|
94
|
+
|
95
|
+
expect(package.determine_license).to eq("other")
|
96
|
+
end
|
97
|
+
end
|
80
98
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module LicenseFinder
|
4
|
+
describe Pip do
|
5
|
+
describe '.current_dists' do
|
6
|
+
it 'lists all the current dists' do
|
7
|
+
allow(Pip).to receive(:`).with(/python/).and_return('[["jasmine", "1.3.1", "MIT"], ["jasmine-core", "1.3.1", "MIT"]]')
|
8
|
+
|
9
|
+
current_dists = Pip.current_dists
|
10
|
+
|
11
|
+
expect(current_dists.size).to eq(2)
|
12
|
+
expect(current_dists.first).to be_a(Package)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'memoizes the current_dists' do
|
16
|
+
allow(Pip).to receive(:`).with(/python/).and_return('[]').once
|
17
|
+
|
18
|
+
Pip.current_dists
|
19
|
+
Pip.current_dists
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.has_requirements' do
|
24
|
+
let(:requirements) { Pathname.new('requirements.txt').expand_path }
|
25
|
+
|
26
|
+
context 'with a requirements file' do
|
27
|
+
before :each do
|
28
|
+
allow(File).to receive(:exists?).with(requirements).and_return(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns true' do
|
32
|
+
expect(Pip.has_requirements?).to eq(true)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'without a requirements file' do
|
37
|
+
before :each do
|
38
|
+
allow(File).to receive(:exists?).with(requirements).and_return(false)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns false' do
|
42
|
+
expect(Pip.has_requirements?).to eq(false)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '.license_for' do
|
48
|
+
let(:package) { PythonPackage.new(OpenStruct.new(name: 'jasmine', version: '1.3.1')) }
|
49
|
+
|
50
|
+
before :each do
|
51
|
+
stub_request(:get, "https://pypi.python.org/pypi/jasmine/1.3.1/json").
|
52
|
+
to_return(:status => 200, :body => "{}", :headers => {})
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'reaches out to PyPI with the package name and version' do
|
56
|
+
Pip.license_for(package)
|
57
|
+
|
58
|
+
WebMock.should have_requested(:get, "https://pypi.python.org/pypi/jasmine/1.3.1/json")
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns the license from info => license preferentially' do
|
62
|
+
data = { info: { license: "MIT", classifiers: [ 'License :: OSI Approved :: Apache 2.0 License' ] } }
|
63
|
+
|
64
|
+
stub_request(:get, "https://pypi.python.org/pypi/jasmine/1.3.1/json").
|
65
|
+
to_return(:status => 200, :body => JSON.generate(data), :headers => {})
|
66
|
+
|
67
|
+
expect(Pip.license_for(package)).to eq('MIT')
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'returns the first license from the classifiers if no info => license exists' do
|
71
|
+
data = { info: { classifiers: [ 'License :: OSI Approved :: Apache 2.0 License' ] } }
|
72
|
+
|
73
|
+
stub_request(:get, "https://pypi.python.org/pypi/jasmine/1.3.1/json").
|
74
|
+
to_return(:status => 200, :body => JSON.generate(data), :headers => {})
|
75
|
+
|
76
|
+
expect(Pip.license_for(package)).to eq('Apache 2.0 License')
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'returns other if no license can be found' do
|
80
|
+
data = {}
|
81
|
+
|
82
|
+
stub_request(:get, "https://pypi.python.org/pypi/jasmine/1.3.1/json").
|
83
|
+
to_return(:status => 200, :body => JSON.generate(data), :headers => {})
|
84
|
+
|
85
|
+
expect(Pip.license_for(package)).to eq('other')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -24,7 +24,7 @@ shared_examples_for "a license matcher" do
|
|
24
24
|
|
25
25
|
describe "#license_text" do
|
26
26
|
it "should always produce a license text" do
|
27
|
-
subject.class.license_text.should_not be_nil, "No license text found for #{subject.class}! Add a license template to lib/
|
27
|
+
subject.class.license_text.should_not be_nil, "No license text found for #{subject.class}! Add a license template to lib/data/licenses named '#{subject.class.demodulized_name}.txt'"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.2
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Jacob Maine
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2013-
|
20
|
+
date: 2013-08-17 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: bundler
|
@@ -83,6 +83,22 @@ dependencies:
|
|
83
83
|
none: false
|
84
84
|
prerelease: false
|
85
85
|
type: :runtime
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: httparty
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
none: false
|
94
|
+
requirement: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
none: false
|
100
|
+
prerelease: false
|
101
|
+
type: :runtime
|
86
102
|
- !ruby/object:Gem::Dependency
|
87
103
|
name: jdbc-sqlite3
|
88
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -195,6 +211,22 @@ dependencies:
|
|
195
211
|
none: false
|
196
212
|
prerelease: false
|
197
213
|
type: :development
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: webmock
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ~>
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '1.13'
|
221
|
+
none: false
|
222
|
+
requirement: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ~>
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '1.13'
|
227
|
+
none: false
|
228
|
+
prerelease: false
|
229
|
+
type: :development
|
198
230
|
description: |2
|
199
231
|
Do you know the licenses of all your application's dependencies? What open source software licenses will your business accept?
|
200
232
|
|
@@ -234,16 +266,20 @@ files:
|
|
234
266
|
- features/cli.feature
|
235
267
|
- features/html_report.feature
|
236
268
|
- features/ignore_bundle_groups.feature
|
269
|
+
- features/node_dependencies.feature
|
237
270
|
- features/non_bundler_dependencies.feature
|
238
271
|
- features/project_name.feature
|
272
|
+
- features/python_dependencies.feature
|
239
273
|
- features/rails_rake.feature
|
240
274
|
- features/set_license.feature
|
241
275
|
- features/step_definitions/approve_dependencies_steps.rb
|
242
276
|
- features/step_definitions/cli_steps.rb
|
243
277
|
- features/step_definitions/html_report_steps.rb
|
244
278
|
- features/step_definitions/ignore_bundle_groups_steps.rb
|
279
|
+
- features/step_definitions/node_steps.rb
|
245
280
|
- features/step_definitions/non_bundler_steps.rb
|
246
281
|
- features/step_definitions/project_name_steps.rb
|
282
|
+
- features/step_definitions/python_steps.rb
|
247
283
|
- features/step_definitions/rails_rake_steps.rb
|
248
284
|
- features/step_definitions/set_license_steps.rb
|
249
285
|
- features/step_definitions/shared_steps.rb
|
@@ -261,12 +297,11 @@ files:
|
|
261
297
|
- lib/data/licenses/LGPL.txt
|
262
298
|
- lib/data/licenses/MIT.txt
|
263
299
|
- lib/data/licenses/NewBSD.txt
|
300
|
+
- lib/data/licenses/Python.txt
|
264
301
|
- lib/data/licenses/Ruby.txt
|
265
302
|
- lib/data/licenses/SimplifiedBSD.txt
|
266
303
|
- lib/license_finder.rb
|
267
304
|
- lib/license_finder/bundle.rb
|
268
|
-
- lib/license_finder/bundled_gem.rb
|
269
|
-
- lib/license_finder/bundled_gem_saver.rb
|
270
305
|
- lib/license_finder/cli.rb
|
271
306
|
- lib/license_finder/configuration.rb
|
272
307
|
- lib/license_finder/dependency_manager.rb
|
@@ -278,9 +313,14 @@ files:
|
|
278
313
|
- lib/license_finder/license/lgpl.rb
|
279
314
|
- lib/license_finder/license/mit.rb
|
280
315
|
- lib/license_finder/license/new_bsd.rb
|
316
|
+
- lib/license_finder/license/python.rb
|
281
317
|
- lib/license_finder/license/ruby.rb
|
282
318
|
- lib/license_finder/license/simplified_bsd.rb
|
283
319
|
- lib/license_finder/license_url.rb
|
320
|
+
- lib/license_finder/npm.rb
|
321
|
+
- lib/license_finder/package.rb
|
322
|
+
- lib/license_finder/package_saver.rb
|
323
|
+
- lib/license_finder/pip.rb
|
284
324
|
- lib/license_finder/platform.rb
|
285
325
|
- lib/license_finder/possible_license_file.rb
|
286
326
|
- lib/license_finder/possible_license_files.rb
|
@@ -329,8 +369,6 @@ files:
|
|
329
369
|
- spec/fixtures/readme/Readme.markdown
|
330
370
|
- spec/fixtures/utf8_gem/README
|
331
371
|
- spec/lib/license_finder/bundle_spec.rb
|
332
|
-
- spec/lib/license_finder/bundled_gem_saver_spec.rb
|
333
|
-
- spec/lib/license_finder/bundled_gem_spec.rb
|
334
372
|
- spec/lib/license_finder/cli_spec.rb
|
335
373
|
- spec/lib/license_finder/configuration_spec.rb
|
336
374
|
- spec/lib/license_finder/dependency_manager_spec.rb
|
@@ -342,10 +380,15 @@ files:
|
|
342
380
|
- spec/lib/license_finder/license/lgpl_spec.rb
|
343
381
|
- spec/lib/license_finder/license/mit_spec.rb
|
344
382
|
- spec/lib/license_finder/license/new_bsd_spec.rb
|
383
|
+
- spec/lib/license_finder/license/python_spec.rb
|
345
384
|
- spec/lib/license_finder/license/ruby_spec.rb
|
346
385
|
- spec/lib/license_finder/license/simplified_bsd_spec.rb
|
347
386
|
- spec/lib/license_finder/license_spec.rb
|
348
387
|
- spec/lib/license_finder/license_url_spec.rb
|
388
|
+
- spec/lib/license_finder/npm_spec.rb
|
389
|
+
- spec/lib/license_finder/package_saver_spec.rb
|
390
|
+
- spec/lib/license_finder/package_spec.rb
|
391
|
+
- spec/lib/license_finder/pip_spec.rb
|
349
392
|
- spec/lib/license_finder/possible_license_file_spec.rb
|
350
393
|
- spec/lib/license_finder/possible_license_files_spec.rb
|
351
394
|
- spec/lib/license_finder/reporter_spec.rb
|
@@ -393,16 +436,20 @@ test_files:
|
|
393
436
|
- features/cli.feature
|
394
437
|
- features/html_report.feature
|
395
438
|
- features/ignore_bundle_groups.feature
|
439
|
+
- features/node_dependencies.feature
|
396
440
|
- features/non_bundler_dependencies.feature
|
397
441
|
- features/project_name.feature
|
442
|
+
- features/python_dependencies.feature
|
398
443
|
- features/rails_rake.feature
|
399
444
|
- features/set_license.feature
|
400
445
|
- features/step_definitions/approve_dependencies_steps.rb
|
401
446
|
- features/step_definitions/cli_steps.rb
|
402
447
|
- features/step_definitions/html_report_steps.rb
|
403
448
|
- features/step_definitions/ignore_bundle_groups_steps.rb
|
449
|
+
- features/step_definitions/node_steps.rb
|
404
450
|
- features/step_definitions/non_bundler_steps.rb
|
405
451
|
- features/step_definitions/project_name_steps.rb
|
452
|
+
- features/step_definitions/python_steps.rb
|
406
453
|
- features/step_definitions/rails_rake_steps.rb
|
407
454
|
- features/step_definitions/set_license_steps.rb
|
408
455
|
- features/step_definitions/shared_steps.rb
|
@@ -436,8 +483,6 @@ test_files:
|
|
436
483
|
- spec/fixtures/readme/Readme.markdown
|
437
484
|
- spec/fixtures/utf8_gem/README
|
438
485
|
- spec/lib/license_finder/bundle_spec.rb
|
439
|
-
- spec/lib/license_finder/bundled_gem_saver_spec.rb
|
440
|
-
- spec/lib/license_finder/bundled_gem_spec.rb
|
441
486
|
- spec/lib/license_finder/cli_spec.rb
|
442
487
|
- spec/lib/license_finder/configuration_spec.rb
|
443
488
|
- spec/lib/license_finder/dependency_manager_spec.rb
|
@@ -449,10 +494,15 @@ test_files:
|
|
449
494
|
- spec/lib/license_finder/license/lgpl_spec.rb
|
450
495
|
- spec/lib/license_finder/license/mit_spec.rb
|
451
496
|
- spec/lib/license_finder/license/new_bsd_spec.rb
|
497
|
+
- spec/lib/license_finder/license/python_spec.rb
|
452
498
|
- spec/lib/license_finder/license/ruby_spec.rb
|
453
499
|
- spec/lib/license_finder/license/simplified_bsd_spec.rb
|
454
500
|
- spec/lib/license_finder/license_spec.rb
|
455
501
|
- spec/lib/license_finder/license_url_spec.rb
|
502
|
+
- spec/lib/license_finder/npm_spec.rb
|
503
|
+
- spec/lib/license_finder/package_saver_spec.rb
|
504
|
+
- spec/lib/license_finder/package_spec.rb
|
505
|
+
- spec/lib/license_finder/pip_spec.rb
|
456
506
|
- spec/lib/license_finder/possible_license_file_spec.rb
|
457
507
|
- spec/lib/license_finder/possible_license_files_spec.rb
|
458
508
|
- spec/lib/license_finder/reporter_spec.rb
|