license_finder 0.9.5 → 0.9.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +7 -1
  3. data/lib/license_finder.rb +8 -8
  4. data/lib/license_finder/{bower.rb → package_managers/bower.rb} +0 -0
  5. data/lib/license_finder/{bower_package.rb → package_managers/bower_package.rb} +4 -4
  6. data/lib/license_finder/{bundler.rb → package_managers/bundler.rb} +0 -0
  7. data/lib/license_finder/{bundler_package.rb → package_managers/bundler_package.rb} +0 -0
  8. data/lib/license_finder/{npm.rb → package_managers/npm.rb} +0 -0
  9. data/lib/license_finder/{npm_package.rb → package_managers/npm_package.rb} +4 -4
  10. data/lib/license_finder/{pip.rb → package_managers/pip.rb} +0 -0
  11. data/lib/license_finder/{pip_package.rb → package_managers/pip_package.rb} +4 -4
  12. data/lib/license_finder/possible_license_file.rb +2 -4
  13. data/license_finder.gemspec +1 -1
  14. data/spec/lib/license_finder/{bower_package_spec.rb → package_managers/bower_package_spec.rb} +5 -1
  15. data/spec/lib/license_finder/{bower_spec.rb → package_managers/bower_spec.rb} +0 -0
  16. data/spec/lib/license_finder/{bundler_package_spec.rb → package_managers/bundler_package_spec.rb} +8 -1
  17. data/spec/lib/license_finder/{bundler_spec.rb → package_managers/bundler_spec.rb} +0 -0
  18. data/spec/lib/license_finder/{npm_package_spec.rb → package_managers/npm_package_spec.rb} +5 -1
  19. data/spec/lib/license_finder/{npm_spec.rb → package_managers/npm_spec.rb} +0 -0
  20. data/spec/lib/license_finder/{pip_package_spec.rb → package_managers/pip_package_spec.rb} +14 -0
  21. data/spec/lib/license_finder/{pip_spec.rb → package_managers/pip_spec.rb} +0 -0
  22. data/spec/lib/license_finder/possible_license_file_spec.rb +0 -1
  23. data/spec/lib/license_finder/possible_license_files_spec.rb +9 -11
  24. metadata +25 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 914d2f2e411442bf2e8f37f7b17b5dd963f9c4be
4
- data.tar.gz: 985aa512713ab48aaed47129747e1f7b3b1d10de
3
+ metadata.gz: 7d0fac94c1fcfb1e2c55c8ad51eb926d0ebf6095
4
+ data.tar.gz: 929357c4d7e453a934656e55868accae1c156135
5
5
  SHA512:
6
- metadata.gz: c312d903761a6688929d0dc5c2b55d2e282cf2668d6f3d3d107341b9b86f75a206c7b5add0eac1c758117d89a028cd91f7ef5c8013ecce851a0f19e06f5e1eb9
7
- data.tar.gz: 91f606929437fc775f297b0377a567b18b7f95109bd1a7e000706d5636c523d2381d5922116bfb3e8bdf7b412fe68cd3459b37f31b01aa81c21f66dd975a223e
6
+ metadata.gz: 79fcb5642c2db96be5a6c8cd51f085a655a3124b90b4b2445cfcb0329090f55ce20272d7042641587cc040197623c03bc31dc3b485f1f8b06bd43269a3759bd3
7
+ data.tar.gz: 86442fbe3369bb0cdc7ee538b92e4b206863a26adc2da9b0033df3f06271ffb02625be03d3fffa7a51cc60cc35a006a711d66b8e706a47feeaf79a07d7f5e3e3
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.9.5.1 / 2014-01-30
2
+
3
+ * Features
4
+
5
+ * Adds homepage for Bower, NPM, and PIP packages
6
+
1
7
  === 0.9.5 / 2014-01-30
2
8
 
3
9
  * Features
@@ -5,7 +11,7 @@
5
11
  * Add more aliases for known licenses
6
12
  * Drop support for ruby 1.9.2
7
13
  * Large refactoring to simply things, and make it easier to add new package managers
8
-
14
+
9
15
  * Bugfixes
10
16
 
11
17
  * Make node dependency json parsing more robust
@@ -17,15 +17,15 @@ module LicenseFinder
17
17
  autoload :Configuration, 'license_finder/configuration'
