mdonoughe-wtth 1.1.0 → 1.2.0
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/bin/wtth +4 -6
- data/lib/wtth/hvzsource.rb +4 -4
- metadata +2 -2
data/bin/wtth
CHANGED
@@ -12,7 +12,7 @@ require File.join(wtth_path, 'hvzsource')
|
|
12
12
|
require File.join(wtth_path, 'twitter')
|
13
13
|
|
14
14
|
module WTTH
|
15
|
-
VERSION = '1.
|
15
|
+
VERSION = '1.2.0'
|
16
16
|
load_config
|
17
17
|
|
18
18
|
if ARGV.length > 0 and ARGV[0] == 'init'
|
@@ -40,10 +40,10 @@ module WTTH
|
|
40
40
|
# get the least recent kills, no more than 140 characters worth
|
41
41
|
until size > 140 or to_welcome.empty?
|
42
42
|
zombie = to_welcome.last
|
43
|
-
size += zombie
|
43
|
+
size += zombie.length
|
44
44
|
size += 2 if this_batch.length > 0
|
45
45
|
if size <= 140
|
46
|
-
this_batch << zombie
|
46
|
+
this_batch << zombie
|
47
47
|
last_welcomed = zombie
|
48
48
|
recovery << to_welcome.pop
|
49
49
|
end
|
@@ -53,7 +53,7 @@ module WTTH
|
|
53
53
|
size = 0
|
54
54
|
to_welcome.reverse_each do |zombie|
|
55
55
|
size += 2 unless size == 0
|
56
|
-
size += zombie
|
56
|
+
size += zombie.length
|
57
57
|
break if size >= 140
|
58
58
|
end
|
59
59
|
if size >= 140
|
@@ -67,8 +67,6 @@ module WTTH
|
|
67
67
|
|
68
68
|
begin
|
69
69
|
tweet(this_batch.join(', '))
|
70
|
-
# remember where we left off
|
71
|
-
CONFIG[:last_welcomed] = last_welcomed
|
72
70
|
rescue Twitter::TwitterError
|
73
71
|
puts "TwitterError #{$!}"
|
74
72
|
# throw the message onto the backlog so we can try again next time
|
data/lib/wtth/hvzsource.rb
CHANGED
@@ -2,6 +2,7 @@ module WTTH
|
|
2
2
|
private
|
3
3
|
def self.get_new_zombies
|
4
4
|
to_welcome = []
|
5
|
+
zombies = []
|
5
6
|
|
6
7
|
puts "fetching from hvzsource"
|
7
8
|
|
@@ -19,13 +20,12 @@ module WTTH
|
|
19
20
|
cells = doc.xpath('//form/table//td')
|
20
21
|
((cells.length - 3) / 3).times do |i|
|
21
22
|
name = cells[i * 3 + 3].content
|
22
|
-
|
23
|
-
|
24
|
-
break if CONFIG[:last_welcomed] != nil and (kill == CONFIG[:last_welcomed] or tod < CONFIG[:last_welcomed][:tod])
|
25
|
-
to_welcome << kill
|
23
|
+
zombies << name
|
24
|
+
to_welcome << name unless CONFIG[:zombies] != nil and CONFIG[:zombies].include?(name)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
28
|
+
CONFIG[:zombies] = zombies
|
29
29
|
return to_welcome
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdonoughe-wtth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Donoughe
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|