licensee 5.0.0b6 → 5.0.0b7

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: e0124d7811751a1221aa8ba861192a36432f23fe
4
- data.tar.gz: b01c35d07fc8db789ec3bd4af74ae8834a88c702
3
+ metadata.gz: 63059879d191ca3bf975e0637e991fa9b9ed0421
4
+ data.tar.gz: 00d43ef2f8dffdc51771150afec931baa3ce2e68
5
5
  SHA512:
6
- metadata.gz: 50f59b2e3ea125d6016a071aeeb585f7555e0920ee2ab3a7ee3118af086d9cf8ace3d9db578cdeea36e9dfde40139f49ef26a804146e0d4488823f1193ca6891
7
- data.tar.gz: 7ce11976be77d28769c878bdbc382506f4ad17d3785ba4c3d54df7359a6651d5e779cdd96e79d83d78a4302cd4403a53d2da1581099cade778fd8507986036f0
6
+ metadata.gz: d090f96f08bde997282923240d05886983ad4e4681da26a3549ebbcf06ff364174231b439b1a68d47c1ab2a9754170a1966de56d4cb7266f23d81d12a52f8822
7
+ data.tar.gz: 2e6ffcbda4dd0a3f5f97c79a660648d8e5a045029c85288bb0a7994f77914f3fd33d11de70a2ecb84e4d508575dd408748676619f611b4404809ab05e822c01c
@@ -39,6 +39,10 @@ class Licensee
39
39
 
40
40
  HIDDEN_LICENSES = %w[other no-license]
41
41
 
42
+ # Licenses that technically contain the license name or nickname
43
+ # But we are so short that GitMatcher may not catch if rewrapped
44
+ BODY_INCLUDES_WHITELIST = %w[mit]
45
+
42
46
  include Licensee::ContentHelper
43
47
 
44
48
  def initialize(key)
@@ -129,10 +133,12 @@ class Licensee
129
133
  end
130
134
 
131
135
  def body_includes_name?
136
+ return false if BODY_INCLUDES_WHITELIST.include?(key)
132
137
  @body_includes_name ||= body_normalized.include?(name_without_version.downcase)
133
138
  end
134
139
 
135
140
  def body_includes_nickname?
141
+ return false if BODY_INCLUDES_WHITELIST.include?(key)
136
142
  @body_includes_nickname ||= !!(nickname && body_normalized.include?(nickname.downcase))
137
143
  end
138
144
 
@@ -1,3 +1,3 @@
1
1
  class Licensee
2
- VERSION = "5.0.0b6"
2
+ VERSION = "5.0.0b7"
3
3
  end
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015 Ben Balter
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a
4
+ copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included
11
+ in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
17
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19
+ OTHER DEALINGS IN THE SOFTWARE.
@@ -51,4 +51,11 @@ class TestLicenseeCopyrightMatcher < Minitest::Test
51
51
  file = Licensee::ProjectFile.new(blob, "LICENSE")
52
52
  assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key
53
53
  end
54
+
55
+ should "match comma, separated dates" do
56
+ text = "Copyright (c) 2003, 2004 Ben Balter"
57
+ blob = FakeBlob.new(text)
58
+ file = Licensee::ProjectFile.new(blob, "LICENSE")
59
+ assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key
60
+ end
54
61
  end
@@ -68,10 +68,17 @@ class TestLicenseeProject < Minitest::Test
68
68
  end
69
69
  end
70
70
 
71
- should "detect the MIT license even with the title removed" do
72
- verify_license_file fixture_path("mit-without-title/mit.txt")
71
+ describe "mit license with title removed" do
72
+ should "detect the MIT license" do
73
+ verify_license_file fixture_path("mit-without-title/mit.txt")
74
+ end
75
+
76
+ should "should detect the MIT license when rewrapped" do
77
+ verify_license_file fixture_path("mit-without-title-rewrapped/mit.txt")
78
+ end
73
79
  end
74
80
 
81
+
75
82
  describe "packages" do
76
83
 
77
84
  def setup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensee
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0b6
4
+ version: 5.0.0b7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-02 00:00:00.000000000 Z
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -152,6 +152,7 @@ files:
152
152
  - test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.pack
153
153
  - test/fixtures/licenses.git/packed-refs
154
154
  - test/fixtures/licenses.git/refs/heads/master
155
+ - test/fixtures/mit-without-title-rewrapped/mit.txt
155
156
  - test/fixtures/mit-without-title/mit.txt
156
157
  - test/fixtures/named-license-file-prefix.git/HEAD
157
158
  - test/fixtures/named-license-file-prefix.git/config