18
18
  autoload :Platform, 'license_finder/platform'
19
19
 
20
- autoload :Bower, 'license_finder/bower'
21
- autoload :Bundler, 'license_finder/bundler'
22
- autoload :NPM, 'license_finder/npm'
23
- autoload :Pip, 'license_finder/pip'
24
20
  autoload :Package, 'license_finder/package'
25
- autoload :BowerPackage, 'license_finder/bower_package'
26
- autoload :BundlerPackage, 'license_finder/bundler_package'
27
- autoload :PipPackage, 'license_finder/pip_package'
28
- autoload :NpmPackage, 'license_finder/npm_package'
21
+ autoload :Bower, 'license_finder/package_managers/bower'
22
+ autoload :Bundler, 'license_finder/package_managers/bundler'
23
+ autoload :NPM, 'license_finder/package_managers/npm'
24
+ autoload :Pip, 'license_finder/package_managers/pip'
25
+ autoload :BowerPackage, 'license_finder/package_managers/bower_package'
26
+ autoload :BundlerPackage, 'license_finder/package_managers/bundler_package'
27
+ autoload :PipPackage, 'license_finder/package_managers/pip_package'
28
+ autoload :NpmPackage, 'license_finder/package_managers/npm_package'
29
29
 
30
30
  autoload :BundlerGroup, 'license_finder/tables/bundler_group'
31
31
  autoload :Dependency, 'license_finder/tables/dependency'
@@ -21,6 +21,10 @@ module LicenseFinder
21
21
  module_metadata.fetch("readme", nil)
22
22
  end
23
23
 
24
+ def homepage
25
+ module_metadata.fetch("homepage", nil)
26
+ end
27
+
24
28
  def children
25
29
  [] # no way to determine child deps from bower (maybe?)
26
30
  end
@@ -29,10 +33,6 @@ module LicenseFinder
29
33
  [] # no concept of dev/test groups in bower (maybe?)
30
34
  end
31
35
 
32
- def homepage
33
- nil # no way to extract homepage from bower (maybe?)
34
- end
35
-
36
36
  private
37
37
 
38
38
  attr_reader :bower_module
@@ -20,6 +20,10 @@ module LicenseFinder
20
20
  node_module["readme"]
21
21
  end
22
22
 
23
+ def homepage
24
+ node_module["homepage"]
25
+ end
26
+
23
27
  def children
24
28
  [] # no way to determine child deps from npm (maybe?)
25
29
  end
@@ -28,10 +32,6 @@ module LicenseFinder
28
32
  [] # no concept of dev/test groups in npm (maybe?)
29
33
  end
30
34
 
31
- def homepage
32
- nil # no way to extract homepage from npm (maybe?)
33
- end
34
-
35
35
  private
36
36
 
37
37
  attr_reader :node_module
@@ -17,6 +17,10 @@ module LicenseFinder
17
17
  pypi_def.fetch("description", "")
18
18
  end
19
19
 
20
+ def homepage
21
+ pypi_def["home_page"]
22
+ end
23
+
20
24
  def children
21
25
  [] # no way to determine child deps from pip (maybe?)
22
26
  end
@@ -25,10 +29,6 @@ module LicenseFinder
25
29
  [] # no concept of dev/test groups in pip (maybe?)
26
30
  end
27
31
 
28
- def homepage
29
- nil # no way to extract homepage from pip (maybe?)
30
- end
31
-
32
32
  private
33
33
 
34
34
  attr_reader :install_path, :pypi_def
@@ -5,14 +5,12 @@ module LicenseFinder
5
5
  @file_path = Pathname.new(file_path)
6
6
  end
7
7
 
8
+ # Unused, except in tests, but might be useful if LF ever reports the
9
+ # locations of all the files it searched.
8
10
  def file_path
9
11
  @file_path.relative_path_from(@install_path).to_s
10
12
  end
11
13
 
12
- def file_name
13
- @file_path.basename.to_s
14
- end
15
-
16
14
  def text
17
15
  @text ||= @file_path.send(@file_path.respond_to?(:binread) ? :binread : :read)
18
16
  end
@@ -3,7 +3,7 @@ require './lib/license_finder/platform'
3
3
  Gem::Specification.new do |s|
