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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f2d4afd67aa4f6ba48da21dc2c29259ecf07e84
4
- data.tar.gz: 6f3a252ed6b1c193f12a4e2f01bf112901dc6183
3
+ metadata.gz: 6ddb84b445d32f602815a66e09512dd9fd917bbb
4
+ data.tar.gz: 44813cf43899909185a60b9bd3ae10fc5a5fa594
5
5
  SHA512:
6
- metadata.gz: 4e8363177b0c9df5488159f9afa7ec590bdaf7064404376dc0b6e80033d9570b1b39e31492d267c14fc1832f9be97d96c66add246c767bb93b863bbd90cfd017
7
- data.tar.gz: 9fe65d70632094a2a5a3179ee24ac620ce2021a17880f5d5414a6864bd7d0429d444a0a13d43d9fc27b2abba91d2e9dcd97d2007c75ed640441b8db9ce40fe4e
6
+ metadata.gz: dd4d1ee0285d9425546a5dfa41d746b9db3a00903dcf9a5ea34ddea9d4eed4c979783bf9920d3db9756822a6d4caff44ec1a316ae12b606c6788ecb712552c12
7
+ data.tar.gz: c3acb3e8ed77664b816ef5523d2cea79c236edd6b6b25bef1a4cc1100af077418c10b5ff792a5ab7041ab03275e91fa4348546710380576a3b204ef72deeab45
@@ -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
@@ -1,3 +1,3 @@
1
1
  class Licensee
2
- VERSION = "5.0.0b3"
2
+ VERSION = "5.0.0b4"
3
3
  end
@@ -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 19, Licensee.licenses(:hidden => true).size
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 19, Licensee::License.keys.size
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 19, Licensee::License.all(:hidden => true).size
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
 
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: 5.0.0b3
4
+ version: 5.0.0b4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter