licensee 4.7.2 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/licensee.rb +1 -1
- data/lib/licensee/license_file.rb +1 -1
- data/lib/licensee/matchers/copyright_matcher.rb +3 -1
- data/lib/licensee/project.rb +2 -2
- data/lib/licensee/version.rb +1 -1
- data/test/test_licensee_copyright_matcher.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fab96ab59af3a4a833c477146b855cd1378e1b3
|
4
|
+
data.tar.gz: 02e9e05ef12c5692e9a863e7e98fd6c42074e6f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9facdb5802dcc399d23dcd3cc9adcd317c740da3e276d6da8ffa0941a19bf1cad33417780b85be35fe349dd7ceb4a95fbde24b55ce0ff6a58b602741b1ed411c
|
7
|
+
data.tar.gz: 3bfed7331ecb9265253da64fd448a8892940692e5d13f0f3f63301d7e2604d2a76d0d019d27536f78cce82382b7e37cf7c9d47ddefaf9db117f3f1b1e5dae0cc
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
*A Ruby Gem to detect under what license a project is distributed.*
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/benbalter/licensee.svg)](https://travis-ci.org/benbalter/licensee) [![Gem Version](https://badge.fury.io/rb/licensee.svg)](http://badge.fury.io/rb/licensee)
|
5
|
+
[![Build Status](https://travis-ci.org/benbalter/licensee.svg?branch=master)](https://travis-ci.org/benbalter/licensee) [![Gem Version](https://badge.fury.io/rb/licensee.svg)](http://badge.fury.io/rb/licensee)
|
6
6
|
|
7
7
|
## The problem
|
8
8
|
|
data/lib/licensee.rb
CHANGED
@@ -17,7 +17,7 @@ require_relative "licensee/matchers/levenshtein_matcher"
|
|
17
17
|
|
18
18
|
class Licensee
|
19
19
|
|
20
|
-
# Over
|
20
|
+
# Over which percent is a match considered a match
|
21
21
|
CONFIDENCE_THRESHOLD = 90
|
22
22
|
|
23
23
|
# Base domain from which to build license URLs
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class Licensee
|
2
2
|
class CopyrightMatcher < Matcher
|
3
3
|
|
4
|
-
REGEX = /\
|
4
|
+
REGEX = /\ACopyright (©|\(c\)|\xC2\xA9)? ?\d{4}.*?\n?\z/i
|
5
5
|
|
6
6
|
def match
|
7
7
|
no_license if file.content.strip =~ REGEX
|
8
|
+
rescue
|
9
|
+
nil
|
8
10
|
end
|
9
11
|
|
10
12
|
def confidence
|
data/lib/licensee/project.rb
CHANGED
@@ -38,10 +38,10 @@ class Licensee
|
|
38
38
|
#
|
39
39
|
# filename - (string) the name of the file to score
|
40
40
|
#
|
41
|
-
# Returns 1.0 if the file is
|
41
|
+
# Returns 1.0 if the file is definitely a license file
|
42
42
|
# Returns 0.75 if the file is probably a license file
|
43
43
|
# Returns 0.5 if the file is likely a license file
|
44
|
-
# Returns 0.0 if the file is
|
44
|
+
# Returns 0.0 if the file is definitely not a license file
|
45
45
|
def self.match_license_file(filename)
|
46
46
|
return 1.0 if filename =~ /\A(un)?licen[sc]e(\.[^.]+)?\z/i
|
47
47
|
return 0.75 if filename =~ /\Acopy(ing|right)(\.[^.]+)?\z/i
|
data/lib/licensee/version.rb
CHANGED
@@ -43,4 +43,11 @@ class TestLicenseeCopyrightMatcher < Minitest::Test
|
|
43
43
|
file = Licensee::LicenseFile.new(blob)
|
44
44
|
assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
|
+
should "handle ASCII-8BIT encoded copyright notices" do
|
48
|
+
text = "Copyright \xC2\xA92015 Ben Balter`".force_encoding("ASCII-8BIT")
|
49
|
+
blob = FakeBlob.new(text)
|
50
|
+
file = Licensee::LicenseFile.new(blob)
|
51
|
+
assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key
|
52
|
+
end
|
53
|
+
end
|
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: 4.7.
|
4
|
+
version: 4.7.3
|
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-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|