twat 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +2 -1
- data/lib/twat.rb +3 -1
- data/lib/twat/actions.rb +1 -6
- data/lib/twat/config.rb +4 -0
- data/lib/twat/exceptions.rb +1 -0
- data/lib/twat/options.rb +16 -0
- data/man/twat.1 +4 -1
- metadata +5 -5
data/TODO
CHANGED
@@ -9,9 +9,10 @@ Refactor tweet printing code, unify throughout
|
|
9
9
|
TODO
|
10
10
|
====
|
11
11
|
|
12
|
-
Configurable polling interval
|
13
12
|
(which carries with it warnings if it's too short.. which means a warn
|
14
13
|
method.. which means abstracting it's output..)
|
15
14
|
|
16
15
|
On the upside, it'll make unit testing similar.
|
17
16
|
(Add unit tests)
|
17
|
+
|
18
|
+
Split config and options out into submodules
|
data/lib/twat.rb
CHANGED
@@ -45,7 +45,7 @@ end
|
|
45
45
|
module Twat
|
46
46
|
VERSION_MAJOR = 0
|
47
47
|
VERSION_MINOR = 4
|
48
|
-
VERSION_PATCH =
|
48
|
+
VERSION_PATCH = 9
|
49
49
|
|
50
50
|
VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"
|
51
51
|
class Twat
|
@@ -81,6 +81,8 @@ module Twat
|
|
81
81
|
puts "Your config file is out of date. Run with --update-config to rememdy"
|
82
82
|
rescue InvalidBool
|
83
83
|
puts "Invalid value, valid values are #{Options::BOOL_VALID.join("|")}"
|
84
|
+
rescue InvalidInt
|
85
|
+
puts "Invalid value, must be an integer"
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
data/lib/twat/actions.rb
CHANGED
@@ -91,12 +91,7 @@ module Twat
|
|
91
91
|
begin
|
92
92
|
while true do
|
93
93
|
last_id = process_followed(tweets) if tweets.any?
|
94
|
-
|
95
|
-
# If left running at all times, that's 240 requests per hour, well
|
96
|
-
# under the limit
|
97
|
-
# sleep 15
|
98
|
-
# Disregard that, once per 60 seconds is plenty
|
99
|
-
sleep 60
|
94
|
+
sleep config.polling_interval
|
100
95
|
tweets = Twitter.home_timeline(:since_id => last_id)
|
101
96
|
end
|
102
97
|
rescue Interrupt
|
data/lib/twat/config.rb
CHANGED
data/lib/twat/exceptions.rb
CHANGED
data/lib/twat/options.rb
CHANGED
@@ -19,6 +19,10 @@ module Twat
|
|
19
19
|
BOOL_VALS.include?(val.to_s.downcase)
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.int_valid?(val)
|
23
|
+
!!/^[0-9]+$/.match(val)
|
24
|
+
end
|
25
|
+
|
22
26
|
# A set of wrappers around the global config object to set given attributes
|
23
27
|
# Catching failures is convenient because of the method_missing? hook
|
24
28
|
def method_missing(sym, *args, &block)
|
@@ -57,5 +61,17 @@ module Twat
|
|
57
61
|
config.save!
|
58
62
|
end
|
59
63
|
|
64
|
+
def polling_interval=(value)
|
65
|
+
raise InvalidInt unless Options.int_valid?(value)
|
66
|
+
val = value.to_i
|
67
|
+
if val < 15 then
|
68
|
+
puts "Polling intervals of < 15secs will exceed your daily API requests"
|
69
|
+
exit
|
70
|
+
else
|
71
|
+
config[:polling_interval] = val
|
72
|
+
config.save!
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
60
76
|
end
|
61
77
|
end
|
data/man/twat.1
CHANGED
@@ -24,7 +24,7 @@ Delete speficied account.
|
|
24
24
|
Display a short summary of twat's options.
|
25
25
|
.IP -f
|
26
26
|
Watch your newsfeed in a similar manner to tail -f, updating as your feed does
|
27
|
-
(polling interval 60 seconds)
|
27
|
+
(polling interval defaults to 60 seconds)
|
28
28
|
.IP -u USER
|
29
29
|
Retrieve a list of USER's recent tweets. Note this will retrieve all of their
|
30
30
|
tweets as opposed to just what would have appeared in your feed.
|
@@ -37,6 +37,9 @@ Sets account as the default
|
|
37
37
|
Turns colors on or off in the output from twat. [defaults on]
|
38
38
|
.IP beep=<true|false>
|
39
39
|
Beep when a new tweet mentioning you is recieved (Handy in tmux). [defaults off]
|
40
|
+
.IP polling_interval=[>14 seconds]
|
41
|
+
Specify the interval between polls to twitter's API. Values of <15 seconds are
|
42
|
+
not allowed as they would exceed a user's daily API requests to twitter.
|
40
43
|
.IP --update-config
|
41
44
|
Twat is a rolling release and as such, sometimes it is necessary to change the
|
42
45
|
format of it's internal config file. Rather than making changes without user
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: twitter
|
16
|
-
requirement: &
|
16
|
+
requirement: &11785980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11785980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: oauth
|
27
|
-
requirement: &
|
27
|
+
requirement: &11785500 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11785500
|
36
36
|
description: Command line tool for tweeting and whatnot
|
37
37
|
email:
|
38
38
|
- richo@psych0tik.net
|