peer_review 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peer_review.rb +21 -7
- data/lib/peer_review/version.rb +3 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e68bfb1ef53c6aff404f1a4b517d1fc7fb477b58
|
4
|
+
data.tar.gz: caa901328c653ba0fdc6bc8cfbafc1f3fd16dc93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d05117088cfa64c4527a8b58c3ad07df4a9266723daaa763738cd29d1a32a77ba82f5061516d83af19e5e4315f6a7e274a83488ccf6390950dee2af95c2ba00
|
7
|
+
data.tar.gz: 5be608b2fd245e50ec42bdfd49f2f9dfc8224304d9d07933bc7541f1d17ef9895e568d709a568d1fabf71293fd80f84878b9db6494d4f6966dc6c24b7ea1a5de
|
data/lib/peer_review.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'naughty_or_nice'
|
2
2
|
|
3
|
-
class PeerReview
|
3
|
+
class PeerReview
|
4
|
+
|
5
|
+
include NaughtyOrNice
|
6
|
+
|
4
7
|
class << self
|
5
8
|
# returns an instance of our custom public suffix list
|
6
9
|
# list behaves like PublicSuffix::List but is limited to our whitelisted domains
|
@@ -10,20 +13,31 @@ class PeerReview < NaughtyOrNice
|
|
10
13
|
|
11
14
|
# Returns the absolute path to the domain list
|
12
15
|
def list_path
|
13
|
-
File.
|
16
|
+
File.join(config_path,"domains.txt")
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def config_path
|
22
|
+
File.join(File.dirname(__FILE__), "../config")
|
23
|
+
end
|
24
|
+
|
25
|
+
def list_contents
|
26
|
+
@list_contents ||= File.new(list_path, "r:utf-8").read
|
14
27
|
end
|
15
28
|
end
|
16
29
|
|
17
30
|
# Checks if the input string represents a research domain
|
18
31
|
def valid?
|
19
32
|
# Ensure it's a valid domain
|
20
|
-
return false unless
|
33
|
+
return false unless domain && domain.valid?
|
21
34
|
|
22
35
|
# check using public suffix's standard logic
|
23
|
-
rule = PeerReview.list.find
|
24
|
-
return true if !rule.nil? && rule.allow?(domain)
|
36
|
+
rule = PeerReview.list.find(to_s)
|
25
37
|
|
26
|
-
#
|
27
|
-
|
38
|
+
# domain is on the domain list and
|
39
|
+
# domain is not explicitly blacklisted and
|
40
|
+
# domain matches a standard public suffix list rule
|
41
|
+
!rule.nil? && rule.type != :exception && rule.allow?(".#{domain}")
|
28
42
|
end
|
29
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peer_review
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: naughty_or_nice
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- Rakefile
|
78
78
|
- config/domains.txt
|
79
79
|
- lib/peer_review.rb
|
80
|
+
- lib/peer_review/version.rb
|
80
81
|
homepage: http://github.com/benbalter/peer_review
|
81
82
|
licenses:
|
82
83
|
- MIT
|
@@ -97,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
98
|
version: '0'
|
98
99
|
requirements: []
|
99
100
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.4.8
|
101
102
|
signing_key:
|
102
103
|
specification_version: 4
|
103
104
|
summary: Validates whether a given email, url, or domain belongs to a research institution..
|