licensee 4.7.1 → 4.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c12d9b4200c5da5e7b8d9de112cfac32f52d3def
4
- data.tar.gz: 81a13ed9b414494093be1ebe79a52aa3008a7d99
3
+ metadata.gz: 8ba75185c14cbfaa45edb5dc8fdb46744c10bcf0
4
+ data.tar.gz: f4cf2d3c717c6e4f198d35e76eb3aa72451dd57d
5
5
  SHA512:
6
- metadata.gz: 9913ceaf83583b2fa47ffd0389af8e2aaa8219a3efd9243fa01d03a692c35cb4529b482f71ed347e034c549ee8e700aba93c0105c6e13dfa873ee6750cad003b
7
- data.tar.gz: 3814c71d59f4df84abff4204213130732342b578e06212e0ee9dec632c83ac46f8e0542a1f6deb14513639f7556ddcf04191b676cfcb46471d53404fa8d99504
6
+ metadata.gz: 82231c76c1ab2d6d77640420f3f850154b835703246a62ac71779f7609b348e2244f6be33b1321dd74944104cc3e01ce5add1e31735f318c3e4389a03b4bc9b8
7
+ data.tar.gz: 03d1e3e669f55a1cf3e882a1859e130715a52e7368aaf3506b03917c79483943c850113830103212785400c9ee52d78a65dd8dfcf6f99a000cb4baa517e6cabe
@@ -31,7 +31,7 @@ class Licensee
31
31
  # License metadata from YAML front matter
32
32
  def meta
33
33
  @meta ||= if parts && parts[1]
34
- if YAML.respond_to? :safe_yaml
34
+ if YAML.respond_to? :safe_load
35
35
  YAML.safe_load(parts[1])
36
36
  else
37
37
  YAML.load(parts[1])
@@ -62,7 +62,9 @@ class Licensee
62
62
  # Detects the license file, if any
63
63
  # Returns the blob hash as detected in the tree
64
64
  def license_hash
65
- tree.sort_by { |blob| self.class.match_license_file(blob[:name]) }.last
65
+ hashes = tree.map { |blob| [self.class.match_license_file(blob[:name]), blob] }
66
+ hash = hashes.select { |hash| hash[0] > 0 }.sort_by { |hash| hash[0] }.last
67
+ hash[1] if hash
66
68
  end
67
69
 
68
70
  def license_blob
@@ -1,3 +1,3 @@
1
1
  class Licensee
2
- VERSION = "4.7.1"
2
+ VERSION = "4.7.2"
3
3
  end
@@ -0,0 +1 @@
1
+ ref: refs/heads/master
@@ -0,0 +1,6 @@
1
+ [core]
2
+ repositoryformatversion = 0
3
+ filemode = true
4
+ bare = true
5
+ ignorecase = true
6
+ precomposeunicode = true
@@ -0,0 +1 @@
1
+ e1d9b2a3d41c2ea74a520e66da2b5c63b2f6202f
@@ -76,6 +76,10 @@ class TestLicenseeProject < Minitest::Test
76
76
  assert_equal "mit", project.license.key
77
77
  end
78
78
 
79
+ should "detect an unlicensed project" do
80
+ project = make_project "no-license.git", as_git
81
+ assert_equal nil, project.license
82
+ end
79
83
  end
80
84
  end
81
85
 
@@ -1,31 +1,28 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestLicenseeVendor < Minitest::Test
4
- should "detect each vendored license" do
5
- licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
6
- licenses.each do |license|
4
+ Dir["#{Licensee::Licenses.base}/*"].shuffle.each do |license|
5
+
6
+ should "detect the #{license} license" do
7
7
  verify_license_file(license)
8
8
  end
9
- end
10
9
 
11
- should "detect each vendored license when modified" do
12
- licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
13
- licenses.each do |license|
14
- verify_license_file(license, true) unless license =~ /no-license\.txt$/
10
+ context "when modified" do
11
+ should "detect the #{license} license" do
12
+ verify_license_file(license, true) unless license =~ /no-license\.txt$/
13
+ end
15
14
  end
16
- end
17
15
 
18
- should "detect each vendored license with different line lengths" do
19
- licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
20
- licenses.each do |license|
21
- verify_license_file(license, false, 50)
22
- end
23
- end
16
+ context "different line lengths" do
17
+ should "detect the #{license} license" do
18
+ verify_license_file(license, false, 50)
19
+ end
24
20
 
25
- should "detect each vendored license with different line lengths when modified" do
26
- licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
27
- licenses.each do |license|
28
- verify_license_file(license, true, 50) unless license =~ /no-license\.txt$/
21
+ context "when modified" do
22
+ should "detect the #{license} license" do
23
+ verify_license_file(license, true, 50) unless license =~ /no-license\.txt$/
24
+ end
25
+ end
29
26
  end
30
27
  end
31
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensee
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
@@ -162,6 +162,12 @@ files:
162
162
  - test/fixtures/named-license-file-suffix.git/objects/c9/b229e500e529fdbd4f50746ba207e91d0677b6
163
163
  - test/fixtures/named-license-file-suffix.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
164
164
  - test/fixtures/named-license-file-suffix.git/refs/heads/master
165
+ - test/fixtures/no-license.git/HEAD
166
+ - test/fixtures/no-license.git/config
167
+ - test/fixtures/no-license.git/objects/82/0c999cf27a6f71431646c404274c578f7a2869
168
+ - test/fixtures/no-license.git/objects/e1/d9b2a3d41c2ea74a520e66da2b5c63b2f6202f
169
+ - test/fixtures/no-license.git/objects/ff/1592f44259635df9feda5e02853964b26f9e4d
170
+ - test/fixtures/no-license.git/refs/heads/master
165
171
  - test/functions.rb
166
172
  - test/helper.rb
167
173
  - test/test_licensee.rb