4
4
  s.required_ruby_version = '>= 1.9.3'
5
5
  s.name = "license_finder"
6
- s.version = "0.9.5"
6
+ s.version = "0.9.5.1"
7
7
  s.authors = ["Jacob Maine", "Matthew Kane Parker", "Ian Lesperance", "David Edwards", "Paul Meskers", "Brent Wheeldon", "Trevor John", "David Tengdin", "William Ramsey"]
8
8
  s.email = ["licensefinder@pivotalabs.com"]
9
9
  s.homepage = "https://github.com/pivotal/LicenseFinder"
@@ -10,7 +10,8 @@ module LicenseFinder
10
10
  "description" => "description",
11
11
  "version" => "1.3.3.7",
12
12
  "main" => "normalize.css",
13
- "readme" => "some readme stuff"
13
+ "readme" => "some readme stuff",
14
+ "homepage" => "homepage"
14
15
  }
15
16
  )
16
17
  end
@@ -21,6 +22,9 @@ module LicenseFinder
21
22
  its(:version) { should == "1.3.3.7" }
22
23
  its(:summary) { should == "description" }
23
24
  its(:description) { should == "some readme stuff" }
25
+ its(:homepage) { should == "homepage" }
26
+ its(:groups) { should == [] }
27
+ its(:children) { should == [] }
24
28
 
25
29
  describe '#license' do
26
30
  def stub_license_files(license_files)
@@ -22,6 +22,7 @@ module LicenseFinder
22
22
  its(:version) { should == '2.1.3' }
23
23
  its(:summary) { should == "summary" }
24
24
  its(:description) { should == "description" }
25
+ its(:homepage) { should == "homepage" }
25
26
  its(:groups) { should == [] }
26
27
  its(:children) { should == [] }
27
28
 
@@ -31,11 +32,17 @@ module LicenseFinder
31
32
  end
32
33
 
33
34
  it "returns the license from the gemspec if provided" do
34
- gemspec.stub(:license).and_return('Gemspec License')
35
+ gemspec.license = 'Gemspec License'
35
36
 
36
37
  subject.license.should == "Gemspec License"
37
38
  end
38
39
 
40
+ it "returns the first license if the gemspec provides many" do
41
+ gemspec.licenses = ['First Gemspec License', 'Second Gemspec License']
42
+
43
+ subject.license.should == "First Gemspec License"
44
+ end
45
+
39
46
  it "returns a license in a file if detected" do
40
47
  stub_license_files [double(:file, license: 'Detected License')]
41
48
 
@@ -8,7 +8,8 @@ module LicenseFinder
8
8
  "version" => "1.3.1",
9
9
  "description" => "a description",
10
10
  "readme" => "a readme",
11
- "path" => "some/node/package/path"
11
+ "path" => "some/node/package/path",
12
+ "homepage" => "a homepage"
12
13
  )
13
14
  end
14
15
 
@@ -18,6 +19,9 @@ module LicenseFinder
18
19
  its(:version) { should == "1.3.1" }
19
20
  its(:summary) { should == "a description" }
20
21
  its(:description) { should == "a readme" }
22
+ its(:homepage) { should == "a homepage" }
23
+ its(:groups) { should == [] }
24
+ its(:children) { should == [] }
21
25
 
22
26
  describe '#license' do
23
27
  def stub_license_files(license_files)
@@ -12,6 +12,9 @@ module LicenseFinder
12
12
 
13
13
  its(:name) { should == "jasmine" }
14
14
  its(:version) { should == "1.3.1" }
15
+ its(:homepage) { should == nil }
16
+ its(:groups) { should == [] }
17
+ its(:children) { should == [] }
15
18
 
16
19
  describe "#summary" do
17
20
  it "delegates to pypi def" do
@@ -35,6 +38,17 @@ module LicenseFinder
35
38
  end
36
39
  end
37
40
 
41
+ describe "#homepage" do
42
+ it "delegates to pypi def" do
43
+ subject = make_package("home_page" => "A homepage")
44
+ expect(subject.homepage).to eq("A homepage")
45
+ end
46
+
47
+ it "falls back to nothing" do
48
+ expect(subject.homepage).to be_nil
49
+ end
50
+ end
51
+
38
52
  describe '#license' do
