mit_stalker 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/lib/mit_stalker.rb +4 -2
- data/mit_stalker.gemspec +10 -11
- data/test/mit_stalker_test.rb +8 -1
- metadata +41 -61
data/CHANGELOG
CHANGED
data/lib/mit_stalker.rb
CHANGED
@@ -31,7 +31,7 @@ module MitStalker
|
|
31
31
|
# Returns a string containing the full name, or nil if the Athena username is
|
32
32
|
# not recognized.
|
33
33
|
def self.full_name_from_user_name(user_name)
|
34
|
-
athena_data = finger user_name, 'linux.mit.edu'
|
34
|
+
athena_data = finger user_name.downcase, 'linux.mit.edu'
|
35
35
|
return nil if athena_data.nil?
|
36
36
|
match = athena_data.match /(N|n)ame\: (.*)$/
|
37
37
|
match and match[2].strip
|
@@ -93,9 +93,10 @@ module MitStalker
|
|
93
93
|
# Returns a single user information hash, or nil if no user has the given
|
94
94
|
# e-mail.
|
95
95
|
def self.refine_mitdir_response_by_email(users, user_name)
|
96
|
+
user_name = user_name.downcase
|
96
97
|
users.each do |user|
|
97
98
|
if user[:email]
|
98
|
-
next unless user[:email].split('@').first == user_name
|
99
|
+
next unless user[:email].split('@').first.downcase == user_name
|
99
100
|
users = parse_mitdir_response finger(user[:alias], 'web.mit.edu')
|
100
101
|
return users && users.first
|
101
102
|
else
|
@@ -120,6 +121,7 @@ module MitStalker
|
|
120
121
|
# Returns a hash containing user information, or nil if the user was not
|
121
122
|
# found.
|
122
123
|
def self.from_user_name(user_name)
|
124
|
+
user_name = user_name.downcase
|
123
125
|
full_name = full_name_from_user_name user_name
|
124
126
|
|
125
127
|
if full_name
|
data/mit_stalker.gemspec
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "1.0.
|
4
|
+
s.name = "mit_stalker"
|
5
|
+
s.version = "1.0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Victor Costan"]
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
9
|
+
s.date = "2012-02-11"
|
10
|
+
s.description = "Fetches publicly available information about MIT students."
|
11
|
+
s.email = "victor@zergling.net"
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.textile", "lib/mit_stalker.rb"]
|
13
13
|
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.textile", "Rakefile", "lib/mit_stalker.rb", "test/fixtures/multi_response.txt", "test/fixtures/no_response.txt", "test/fixtures/single_response.txt", "test/mit_stalker_test.rb", "mit_stalker.gemspec"]
|
14
|
-
s.homepage =
|
14
|
+
s.homepage = "http://github.com/costan/mit_stalker"
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mit_stalker", "--main", "README.textile"]
|
16
16
|
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project =
|
18
|
-
s.rubygems_version =
|
19
|
-
s.summary =
|
17
|
+
s.rubyforge_project = "zerglings"
|
18
|
+
s.rubygems_version = "1.8.15"
|
19
|
+
s.summary = "Fetches publicly available information about MIT students."
|
20
20
|
s.test_files = ["test/mit_stalker_test.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
23
|
s.specification_version = 3
|
25
24
|
|
26
|
-
if Gem::Version.new(Gem::
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
26
|
s.add_development_dependency(%q<echoe>, [">= 3.1.1"])
|
28
27
|
s.add_development_dependency(%q<flexmock>, [">= 0.8.6"])
|
29
28
|
else
|
data/test/mit_stalker_test.rb
CHANGED
@@ -23,7 +23,11 @@ class MitStalkerTest < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
def test_full_name
|
25
25
|
assert_equal 'Srinivas Devadas',
|
26
|
-
MitStalker.full_name_from_user_name('devadas')
|
26
|
+
MitStalker.full_name_from_user_name('devadas'),
|
27
|
+
'normalized'
|
28
|
+
assert_equal 'Srinivas Devadas',
|
29
|
+
MitStalker.full_name_from_user_name('Devadas'),
|
30
|
+
'Capital letter in user name'
|
27
31
|
assert_equal nil, MitStalker.full_name_from_user_name('no_user')
|
28
32
|
end
|
29
33
|
|
@@ -99,6 +103,9 @@ class MitStalkerTest < Test::Unit::TestCase
|
|
99
103
|
info = MitStalker.from_user_name 'devadas'
|
100
104
|
assert_equal 'Devadas, Srinivas', info[:name]
|
101
105
|
|
106
|
+
info = MitStalker.from_user_name 'Devadas'
|
107
|
+
assert_equal 'Devadas, Srinivas', info[:name], 'capitalized user name'
|
108
|
+
|
102
109
|
info = MitStalker.from_user_name 'nickolai'
|
103
110
|
assert_equal 'Zeldovich, Nickolai', info[:name]
|
104
111
|
assert_equal 'Nickolai Zeldovich', info[:full_name]
|
metadata
CHANGED
@@ -1,62 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mit_stalker
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
version: 1.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Victor Costan
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: echoe
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 1
|
30
|
-
- 1
|
16
|
+
requirement: &18723780 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
31
21
|
version: 3.1.1
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: flexmock
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
version_requirements: *18723780
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: flexmock
|
27
|
+
requirement: &18723280 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
45
32
|
version: 0.8.6
|
46
33
|
type: :development
|
47
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *18723280
|
48
36
|
description: Fetches publicly available information about MIT students.
|
49
37
|
email: victor@zergling.net
|
50
38
|
executables: []
|
51
|
-
|
52
39
|
extensions: []
|
53
|
-
|
54
|
-
extra_rdoc_files:
|
40
|
+
extra_rdoc_files:
|
55
41
|
- CHANGELOG
|
56
42
|
- LICENSE
|
57
43
|
- README.textile
|
58
44
|
- lib/mit_stalker.rb
|
59
|
-
files:
|
45
|
+
files:
|
60
46
|
- CHANGELOG
|
61
47
|
- LICENSE
|
62
48
|
- Manifest
|
@@ -68,41 +54,35 @@ files:
|
|
68
54
|
- test/fixtures/single_response.txt
|
69
55
|
- test/mit_stalker_test.rb
|
70
56
|
- mit_stalker.gemspec
|
71
|
-
has_rdoc: true
|
72
57
|
homepage: http://github.com/costan/mit_stalker
|
73
58
|
licenses: []
|
74
|
-
|
75
59
|
post_install_message:
|
76
|
-
rdoc_options:
|
60
|
+
rdoc_options:
|
77
61
|
- --line-numbers
|
78
62
|
- --inline-source
|
79
63
|
- --title
|
80
64
|
- Mit_stalker
|
81
65
|
- --main
|
82
66
|
- README.textile
|
83
|
-
require_paths:
|
67
|
+
require_paths:
|
84
68
|
- lib
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
- 1
|
98
|
-
- 2
|
99
|
-
version: "1.2"
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '1.2'
|
100
81
|
requirements: []
|
101
|
-
|
102
82
|
rubyforge_project: zerglings
|
103
|
-
rubygems_version: 1.
|
83
|
+
rubygems_version: 1.8.15
|
104
84
|
signing_key:
|
105
85
|
specification_version: 3
|
106
86
|
summary: Fetches publicly available information about MIT students.
|
107
|
-
test_files:
|
87
|
+
test_files:
|
108
88
|
- test/mit_stalker_test.rb
|