swot 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/README.md +1 -2
- data/Rakefile +33 -1
- data/VERSION +1 -1
- data/lib/domains/ac.in/gtu +1 -0
- data/lib/domains/ac.in/srmuniv +1 -0
- data/lib/domains/ac.in/unipune +1 -0
- data/lib/domains/ac.nz/uclive +1 -0
- data/lib/domains/com/ionis-stm +1 -0
- data/lib/domains/de/uni-marburg +1 -1
- data/lib/domains/de/uni-weimar +1 -1
- data/lib/domains/eu/epitech +1 -0
- data/lib/domains/fi/arcada +1 -0
- data/lib/domains/fr/epita +1 -1
- data/lib/domains/fr/ipsa +1 -1
- data/lib/domains/fr/supbiotech +1 -0
- data/lib/domains/fr/supinternet +1 -0
- data/lib/domains/hu/uni-corvinus +1 -0
- data/lib/domains/net/e-artsup +1 -0
- data/lib/domains/net/etna-alternance +1 -0
- data/lib/domains/nl/roceindhoven +1 -0
- data/lib/domains/nl/summacollege +1 -0
- data/lib/domains/org/toulouse-bs +1 -0
- data/lib/domains/wroc.pl/pwr +1 -2
- data/lib/swot.rb +11 -130
- data/lib/swot/academic_tlds.rb +169 -0
- data/swot.gemspec +30 -16
- data/test/helper.rb +1 -5
- data/test/test_swot.rb +14 -7
- metadata +30 -16
- data/lib/domains/edu.in/gtu +0 -1
- data/lib/domains/edu.in/srmuniv +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffc471d485321f206ee5c7e57264ec048b14727f
|
4
|
+
data.tar.gz: 9b37fd54641bf15c60ba17d9329f5714f9aece1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d0959ea08f1046314c412a3de1da49787808ecd375caf21c3d27c208aa4179ce8f6263288232265914e04894c045dbdf8ff59cf1e94777b9ebea94f69ccb2ee
|
7
|
+
data.tar.gz: 9668e4d5916f70f16a317455a73cdf83a0fc77d8cd6c64c6f802276a281893dc71e8481c9eec8f8dbd4569990daf43bef9ee2d1108eb8a6214639bf0f678c905
|
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@ source "http://rubygems.org"
|
|
3
3
|
gem 'public_suffix'
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem "
|
7
|
-
gem "
|
6
|
+
gem "nokogiri", "~> 1.5"
|
7
|
+
gem "rake", "~> 10.0"
|
8
8
|
gem "rdoc", "~> 3.12"
|
9
|
-
gem "bundler", "~> 1.5
|
10
|
-
gem "jeweler", "~> 1.8
|
9
|
+
gem "bundler", "~> 1.5"
|
10
|
+
gem "jeweler", "~> 1.8"
|
11
11
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Swot :apple:
|
2
2
|
|
3
|
-
[](https://travis-ci.org/leereilly/swot) ](https://travis-ci.org/leereilly/swot) [](http://badge.fury.io/rb/swot)
|
4
4
|
|
5
5
|
If you have a product or service and offer **academic discounts**, there's a good chance there's some manual component to the approval process. Perhaps `.edu` email addresses are automatically approved because, for the most part at least, they're associated with American post-secondary educational institutions. Perhaps `.ac.uk` email addresses are automatically approved because they're guaranteed to belong to British universities and colleges. Unfortunately, not every country has an education-specific TLD (Top Level Domain) and plenty of schools use `.com` or `.net`.
|
6
6
|
|
@@ -106,4 +106,3 @@ If you verified this by visiting all of the websites, how long did it take you?
|
|
106
106
|
### See Also
|
107
107
|
|
108
108
|
* [gman](https://github.com/benbalter/gman) - like swot, but for government emails
|
109
|
-
|
data/Rakefile
CHANGED
@@ -61,4 +61,36 @@ task :add, :sld, :tld, :name do |t, args|
|
|
61
61
|
puts "commit failed"
|
62
62
|
end
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
65
|
+
|
66
|
+
task :quackit_import do
|
67
|
+
require 'nokogiri'
|
68
|
+
require 'open-uri'
|
69
|
+
require_relative File.join('lib', 'swot', 'academic_tlds')
|
70
|
+
|
71
|
+
new_domains = Set.new
|
72
|
+
doc = Nokogiri::HTML(open('http://www.quackit.com/domain-names/country_domain_extensions.cfm'))
|
73
|
+
doc.css('#content li').each do |li|
|
74
|
+
desc = li.content.split(/\s+-\s+/, 2)[1]
|
75
|
+
if desc =~ /academic|education|school/i
|
76
|
+
domain_el = li.at_css('b')
|
77
|
+
# some lines have more than one domain listed
|
78
|
+
domains = domain_el.content.split(/\s*\/\s*/)
|
79
|
+
domains.each do |domain|
|
80
|
+
# remove leading space
|
81
|
+
domain = domain.strip.sub(/\A\./, '')
|
82
|
+
unless Swot::ACADEMIC_TLDS.include?(domain)
|
83
|
+
# print out for manual review
|
84
|
+
puts "#{domain} - #{desc.strip.gsub(/\s+/, ' ')}"
|
85
|
+
new_domains << domain
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
puts "\nNEW DOMAINS (#{new_domains.size}):\n\n"
|
92
|
+
|
93
|
+
new_domains.each do |domain|
|
94
|
+
puts domain
|
95
|
+
end
|
96
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.1
|
@@ -0,0 +1 @@
|
|
1
|
+
Gujarat Technological University
|
@@ -0,0 +1 @@
|
|
1
|
+
SRM University
|
@@ -0,0 +1 @@
|
|
1
|
+
University of Pune
|
@@ -0,0 +1 @@
|
|
1
|
+
University of Canterbury
|
@@ -0,0 +1 @@
|
|
1
|
+
Ionis School of Technology and Management
|
data/lib/domains/de/uni-marburg
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Philipps-Universität Marburg
|
data/lib/domains/de/uni-weimar
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Bauhaus
|
1
|
+
Bauhaus-Universität Weimar
|
@@ -0,0 +1 @@
|
|
1
|
+
École de l'Innovation et de l'Expertise Informatique
|
@@ -0,0 +1 @@
|
|
1
|
+
Arcada University of Applied Sciences
|
data/lib/domains/fr/epita
CHANGED
@@ -1 +1 @@
|
|
1
|
-
École Pour l'Informatique et les Techniques Avancées
|
1
|
+
École Pour l'Informatique et les Techniques Avancées
|
data/lib/domains/fr/ipsa
CHANGED
@@ -1 +1 @@
|
|
1
|
-
École d'
|
1
|
+
École d'Ingénieurs de l'Air et de l'Espace
|
@@ -0,0 +1 @@
|
|
1
|
+
École des Experts en Biotechnologies
|
@@ -0,0 +1 @@
|
|
1
|
+
École Supérieure des Métiers de l'Internet
|
@@ -0,0 +1 @@
|
|
1
|
+
Corvinus University of Budapest
|
@@ -0,0 +1 @@
|
|
1
|
+
École de la Passion Créative
|
@@ -0,0 +1 @@
|
|
1
|
+
École de la Nouvelle Alternance en Informatique
|
@@ -0,0 +1 @@
|
|
1
|
+
Regional Community College of Eindhoven
|
@@ -0,0 +1 @@
|
|
1
|
+
Regional Community College of Eindhoven
|
@@ -0,0 +1 @@
|
|
1
|
+
Toulouse Business School
|
data/lib/domains/wroc.pl/pwr
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
Technical University of Wroclaw
|
1
|
+
Wrocław University of Technology
|
data/lib/swot.rb
CHANGED
@@ -1,134 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "public_suffix"
|
2
|
+
require File.join(File.dirname(__FILE__), "swot", "academic_tlds.rb")
|
2
3
|
|
3
4
|
module Swot
|
4
5
|
VERSION = "0.3.0"
|
5
6
|
|
6
|
-
# These top-level domains are guaranteed to be academic institutions.
|
7
|
-
ACADEMIC_TLDS = {
|
8
|
-
'ac.ae' => 1,
|
9
|
-
'ac.at' => 1,
|
10
|
-
'ac.bd' => 1,
|
11
|
-
'ac.be' => 1,
|
12
|
-
'ac.cr' => 1,
|
13
|
-
'ac.cy' => 1,
|
14
|
-
'ac.fj' => 1,
|
15
|
-
'ac.id' => 1,
|
16
|
-
'ac.il' => 1,
|
17
|
-
'ac.ir' => 1,
|
18
|
-
'ac.jp' => 1,
|
19
|
-
'ac.ke' => 1,
|
20
|
-
'ac.kr' => 1,
|
21
|
-
'ac.ma' => 1,
|
22
|
-
'ac.mu' => 1,
|
23
|
-
'ac.mw' => 1,
|
24
|
-
'ac.mz' => 1,
|
25
|
-
'ac.nz' => 1,
|
26
|
-
'ac.pa' => 1,
|
27
|
-
'ac.pg' => 1,
|
28
|
-
'ac.rs' => 1,
|
29
|
-
'ac.ru' => 1,
|
30
|
-
'ac.rw' => 1,
|
31
|
-
'ac.th' => 1,
|
32
|
-
'ac.tz' => 1,
|
33
|
-
'ac.ug' => 1,
|
34
|
-
'ac.uk' => 1,
|
35
|
-
'ac.yu' => 1,
|
36
|
-
'ac.za' => 1,
|
37
|
-
'ac.zm' => 1,
|
38
|
-
'ac.zw' => 1,
|
39
|
-
'edu' => 1,
|
40
|
-
'edu.af' => 1,
|
41
|
-
'edu.al' => 1,
|
42
|
-
'edu.ar' => 1,
|
43
|
-
'edu.au' => 1,
|
44
|
-
'edu.az' => 1,
|
45
|
-
'edu.ba' => 1,
|
46
|
-
'edu.bb' => 1,
|
47
|
-
'edu.bd' => 1,
|
48
|
-
'edu.bh' => 1,
|
49
|
-
'edu.bi' => 1,
|
50
|
-
'edu.bn' => 1,
|
51
|
-
'edu.bo' => 1,
|
52
|
-
'edu.br' => 1,
|
53
|
-
'edu.bs' => 1,
|
54
|
-
'edu.bt' => 1,
|
55
|
-
'edu.bz' => 1,
|
56
|
-
'edu.co' => 1,
|
57
|
-
'edu.cu' => 1,
|
58
|
-
'edu.do' => 1,
|
59
|
-
'edu.dz' => 1,
|
60
|
-
'edu.ec' => 1,
|
61
|
-
'edu.ee' => 1,
|
62
|
-
'edu.eg' => 1,
|
63
|
-
'edu.er' => 1,
|
64
|
-
'edu.es' => 1,
|
65
|
-
'edu.et' => 1,
|
66
|
-
'edu.ge' => 1,
|
67
|
-
'edu.gh' => 1,
|
68
|
-
'edu.gr' => 1,
|
69
|
-
'edu.gt' => 1,
|
70
|
-
'edu.hk' => 1,
|
71
|
-
'edu.hn' => 1,
|
72
|
-
'edu.ht' => 1,
|
73
|
-
'edu.iq' => 1,
|
74
|
-
'edu.jm' => 1,
|
75
|
-
'edu.jo' => 1,
|
76
|
-
'edu.kg' => 1,
|
77
|
-
'edu.kh' => 1,
|
78
|
-
'edu.kn' => 1,
|
79
|
-
'edu.kw' => 1,
|
80
|
-
'edu.ky' => 1,
|
81
|
-
'edu.kz' => 1,
|
82
|
-
'edu.la' => 1,
|
83
|
-
'edu.lb' => 1,
|
84
|
-
'edu.lv' => 1,
|
85
|
-
'edu.ly' => 1,
|
86
|
-
'edu.mk' => 1,
|
87
|
-
'edu.mm' => 1,
|
88
|
-
'edu.mn' => 1,
|
89
|
-
'edu.mo' => 1,
|
90
|
-
'edu.mt' => 1,
|
91
|
-
'edu.mx' => 1,
|
92
|
-
'edu.my' => 1,
|
93
|
-
'edu.ni' => 1,
|
94
|
-
'edu.np' => 1,
|
95
|
-
'edu.om' => 1,
|
96
|
-
'edu.pa' => 1,
|
97
|
-
'edu.pe' => 1,
|
98
|
-
'edu.ph' => 1,
|
99
|
-
'edu.pk' => 1,
|
100
|
-
'edu.pl' => 1,
|
101
|
-
'edu.pr' => 1,
|
102
|
-
'edu.ps' => 1,
|
103
|
-
'edu.pt' => 1,
|
104
|
-
'edu.py' => 1,
|
105
|
-
'edu.qa' => 1,
|
106
|
-
'edu.rs' => 1,
|
107
|
-
'edu.ru' => 1,
|
108
|
-
'edu.sa' => 1,
|
109
|
-
'edu.sd' => 1,
|
110
|
-
'edu.sg' => 1,
|
111
|
-
'edu.sv' => 1,
|
112
|
-
'edu.sy' => 1,
|
113
|
-
'edu.tr' => 1,
|
114
|
-
'edu.tt' => 1,
|
115
|
-
'edu.tw' => 1,
|
116
|
-
'edu.ua' => 1,
|
117
|
-
'edu.uy' => 1,
|
118
|
-
'edu.ve' => 1,
|
119
|
-
'edu.vn' => 1,
|
120
|
-
'edu.ws' => 1,
|
121
|
-
'edu.ye' => 1,
|
122
|
-
'edu.zm' => 1,
|
123
|
-
'vic.edu.au' => 1,
|
124
|
-
}
|
125
|
-
|
126
7
|
# These are domains that snuck into the edu registry,
|
127
8
|
# but don't pass the education sniff test
|
128
|
-
# Note: domain must
|
129
|
-
BLACKLIST =
|
130
|
-
|
131
|
-
|
9
|
+
# Note: validated domain must not end with the blacklisted string
|
10
|
+
BLACKLIST = %w(
|
11
|
+
si.edu
|
12
|
+
).freeze
|
132
13
|
|
133
14
|
class << self
|
134
15
|
|
@@ -140,11 +21,11 @@ module Swot
|
|
140
21
|
return false if text.nil?
|
141
22
|
begin
|
142
23
|
domain = get_domain(text)
|
143
|
-
|
144
|
-
|
145
|
-
|
24
|
+
if domain.nil?
|
25
|
+
false
|
26
|
+
elsif BLACKLIST.any? { |d| domain.name =~ /(\A|\.)#{Regexp.escape(d)}\z/ }
|
146
27
|
false
|
147
|
-
elsif ACADEMIC_TLDS
|
28
|
+
elsif ACADEMIC_TLDS.include?(domain.tld)
|
148
29
|
true
|
149
30
|
elsif match_academic_domain?(domain)
|
150
31
|
true
|
@@ -174,7 +55,7 @@ module Swot
|
|
174
55
|
# Returns true if the domain name belongs to a known academic institution;
|
175
56
|
# false otherwise.
|
176
57
|
def match_academic_domain?(domain)
|
177
|
-
File.exists?(get_path(domain))
|
58
|
+
File.exists?(get_path(domain)) if domain.tld && domain.sld
|
178
59
|
end
|
179
60
|
|
180
61
|
# Figure out the institutions' name based on the domain name.
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
module Swot
|
4
|
+
# These top-level domains are guaranteed to be academic institutions.
|
5
|
+
ACADEMIC_TLDS = %w(
|
6
|
+
ac.ae
|
7
|
+
ac.at
|
8
|
+
ac.bd
|
9
|
+
ac.be
|
10
|
+
ac.cn
|
11
|
+
ac.cr
|
12
|
+
ac.cy
|
13
|
+
ac.fj
|
14
|
+
ac.gg
|
15
|
+
ac.gn
|
16
|
+
ac.id
|
17
|
+
ac.il
|
18
|
+
ac.in
|
19
|
+
ac.ir
|
20
|
+
ac.jp
|
21
|
+
ac.ke
|
22
|
+
ac.kr
|
23
|
+
ac.ma
|
24
|
+
ac.me
|
25
|
+
ac.mu
|
26
|
+
ac.mw
|
27
|
+
ac.mz
|
28
|
+
ac.ni
|
29
|
+
ac.nz
|
30
|
+
ac.om
|
31
|
+
ac.pa
|
32
|
+
ac.pg
|
33
|
+
ac.pr
|
34
|
+
ac.rs
|
35
|
+
ac.ru
|
36
|
+
ac.rw
|
37
|
+
ac.sz
|
38
|
+
ac.th
|
39
|
+
ac.tz
|
40
|
+
ac.ug
|
41
|
+
ac.uk
|
42
|
+
ac.yu
|
43
|
+
ac.za
|
44
|
+
ac.zm
|
45
|
+
ac.zw
|
46
|
+
ed.ao
|
47
|
+
ed.cr
|
48
|
+
ed.jp
|
49
|
+
edu
|
50
|
+
edu.af
|
51
|
+
edu.al
|
52
|
+
edu.ar
|
53
|
+
edu.au
|
54
|
+
edu.az
|
55
|
+
edu.ba
|
56
|
+
edu.bb
|
57
|
+
edu.bd
|
58
|
+
edu.bh
|
59
|
+
edu.bi
|
60
|
+
edu.bn
|
61
|
+
edu.bo
|
62
|
+
edu.br
|
63
|
+
edu.bs
|
64
|
+
edu.bt
|
65
|
+
edu.bz
|
66
|
+
edu.ck
|
67
|
+
edu.cn
|
68
|
+
edu.co
|
69
|
+
edu.cu
|
70
|
+
edu.do
|
71
|
+
edu.dz
|
72
|
+
edu.ec
|
73
|
+
edu.ee
|
74
|
+
edu.eg
|
75
|
+
edu.er
|
76
|
+
edu.es
|
77
|
+
edu.et
|
78
|
+
edu.ge
|
79
|
+
edu.gh
|
80
|
+
edu.gr
|
81
|
+
edu.gt
|
82
|
+
edu.hk
|
83
|
+
edu.hn
|
84
|
+
edu.ht
|
85
|
+
edu.in
|
86
|
+
edu.iq
|
87
|
+
edu.jm
|
88
|
+
edu.jo
|
89
|
+
edu.kg
|
90
|
+
edu.kh
|
91
|
+
edu.kn
|
92
|
+
edu.kw
|
93
|
+
edu.ky
|
94
|
+
edu.kz
|
95
|
+
edu.la
|
96
|
+
edu.lb
|
97
|
+
edu.lr
|
98
|
+
edu.lv
|
99
|
+
edu.ly
|
100
|
+
edu.me
|
101
|
+
edu.mg
|
102
|
+
edu.mk
|
103
|
+
edu.ml
|
104
|
+
edu.mm
|
105
|
+
edu.mn
|
106
|
+
edu.mo
|
107
|
+
edu.mt
|
108
|
+
edu.mv
|
109
|
+
edu.mw
|
110
|
+
edu.mx
|
111
|
+
edu.my
|
112
|
+
edu.ni
|
113
|
+
edu.np
|
114
|
+
edu.om
|
115
|
+
edu.pa
|
116
|
+
edu.pe
|
117
|
+
edu.ph
|
118
|
+
edu.pk
|
119
|
+
edu.pl
|
120
|
+
edu.pr
|
121
|
+
edu.ps
|
122
|
+
edu.pt
|
123
|
+
edu.pw
|
124
|
+
edu.py
|
125
|
+
edu.qa
|
126
|
+
edu.rs
|
127
|
+
edu.ru
|
128
|
+
edu.sa
|
129
|
+
edu.sc
|
130
|
+
edu.sd
|
131
|
+
edu.sg
|
132
|
+
edu.sh
|
133
|
+
edu.sl
|
134
|
+
edu.sv
|
135
|
+
edu.sy
|
136
|
+
edu.tr
|
137
|
+
edu.tt
|
138
|
+
edu.tw
|
139
|
+
edu.ua
|
140
|
+
edu.uy
|
141
|
+
edu.ve
|
142
|
+
edu.vn
|
143
|
+
edu.ws
|
144
|
+
edu.ye
|
145
|
+
edu.zm
|
146
|
+
es.kr
|
147
|
+
g12.br
|
148
|
+
hs.kr
|
149
|
+
ms.kr
|
150
|
+
sc.kr
|
151
|
+
sc.ug
|
152
|
+
sch.ae
|
153
|
+
sch.gg
|
154
|
+
sch.id
|
155
|
+
sch.ir
|
156
|
+
sch.je
|
157
|
+
sch.jo
|
158
|
+
sch.lk
|
159
|
+
sch.ly
|
160
|
+
sch.my
|
161
|
+
sch.om
|
162
|
+
sch.ps
|
163
|
+
sch.sa
|
164
|
+
sch.uk
|
165
|
+
school.nz
|
166
|
+
school.za
|
167
|
+
vic.edu.au
|
168
|
+
).to_set.freeze
|
169
|
+
end
|
data/swot.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "swot"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lee Reilly"]
|
12
|
-
s.date = "2014-
|
12
|
+
s.date = "2014-06-19"
|
13
13
|
s.description = "email helpers"
|
14
14
|
s.email = "lee@leereilly.net"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -336,6 +336,7 @@ Gem::Specification.new do |s|
|
|
336
336
|
"lib/domains/ac.in/bitmesra",
|
337
337
|
"lib/domains/ac.in/bits-pilani",
|
338
338
|
"lib/domains/ac.in/daiict",
|
339
|
+
"lib/domains/ac.in/gtu",
|
339
340
|
"lib/domains/ac.in/iiita",
|
340
341
|
"lib/domains/ac.in/iiitd",
|
341
342
|
"lib/domains/ac.in/iiitdmj",
|
@@ -350,6 +351,8 @@ Gem::Specification.new do |s|
|
|
350
351
|
"lib/domains/ac.in/nirmauni",
|
351
352
|
"lib/domains/ac.in/nitc",
|
352
353
|
"lib/domains/ac.in/sastra",
|
354
|
+
"lib/domains/ac.in/srmuniv",
|
355
|
+
"lib/domains/ac.in/unipune",
|
353
356
|
"lib/domains/ac.in/vit",
|
354
357
|
"lib/domains/ac.in/vvpedulink",
|
355
358
|
"lib/domains/ac.ir/acmt",
|
@@ -1007,6 +1010,7 @@ Gem::Specification.new do |s|
|
|
1007
1010
|
"lib/domains/ac.nz/massey",
|
1008
1011
|
"lib/domains/ac.nz/openpolytechnic",
|
1009
1012
|
"lib/domains/ac.nz/otago",
|
1013
|
+
"lib/domains/ac.nz/uclive",
|
1010
1014
|
"lib/domains/ac.nz/vuw",
|
1011
1015
|
"lib/domains/ac.nz/waikato",
|
1012
1016
|
"lib/domains/ac.pa/institutoteima",
|
@@ -1903,6 +1907,7 @@ Gem::Specification.new do |s|
|
|
1903
1907
|
"lib/domains/com/icn-nancy",
|
1904
1908
|
"lib/domains/com/icsw",
|
1905
1909
|
"lib/domains/com/imi-luzern",
|
1910
|
+
"lib/domains/com/ionis-stm",
|
1906
1911
|
"lib/domains/com/isbm-school",
|
1907
1912
|
"lib/domains/com/islamicug",
|
1908
1913
|
"lib/domains/com/iu-travnik",
|
@@ -3152,8 +3157,6 @@ Gem::Specification.new do |s|
|
|
3152
3157
|
"lib/domains/edu.hn/upnfm",
|
3153
3158
|
"lib/domains/edu.hn/usps",
|
3154
3159
|
"lib/domains/edu.ht/ueh",
|
3155
|
-
"lib/domains/edu.in/gtu",
|
3156
|
-
"lib/domains/edu.in/srmuniv",
|
3157
3160
|
"lib/domains/edu.iq/auis",
|
3158
3161
|
"lib/domains/edu.iq/muc",
|
3159
3162
|
"lib/domains/edu.iq/nahrainuniv",
|
@@ -6199,6 +6202,7 @@ Gem::Specification.new do |s|
|
|
6199
6202
|
"lib/domains/eu/carolus-magnus-university",
|
6200
6203
|
"lib/domains/eu/coleurope",
|
6201
6204
|
"lib/domains/eu/ensam",
|
6205
|
+
"lib/domains/eu/epitech",
|
6202
6206
|
"lib/domains/eu/escpeurope",
|
6203
6207
|
"lib/domains/eu/ibss",
|
6204
6208
|
"lib/domains/eu/it-sudparis",
|
@@ -6210,6 +6214,7 @@ Gem::Specification.new do |s|
|
|
6210
6214
|
"lib/domains/eun.eg/msa",
|
6211
6215
|
"lib/domains/fi/aalto",
|
6212
6216
|
"lib/domains/fi/abo",
|
6217
|
+
"lib/domains/fi/arcada",
|
6213
6218
|
"lib/domains/fi/businesscollege",
|
6214
6219
|
"lib/domains/fi/cou",
|
6215
6220
|
"lib/domains/fi/diak",
|
@@ -6374,9 +6379,11 @@ Gem::Specification.new do |s|
|
|
6374
6379
|
"lib/domains/fr/sorbon",
|
6375
6380
|
"lib/domains/fr/sorbonne",
|
6376
6381
|
"lib/domains/fr/supaero",
|
6382
|
+
"lib/domains/fr/supbiotech",
|
6377
6383
|
"lib/domains/fr/supco-amiens",
|
6378
6384
|
"lib/domains/fr/supco-montpellier",
|
6379
6385
|
"lib/domains/fr/supelec",
|
6386
|
+
"lib/domains/fr/supinternet",
|
6380
6387
|
"lib/domains/fr/u-3mrs",
|
6381
6388
|
"lib/domains/fr/u-bordeaux",
|
6382
6389
|
"lib/domains/fr/u-bordeaux2",
|
@@ -6568,6 +6575,7 @@ Gem::Specification.new do |s|
|
|
6568
6575
|
"lib/domains/hu/szie",
|
6569
6576
|
"lib/domains/hu/tkbf",
|
6570
6577
|
"lib/domains/hu/u-szeged",
|
6578
|
+
"lib/domains/hu/uni-corvinus",
|
6571
6579
|
"lib/domains/hu/uni-miskolc",
|
6572
6580
|
"lib/domains/hu/uni-pannon",
|
6573
6581
|
"lib/domains/hu/unideb",
|
@@ -6948,7 +6956,9 @@ Gem::Specification.new do |s|
|
|
6948
6956
|
"lib/domains/net.pe/rcp",
|
6949
6957
|
"lib/domains/net.ph/evis",
|
6950
6958
|
"lib/domains/net/bracuniversity",
|
6959
|
+
"lib/domains/net/e-artsup",
|
6951
6960
|
"lib/domains/net/eastafricauniversity",
|
6961
|
+
"lib/domains/net/etna-alternance",
|
6952
6962
|
"lib/domains/net/gitis",
|
6953
6963
|
"lib/domains/net/gulfuniversity",
|
6954
6964
|
"lib/domains/net/iraquniversity",
|
@@ -6993,9 +7003,11 @@ Gem::Specification.new do |s|
|
|
6993
7003
|
"lib/domains/nl/nikhef",
|
6994
7004
|
"lib/domains/nl/ou",
|
6995
7005
|
"lib/domains/nl/roac",
|
7006
|
+
"lib/domains/nl/roceindhoven",
|
6996
7007
|
"lib/domains/nl/rocvantwente",
|
6997
7008
|
"lib/domains/nl/ru",
|
6998
7009
|
"lib/domains/nl/rug",
|
7010
|
+
"lib/domains/nl/summacollege",
|
6999
7011
|
"lib/domains/nl/tilburguniversity",
|
7000
7012
|
"lib/domains/nl/tudelft",
|
7001
7013
|
"lib/domains/nl/tue",
|
@@ -7112,6 +7124,7 @@ Gem::Specification.new do |s|
|
|
7112
7124
|
"lib/domains/org/spartanmed",
|
7113
7125
|
"lib/domains/org/svuonline",
|
7114
7126
|
"lib/domains/org/thiqaruni",
|
7127
|
+
"lib/domains/org/toulouse-bs",
|
7115
7128
|
"lib/domains/org/tusol",
|
7116
7129
|
"lib/domains/org/tusom",
|
7117
7130
|
"lib/domains/org/ucapanama",
|
@@ -7694,6 +7707,7 @@ Gem::Specification.new do |s|
|
|
7694
7707
|
"lib/domains/zgora.pl/pz",
|
7695
7708
|
"lib/domains/zgora.pl/wsp",
|
7696
7709
|
"lib/swot.rb",
|
7710
|
+
"lib/swot/academic_tlds.rb",
|
7697
7711
|
"swot.gemspec",
|
7698
7712
|
"test/helper.rb",
|
7699
7713
|
"test/test_swot.rb"
|
@@ -7709,26 +7723,26 @@ Gem::Specification.new do |s|
|
|
7709
7723
|
|
7710
7724
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
7711
7725
|
s.add_runtime_dependency(%q<public_suffix>, [">= 0"])
|
7712
|
-
s.add_development_dependency(%q<
|
7713
|
-
s.add_development_dependency(%q<
|
7726
|
+
s.add_development_dependency(%q<nokogiri>, ["~> 1.5"])
|
7727
|
+
s.add_development_dependency(%q<rake>, ["~> 10.0"])
|
7714
7728
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
7715
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.5
|
7716
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8
|
7729
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.5"])
|
7730
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
|
7717
7731
|
else
|
7718
7732
|
s.add_dependency(%q<public_suffix>, [">= 0"])
|
7719
|
-
s.add_dependency(%q<
|
7720
|
-
s.add_dependency(%q<
|
7733
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
|
7734
|
+
s.add_dependency(%q<rake>, ["~> 10.0"])
|
7721
7735
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
7722
|
-
s.add_dependency(%q<bundler>, ["~> 1.5
|
7723
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8
|
7736
|
+
s.add_dependency(%q<bundler>, ["~> 1.5"])
|
7737
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
7724
7738
|
end
|
7725
7739
|
else
|
7726
7740
|
s.add_dependency(%q<public_suffix>, [">= 0"])
|
7727
|
-
s.add_dependency(%q<
|
7728
|
-
s.add_dependency(%q<
|
7741
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.5"])
|
7742
|
+
s.add_dependency(%q<rake>, ["~> 10.0"])
|
7729
7743
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
7730
|
-
s.add_dependency(%q<bundler>, ["~> 1.5
|
7731
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8
|
7744
|
+
s.add_dependency(%q<bundler>, ["~> 1.5"])
|
7745
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
7732
7746
|
end
|
7733
7747
|
end
|
7734
7748
|
|
data/test/helper.rb
CHANGED
@@ -7,12 +7,8 @@ rescue Bundler::BundlerError => e
|
|
7
7
|
$stderr.puts "Run `bundle install` to install missing gems"
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
|
-
require '
|
11
|
-
require 'shoulda'
|
10
|
+
require 'minitest/autorun'
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
13
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
14
|
require 'swot'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
data/test/test_swot.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
describe Swot do
|
5
|
+
it "recognizes academic email addresses and domains" do
|
6
6
|
assert_equal Swot::is_academic?('lreilly@stanford.edu'), true
|
7
7
|
assert_equal Swot::is_academic?('LREILLY@STANFORD.EDU'), true
|
8
8
|
assert_equal Swot::is_academic?('Lreilly@Stanford.Edu'), true
|
@@ -43,25 +43,32 @@ class TestEmail < Test::Unit::TestCase
|
|
43
43
|
assert_equal Swot::is_academic?(' stanford.edu'), true
|
44
44
|
assert_equal Swot::is_academic?('lee@strath.ac.uk '), true
|
45
45
|
assert_equal Swot::is_academic?(' gmail.com '), false
|
46
|
+
|
47
|
+
assert_equal Swot::is_academic?('lee@stud.uni-corvinus.hu'), true
|
46
48
|
end
|
47
49
|
|
48
|
-
|
50
|
+
it "returns name of valid institution" do
|
49
51
|
assert_equal Swot::get_institution_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
|
50
52
|
assert_equal Swot::get_institution_name('lreilly@fadi.at'), "BRG Fadingerstraße Linz, Austria"
|
51
53
|
end
|
52
54
|
|
53
|
-
|
55
|
+
it "returns nil when institution invalid" do
|
54
56
|
assert_equal Swot::get_institution_name('foo@shop.com'), nil
|
55
57
|
end
|
56
58
|
|
57
|
-
|
59
|
+
it "test aliased methods" do
|
58
60
|
assert_equal Swot::academic?('stanford.edu'), true
|
59
61
|
assert_equal Swot::school_name('lreilly@cs.strath.ac.uk'), "University of Strathclyde"
|
60
62
|
end
|
61
63
|
|
62
|
-
|
63
|
-
["si.edu", " si.edu ", "imposter@si.edu"].each do |domain|
|
64
|
+
it "fail blacklisted domains" do
|
65
|
+
["si.edu", " si.edu ", "imposter@si.edu", "foo.si.edu"].each do |domain|
|
64
66
|
assert_equal false, Swot::is_academic?(domain), "#{domain} should be denied"
|
65
67
|
end
|
66
68
|
end
|
69
|
+
|
70
|
+
it "not err on tld-only domains" do
|
71
|
+
Swot::is_academic? ".com"
|
72
|
+
assert_equal false, Swot::is_academic?(".com")
|
73
|
+
end
|
67
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Reilly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: public_suffix
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.5
|
75
|
+
version: '1.5'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.5
|
82
|
+
version: '1.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: jeweler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.8
|
89
|
+
version: '1.8'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.8
|
96
|
+
version: '1.8'
|
97
97
|
description: email helpers
|
98
98
|
email: lee@leereilly.net
|
99
99
|
executables: []
|
@@ -421,6 +421,7 @@ files:
|
|
421
421
|
- lib/domains/ac.in/bitmesra
|
422
422
|
- lib/domains/ac.in/bits-pilani
|
423
423
|
- lib/domains/ac.in/daiict
|
424
|
+
- lib/domains/ac.in/gtu
|
424
425
|
- lib/domains/ac.in/iiita
|
425
426
|
- lib/domains/ac.in/iiitd
|
426
427
|
- lib/domains/ac.in/iiitdmj
|
@@ -435,6 +436,8 @@ files:
|
|
435
436
|
- lib/domains/ac.in/nirmauni
|
436
437
|
- lib/domains/ac.in/nitc
|
437
438
|
- lib/domains/ac.in/sastra
|
439
|
+
- lib/domains/ac.in/srmuniv
|
440
|
+
- lib/domains/ac.in/unipune
|
438
441
|
- lib/domains/ac.in/vit
|
439
442
|
- lib/domains/ac.in/vvpedulink
|
440
443
|
- lib/domains/ac.ir/acmt
|
@@ -1092,6 +1095,7 @@ files:
|
|
1092
1095
|
- lib/domains/ac.nz/massey
|
1093
1096
|
- lib/domains/ac.nz/openpolytechnic
|
1094
1097
|
- lib/domains/ac.nz/otago
|
1098
|
+
- lib/domains/ac.nz/uclive
|
1095
1099
|
- lib/domains/ac.nz/vuw
|
1096
1100
|
- lib/domains/ac.nz/waikato
|
1097
1101
|
- lib/domains/ac.pa/institutoteima
|
@@ -1988,6 +1992,7 @@ files:
|
|
1988
1992
|
- lib/domains/com/icn-nancy
|
1989
1993
|
- lib/domains/com/icsw
|
1990
1994
|
- lib/domains/com/imi-luzern
|
1995
|
+
- lib/domains/com/ionis-stm
|
1991
1996
|
- lib/domains/com/isbm-school
|
1992
1997
|
- lib/domains/com/islamicug
|
1993
1998
|
- lib/domains/com/iu-travnik
|
@@ -3237,8 +3242,6 @@ files:
|
|
3237
3242
|
- lib/domains/edu.hn/upnfm
|
3238
3243
|
- lib/domains/edu.hn/usps
|
3239
3244
|
- lib/domains/edu.ht/ueh
|
3240
|
-
- lib/domains/edu.in/gtu
|
3241
|
-
- lib/domains/edu.in/srmuniv
|
3242
3245
|
- lib/domains/edu.iq/auis
|
3243
3246
|
- lib/domains/edu.iq/muc
|
3244
3247
|
- lib/domains/edu.iq/nahrainuniv
|
@@ -6284,6 +6287,7 @@ files:
|
|
6284
6287
|
- lib/domains/eu/carolus-magnus-university
|
6285
6288
|
- lib/domains/eu/coleurope
|
6286
6289
|
- lib/domains/eu/ensam
|
6290
|
+
- lib/domains/eu/epitech
|
6287
6291
|
- lib/domains/eu/escpeurope
|
6288
6292
|
- lib/domains/eu/ibss
|
6289
6293
|
- lib/domains/eu/it-sudparis
|
@@ -6295,6 +6299,7 @@ files:
|
|
6295
6299
|
- lib/domains/eun.eg/msa
|
6296
6300
|
- lib/domains/fi/aalto
|
6297
6301
|
- lib/domains/fi/abo
|
6302
|
+
- lib/domains/fi/arcada
|
6298
6303
|
- lib/domains/fi/businesscollege
|
6299
6304
|
- lib/domains/fi/cou
|
6300
6305
|
- lib/domains/fi/diak
|
@@ -6459,9 +6464,11 @@ files:
|
|
6459
6464
|
- lib/domains/fr/sorbon
|
6460
6465
|
- lib/domains/fr/sorbonne
|
6461
6466
|
- lib/domains/fr/supaero
|
6467
|
+
- lib/domains/fr/supbiotech
|
6462
6468
|
- lib/domains/fr/supco-amiens
|
6463
6469
|
- lib/domains/fr/supco-montpellier
|
6464
6470
|
- lib/domains/fr/supelec
|
6471
|
+
- lib/domains/fr/supinternet
|
6465
6472
|
- lib/domains/fr/u-3mrs
|
6466
6473
|
- lib/domains/fr/u-bordeaux
|
6467
6474
|
- lib/domains/fr/u-bordeaux2
|
@@ -6653,6 +6660,7 @@ files:
|
|
6653
6660
|
- lib/domains/hu/szie
|
6654
6661
|
- lib/domains/hu/tkbf
|
6655
6662
|
- lib/domains/hu/u-szeged
|
6663
|
+
- lib/domains/hu/uni-corvinus
|
6656
6664
|
- lib/domains/hu/uni-miskolc
|
6657
6665
|
- lib/domains/hu/uni-pannon
|
6658
6666
|
- lib/domains/hu/unideb
|
@@ -7033,7 +7041,9 @@ files:
|
|
7033
7041
|
- lib/domains/net.pe/rcp
|
7034
7042
|
- lib/domains/net.ph/evis
|
7035
7043
|
- lib/domains/net/bracuniversity
|
7044
|
+
- lib/domains/net/e-artsup
|
7036
7045
|
- lib/domains/net/eastafricauniversity
|
7046
|
+
- lib/domains/net/etna-alternance
|
7037
7047
|
- lib/domains/net/gitis
|
7038
7048
|
- lib/domains/net/gulfuniversity
|
7039
7049
|
- lib/domains/net/iraquniversity
|
@@ -7078,9 +7088,11 @@ files:
|
|
7078
7088
|
- lib/domains/nl/nikhef
|
7079
7089
|
- lib/domains/nl/ou
|
7080
7090
|
- lib/domains/nl/roac
|
7091
|
+
- lib/domains/nl/roceindhoven
|
7081
7092
|
- lib/domains/nl/rocvantwente
|
7082
7093
|
- lib/domains/nl/ru
|
7083
7094
|
- lib/domains/nl/rug
|
7095
|
+
- lib/domains/nl/summacollege
|
7084
7096
|
- lib/domains/nl/tilburguniversity
|
7085
7097
|
- lib/domains/nl/tudelft
|
7086
7098
|
- lib/domains/nl/tue
|
@@ -7197,6 +7209,7 @@ files:
|
|
7197
7209
|
- lib/domains/org/spartanmed
|
7198
7210
|
- lib/domains/org/svuonline
|
7199
7211
|
- lib/domains/org/thiqaruni
|
7212
|
+
- lib/domains/org/toulouse-bs
|
7200
7213
|
- lib/domains/org/tusol
|
7201
7214
|
- lib/domains/org/tusom
|
7202
7215
|
- lib/domains/org/ucapanama
|
@@ -7779,6 +7792,7 @@ files:
|
|
7779
7792
|
- lib/domains/zgora.pl/pz
|
7780
7793
|
- lib/domains/zgora.pl/wsp
|
7781
7794
|
- lib/swot.rb
|
7795
|
+
- lib/swot/academic_tlds.rb
|
7782
7796
|
- swot.gemspec
|
7783
7797
|
- test/helper.rb
|
7784
7798
|
- test/test_swot.rb
|
data/lib/domains/edu.in/gtu
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Gujarat Technological University
|
data/lib/domains/edu.in/srmuniv
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
SRM University
|