39
53
  describe "with pypi license" do
40
54
  it "returns the license from 'license' preferentially" do
@@ -10,7 +10,6 @@ describe LicenseFinder::PossibleLicenseFile do
10
10
  end
11
11
 
12
12
  its(:file_path) { should == 'nested/path' }
13
- its(:file_name) { should == 'path' }
14
13
  its(:text) { should == 'file text' }
15
14
  end
16
15
  end
@@ -15,29 +15,27 @@ module LicenseFinder
15
15
  it "includes files with names like LICENSE, License or COPYING" do
16
16
  subject = described_class.new(fixture_path('license_names'))
17
17
 
18
- subject.find.map(&:file_name).should =~
18
+ subject.find.map(&:file_path).should =~
19
19
  %w[COPYING.txt LICENSE Mit-License README.rdoc Licence.rdoc]
20
20
  end
21
21
 
22
22
  it "includes files deep in the hierarchy" do
23
23
  subject = described_class.new(fixture_path('nested_gem'))
24
24
 
25
- subject.find.map { |f| [f.file_name, f.file_path] }.should =~ [
26
- %w[LICENSE vendor/LICENSE]
27
- ]
25
+ subject.find.map(&:file_path).should =~ %w[vendor/LICENSE]
28
26
  end
29
27
 
30
28
  it "includes both files nested inside LICENSE directory and top level files" do
31
29
  subject = described_class.new(fixture_path('license_directory'))
32
30
  found_license_files = subject.find
33
31
 
