wtth 1.3.0 → 1.4.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.
- data/VERSION +1 -1
- data/lib/wtth.rb +0 -1
- data/lib/wtth/config.rb +2 -1
- data/lib/wtth/umassd.rb +32 -0
- metadata +35 -17
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.1
|
data/lib/wtth.rb
CHANGED
data/lib/wtth/config.rb
CHANGED
@@ -2,7 +2,7 @@ module WTTH
|
|
2
2
|
private
|
3
3
|
CONFIG_PATH = File::expand_path('~/.wtth.yml')
|
4
4
|
# set the defaults
|
5
|
-
CONFIG = {:player_list_uri => 'http://20cent.hvzsource.com/players.php'}
|
5
|
+
CONFIG = {:loader => 'hvzsource.rb', :player_list_uri => 'http://20cent.hvzsource.com/players.php'}
|
6
6
|
|
7
7
|
def self.load_config
|
8
8
|
if File.exists?(CONFIG_PATH)
|
@@ -10,6 +10,7 @@ module WTTH
|
|
10
10
|
CONFIG.merge!(YAML::load(file.read))
|
11
11
|
end
|
12
12
|
end
|
13
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), CONFIG[:loader])
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.save_config
|
data/lib/wtth/umassd.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module WTTH
|
2
|
+
private
|
3
|
+
def self.get_new_zombies
|
4
|
+
to_welcome = []
|
5
|
+
zombies = []
|
6
|
+
|
7
|
+
puts "fetching from umassdhvz"
|
8
|
+
|
9
|
+
uri = URI.parse(CONFIG[:player_list_uri])
|
10
|
+
preq = Net::HTTP::Post.new(uri.path)
|
11
|
+
preq['user-agent'] = "welcome to the horde #{VERSION}"
|
12
|
+
preq.set_form_data({'show' => 'all_zombie', 'order_by' => 'fname', 'order' => 'asc', 'submit' => 'Update'}, '&')
|
13
|
+
|
14
|
+
req = Net::HTTP.new(uri.host, uri.port)
|
15
|
+
req.start do |http|
|
16
|
+
http.request(preq) do |resp|
|
17
|
+
doc = Nokogiri::HTML(resp.read_body)
|
18
|
+
# the table is <name> | <junk>
|
19
|
+
rows = doc.xpath('//div[@id="player_table"]/table/tr')
|
20
|
+
rows.each do |row|
|
21
|
+
cells = row.xpath('td')
|
22
|
+
next if cells.empty?
|
23
|
+
name = cells.first.content
|
24
|
+
zombies << name
|
25
|
+
to_welcome << name unless CONFIG[:zombies] != nil and CONFIG[:zombies].include?(name)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
CONFIG[:zombies] = zombies unless zombies.length == 0
|
30
|
+
return to_welcome
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wtth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 4
|
8
|
+
- 1
|
9
|
+
version: 1.4.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Matthew Donoughe
|
@@ -9,39 +14,49 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-02 00:00:00 +00:00
|
13
18
|
default_executable: wtth
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: shoulda
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
25
32
|
- !ruby/object:Gem::Dependency
|
26
33
|
name: nokogiri
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 1
|
41
|
+
- 0
|
42
|
+
- 0
|
33
43
|
version: 1.0.0
|
34
|
-
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
35
46
|
- !ruby/object:Gem::Dependency
|
36
47
|
name: twitter
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
50
|
requirements:
|
41
51
|
- - ">="
|
42
52
|
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 5
|
56
|
+
- 0
|
43
57
|
version: 0.5.0
|
44
|
-
|
58
|
+
type: :runtime
|
59
|
+
version_requirements: *id003
|
45
60
|
description: Welcome to the Horde is a program that tweets when people join the zombie horde(in humans vs. zombies).
|
46
61
|
email: mdonoughe@gmail.com
|
47
62
|
executables:
|
@@ -62,6 +77,7 @@ files:
|
|
62
77
|
- lib/wtth/config.rb
|
63
78
|
- lib/wtth/hvzsource.rb
|
64
79
|
- lib/wtth/twitter.rb
|
80
|
+
- lib/wtth/umassd.rb
|
65
81
|
- test/test_helper.rb
|
66
82
|
- test/wtth_test.rb
|
67
83
|
has_rdoc: true
|
@@ -77,18 +93,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
93
|
requirements:
|
78
94
|
- - ">="
|
79
95
|
- !ruby/object:Gem::Version
|
96
|
+
segments:
|
97
|
+
- 0
|
80
98
|
version: "0"
|
81
|
-
version:
|
82
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
100
|
requirements:
|
84
101
|
- - ">="
|
85
102
|
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
86
105
|
version: "0"
|
87
|
-
version:
|
88
106
|
requirements: []
|
89
107
|
|
90
108
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.6
|
92
110
|
signing_key:
|
93
111
|
specification_version: 3
|
94
112
|
summary: Watches humans vs. zombies games and tweets new zombies.
|