mdonoughe-wtth 1.2.0 → 1.2.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/bin/wtth +9 -18
- metadata +1 -1
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.2.
|
15
|
+
VERSION = '1.2.1'
|
16
16
|
load_config
|
17
17
|
|
18
18
|
if ARGV.length > 0 and ARGV[0] == 'init'
|
@@ -26,16 +26,18 @@ module WTTH
|
|
26
26
|
exit 1
|
27
27
|
end
|
28
28
|
|
29
|
-
#
|
30
|
-
# new zombies fetched already
|
29
|
+
# get new zombies and zombies that weren't reported last time
|
31
30
|
to_welcome = CONFIG[:backlog]
|
32
|
-
|
31
|
+
if to_welcome == nil
|
32
|
+
to_welcome = get_new_zombies
|
33
|
+
elsif to_welcome.join(', ').length < 140
|
34
|
+
to_welcome = get_new_zombies + to_welcome
|
35
|
+
end
|
33
36
|
|
34
37
|
if to_welcome != []
|
35
38
|
this_batch = []
|
36
39
|
recovery = []
|
37
40
|
size = 0
|
38
|
-
last_welcomed = nil
|
39
41
|
|
40
42
|
# get the least recent kills, no more than 140 characters worth
|
41
43
|
until size > 140 or to_welcome.empty?
|
@@ -44,23 +46,12 @@ module WTTH
|
|
44
46
|
size += 2 if this_batch.length > 0
|
45
47
|
if size <= 140
|
46
48
|
this_batch << zombie
|
47
|
-
last_welcomed = zombie
|
48
49
|
recovery << to_welcome.pop
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
#
|
53
|
-
|
54
|
-
to_welcome.reverse_each do |zombie|
|
55
|
-
size += 2 unless size == 0
|
56
|
-
size += zombie.length
|
57
|
-
break if size >= 140
|
58
|
-
end
|
59
|
-
if size >= 140
|
60
|
-
CONFIG[:backlog] = to_welcome
|
61
|
-
else
|
62
|
-
CONFIG[:backlog] = nil
|
63
|
-
end
|
53
|
+
# remember who we haven't reported
|
54
|
+
CONFIG[:backlog] = to_welcome
|
64
55
|
|
65
56
|
# welcome with the most recent first so things are in order on twitter
|
66
57
|
this_batch.reverse!
|