34
- found_license_files.map { |f| [f.file_name, f.file_path] }.should =~ [
35
- %w[BSD-2-Clause.txt LICENSE/BSD-2-Clause.txt],
36
- %w[GPL-2.0.txt LICENSE/GPL-2.0.txt],
37
- %w[MIT.txt LICENSE/MIT.txt],
38
- %w[RUBY.txt LICENSE/RUBY.txt],
39
- %w[COPYING COPYING],
40
- %w[LICENSE LICENSE/LICENSE]
32
+ found_license_files.map(&:file_path).should =~ %w[
33
+ LICENSE/BSD-2-Clause.txt
34
+ LICENSE/GPL-2.0.txt
35
+ LICENSE/MIT.txt
36
+ LICENSE/RUBY.txt
37
+ COPYING
38
+ LICENSE/LICENSE
41
39
  ]
42
40
  end
43
41
 
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: 0.9.5
4
+ version: 0.9.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Maine
@@ -277,10 +277,6 @@ files:
277
277
  - lib/data/licenses/Ruby.txt
278
278
  - lib/data/licenses/SimplifiedBSD.txt
279
279
  - lib/license_finder.rb
280
- - lib/license_finder/bower.rb
281
- - lib/license_finder/bower_package.rb
282
- - lib/license_finder/bundler.rb
283
- - lib/license_finder/bundler_package.rb
284
280
  - lib/license_finder/cli.rb
285
281
  - lib/license_finder/configuration.rb
286
282
  - lib/license_finder/dependency_manager.rb
@@ -296,12 +292,16 @@ files:
296
292
  - lib/license_finder/license/ruby.rb
297
293
  - lib/license_finder/license/simplified_bsd.rb
298
294
  - lib/license_finder/license_url.rb
299
- - lib/license_finder/npm.rb
300
- - lib/license_finder/npm_package.rb
301
295
  - lib/license_finder/package.rb
296
+ - lib/license_finder/package_managers/bower.rb
297
+ - lib/license_finder/package_managers/bower_package.rb
298
+ - lib/license_finder/package_managers/bundler.rb
299
+ - lib/license_finder/package_managers/bundler_package.rb
300
+ - lib/license_finder/package_managers/npm.rb
301
+ - lib/license_finder/package_managers/npm_package.rb
302
+ - lib/license_finder/package_managers/pip.rb
303
+ - lib/license_finder/package_managers/pip_package.rb
302
304
  - lib/license_finder/package_saver.rb
303
- - lib/license_finder/pip.rb
304
- - lib/license_finder/pip_package.rb
305
305
  - lib/license_finder/platform.rb
306
306
  - lib/license_finder/possible_license_file.rb
307
307
  - lib/license_finder/possible_license_files.rb
@@ -351,10 +351,6 @@ files:
351
351
  - spec/fixtures/readme/README
352
352
  - spec/fixtures/readme/Readme.markdown
353
353
  - spec/fixtures/utf8_gem/README
354
- - spec/lib/license_finder/bower_package_spec.rb
355
- - spec/lib/license_finder/bower_spec.rb
356
- - spec/lib/license_finder/bundler_package_spec.rb
357
- - spec/lib/license_finder/bundler_spec.rb
358
354
  - spec/lib/license_finder/cli_spec.rb
359
355
  - spec/lib/license_finder/configuration_spec.rb
360
356
  - spec/lib/license_finder/dependency_manager_spec.rb
@@ -373,11 +369,15 @@ files:
373
369
  - spec/lib/license_finder/license_spec.rb
374
370
  - spec/lib/license_finder/license_url_spec.rb
375
371
  - spec/lib/license_finder/markdown_report_spec.rb
376
- - spec/lib/license_finder/npm_package_spec.rb
377
- - spec/lib/license_finder/npm_spec.rb
372
+ - spec/lib/license_finder/package_managers/bower_package_spec.rb
373
+ - spec/lib/license_finder/package_managers/bower_spec.rb
374
+ - spec/lib/license_finder/package_managers/bundler_package_spec.rb
375
+ - spec/lib/license_finder/package_managers/bundler_spec.rb
376
+ - spec/lib/license_finder/package_managers/npm_package_spec.rb
377
+ - spec/lib/license_finder/package_managers/npm_spec.rb
378
+ - spec/lib/license_finder/package_managers/pip_package_spec.rb
379
+ - spec/lib/license_finder/package_managers/pip_spec.rb
378
380
  - spec/lib/license_finder/package_saver_spec.rb
379
- - spec/lib/license_finder/pip_package_spec.rb
380
- - spec/lib/license_finder/pip_spec.rb
381
381
  - spec/lib/license_finder/possible_license_file_spec.rb
382
382
  - spec/lib/license_finder/possible_license_files_spec.rb
383
383
  - spec/lib/license_finder/reporter_spec.rb
@@ -464,10 +464,6 @@ test_files:
464
464
  - spec/fixtures/readme/README
465
465
  - spec/fixtures/readme/Readme.markdown
466
466
  - spec/fixtures/utf8_gem/README
467
- - spec/lib/license_finder/bower_package_spec.rb
468
- - spec/lib/license_finder/bower_spec.rb
469
- - spec/lib/license_finder/bundler_package_spec.rb
470
- - spec/lib/license_finder/bundler_spec.rb
471
467
  - spec/lib/license_finder/cli_spec.rb
472
468
  - spec/lib/license_finder/configuration_spec.rb
473
469
  - spec/lib/license_finder/dependency_manager_spec.rb
@@ -486,11 +482,15 @@ test_files:
486
482
  - spec/lib/license_finder/license_spec.rb
487
483
  - spec/lib/license_finder/license_url_spec.rb
488
484
  - spec/lib/license_finder/markdown_report_spec.rb
489
- - spec/lib/license_finder/npm_package_spec.rb
490
- - spec/lib/license_finder/npm_spec.rb
485
+ - spec/lib/license_finder/package_managers/bower_package_spec.rb
486
+ - spec/lib/license_finder/package_managers/bower_spec.rb
487
+ - spec/lib/license_finder/package_managers/bundler_package_spec.rb
488
+ - spec/lib/license_finder/package_managers/bundler_spec.rb
489
+ - spec/lib/license_finder/package_managers/npm_package_spec.rb
490
+ - spec/lib/license_finder/package_managers/npm_spec.rb
491
+ - spec/lib/license_finder/package_managers/pip_package_spec.rb
492
+ - spec/lib/license_finder/package_managers/pip_spec.rb
491
493
  - spec/lib/license_finder/package_saver_spec.rb
492
- - spec/lib/license_finder/pip_package_spec.rb
493
- - spec/lib/license_finder/pip_spec.rb
494
494
  - spec/lib/license_finder/possible_license_file_spec.rb
495
495
  - spec/lib/license_finder/possible_license_files_spec.rb
496
496
  - spec/lib/license_finder/reporter_spec.rb