licensee 5.0.0b3 → 5.0.0b4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/licensee/license.rb +2 -2
- data/lib/licensee/project_file.rb +1 -1
- data/lib/licensee/version.rb +1 -1
- data/test/test_licensee.rb +1 -1
- data/test/test_licensee_license.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ddb84b445d32f602815a66e09512dd9fd917bbb
|
4
|
+
data.tar.gz: 44813cf43899909185a60b9bd3ae10fc5a5fa594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4d1ee0285d9425546a5dfa41d746b9db3a00903dcf9a5ea34ddea9d4eed4c979783bf9920d3db9756822a6d4caff44ec1a316ae12b606c6788ecb712552c12
|
7
|
+
data.tar.gz: c3acb3e8ed77664b816ef5523d2cea79c236edd6b6b25bef1a4cc1100af077418c10b5ff792a5ab7041ab03275e91fa4348546710380576a3b204ef72deeab45
|
data/lib/licensee/license.rb
CHANGED
@@ -9,7 +9,7 @@ class Licensee
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def keys
|
12
|
-
@keys ||= license_files.map { |l| File.basename(l, ".txt").downcase }
|
12
|
+
@keys ||= license_files.map { |l| File.basename(l, ".txt").downcase } + ["other"]
|
13
13
|
end
|
14
14
|
|
15
15
|
def find(key, options={})
|
@@ -101,7 +101,7 @@ class Licensee
|
|
101
101
|
# Git-computed hash signature for the license file
|
102
102
|
def hashsig
|
103
103
|
@hashsig ||= Rugged::Blob::HashSignature.new(
|
104
|
-
body, Rugged::Blob::HashSignature::WHITESPACE_SMART)
|
104
|
+
body, Rugged::Blob::HashSignature::WHITESPACE_SMART) unless body.nil?
|
105
105
|
rescue Rugged::InvalidError
|
106
106
|
nil
|
107
107
|
end
|
@@ -41,7 +41,7 @@ class Licensee
|
|
41
41
|
|
42
42
|
def similarity(other)
|
43
43
|
blob.hashsig(Rugged::Blob::HashSignature::WHITESPACE_SMART)
|
44
|
-
other.hashsig ? blob.similarity(other.hashsig) : 0
|
44
|
+
other.hashsig && blob.hashsig ? blob.similarity(other.hashsig) : 0
|
45
45
|
rescue Rugged::InvalidError
|
46
46
|
0
|
47
47
|
end
|
data/lib/licensee/version.rb
CHANGED
data/test/test_licensee.rb
CHANGED
@@ -4,7 +4,7 @@ class TestLicensee < Minitest::Test
|
|
4
4
|
should "know the licenses" do
|
5
5
|
assert_equal Array, Licensee.licenses.class
|
6
6
|
assert_equal 15, Licensee.licenses.size
|
7
|
-
assert_equal
|
7
|
+
assert_equal 20, Licensee.licenses(:hidden => true).size
|
8
8
|
assert_equal Licensee::License, Licensee.licenses.first.class
|
9
9
|
end
|
10
10
|
|
@@ -34,6 +34,10 @@ class TestLicenseeLicense < Minitest::Test
|
|
34
34
|
assert_equal "mit", @license.key
|
35
35
|
end
|
36
36
|
|
37
|
+
should "know the other license" do
|
38
|
+
assert_equal "other", Licensee::License.find_by_key("other").key
|
39
|
+
end
|
40
|
+
|
37
41
|
should "know license equality" do
|
38
42
|
assert @license == Licensee::License.new("MIT")
|
39
43
|
refute @license == Licensee::License.new("ISC")
|
@@ -97,13 +101,13 @@ class TestLicenseeLicense < Minitest::Test
|
|
97
101
|
describe "class methods" do
|
98
102
|
should "know license names" do
|
99
103
|
assert_equal Array, Licensee::License.keys.class
|
100
|
-
assert_equal
|
104
|
+
assert_equal 20, Licensee::License.keys.size
|
101
105
|
end
|
102
106
|
|
103
107
|
should "load the licenses" do
|
104
108
|
assert_equal Array, Licensee::License.all.class
|
105
109
|
assert_equal 15, Licensee::License.all.size
|
106
|
-
assert_equal
|
110
|
+
assert_equal 20, Licensee::License.all(:hidden => true).size
|
107
111
|
assert_equal Licensee::License, Licensee::License.all.first.class
|
108
112
|
end
|
109
113
|
|