peer_review 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/README.md +13 -0
- data/Rakefile +13 -0
- data/config/domains.txt +42 -0
- data/lib/peer_review.rb +29 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c146a78534c8df5a4bc020c9740deac51d964e31
|
4
|
+
data.tar.gz: 361d308c908e9fd9702f25c0aaaa971294078964
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e500dfb2f56921961ba58849c617b4d9bdd0238414fc1740de3468e39ba2b1978aa56b4b6b61afcfd30bd9128aa1b8a6792d9e004130dbd415dcae1d3109f386
|
7
|
+
data.tar.gz: f3ed0d150874ad14fd5da175c48925ab344ede884174cffd2da0b0b740940d139b3197db1a606b632be9cacbf7b825c47709e9a52b7609f9b17bf93e77f89af4
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ben Balter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Peer Review
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/peer_review.svg)](http://badge.fury.io/rb/peer_review) [![Build Status](https://travis-ci.org/benbalter/peer_review.svg)](https://travis-ci.org/benbalter/peer_review)
|
4
|
+
|
5
|
+
Like [Gman](https://github.com/benbalter/gman), Peer Review extends [Naughty Or Nice](https://github.com/benbalter/naughty_or_nice) to validate whether a given email, url, or domain belongs to a research institution.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Labrador.valid? `foo@nih.gov` #=> true
|
11
|
+
Labrador.valid? `http://sandia.gov` #=> true
|
12
|
+
Labrador.valid? `github.com` #=> false
|
13
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |test|
|
5
|
+
test.libs << 'lib' << 'test'
|
6
|
+
test.pattern = 'test/**/test_peer_review*.rb'
|
7
|
+
test.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Open console with Peer Review loaded"
|
11
|
+
task :console do
|
12
|
+
exec "pry -r ./lib/peer_review.rb"
|
13
|
+
end
|
data/config/domains.txt
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
//US National Labs
|
2
|
+
anl.gov
|
3
|
+
bnl.gov
|
4
|
+
fnal.gov
|
5
|
+
inl.gov
|
6
|
+
lanl.gov
|
7
|
+
lbl.gov
|
8
|
+
llnl.gov
|
9
|
+
nist.gov
|
10
|
+
nrel.gov
|
11
|
+
ornl.gov
|
12
|
+
pnnl.gov
|
13
|
+
sandia.gov
|
14
|
+
|
15
|
+
//US Research Agencies
|
16
|
+
jpl.nasa.gov
|
17
|
+
nifa.usda.gov
|
18
|
+
nih.gov
|
19
|
+
|
20
|
+
// CSIRO (Australia)
|
21
|
+
csiro.au
|
22
|
+
|
23
|
+
// Candada's Perimeter Institute for Theoretical Physics
|
24
|
+
perimeterinstitute.ca
|
25
|
+
|
26
|
+
// CERN
|
27
|
+
cern.ch
|
28
|
+
|
29
|
+
// UK Laboratories
|
30
|
+
ebi.ac.uk
|
31
|
+
npl.co.uk
|
32
|
+
sanger.ac.uk
|
33
|
+
|
34
|
+
// UK funding agencies
|
35
|
+
ahrc.ac.uk
|
36
|
+
bbsrc.ac.uk
|
37
|
+
epsrc.ac.uk
|
38
|
+
esrc.ac.uk
|
39
|
+
mrc.ac.uk
|
40
|
+
nerc.ac.uk
|
41
|
+
stfc.ac.uk
|
42
|
+
wellcome.ac.uk
|
data/lib/peer_review.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'naughty_or_nice'
|
2
|
+
|
3
|
+
class PeerReview < NaughtyOrNice
|
4
|
+
class << self
|
5
|
+
# returns an instance of our custom public suffix list
|
6
|
+
# list behaves like PublicSuffix::List but is limited to our whitelisted domains
|
7
|
+
def list
|
8
|
+
@list ||= PublicSuffix::List::parse(File.new(list_path, "r:utf-8"))
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the absolute path to the domain list
|
12
|
+
def list_path
|
13
|
+
File.expand_path("../config/domains.txt", File.dirname(__FILE__))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Checks if the input string represents a research domain
|
18
|
+
def valid?
|
19
|
+
# Ensure it's a valid domain
|
20
|
+
return false unless PublicSuffix.valid?(domain)
|
21
|
+
|
22
|
+
# check using public suffix's standard logic
|
23
|
+
rule = PeerReview.list.find domain
|
24
|
+
return true if !rule.nil? && rule.allow?(domain)
|
25
|
+
|
26
|
+
# also allow for explicit matches to domain list
|
27
|
+
PeerReview.list.rules.any? { |rule| rule.value == domain }
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: peer_review
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Balter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: naughty_or_nice
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shoulda
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.3'
|
69
|
+
description: Checks the suitability of your peers.
|
70
|
+
email: ben.balter@github.com
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- LICENSE.md
|
76
|
+
- README.md
|
77
|
+
- Rakefile
|
78
|
+
- config/domains.txt
|
79
|
+
- lib/peer_review.rb
|
80
|
+
homepage: http://github.com/benbalter/peer_review
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.2.0
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Validates whether a given email, url, or domain belongs to a research institution..
|
104
|
+
test_files: []
|