twat 0.4.9 → 0.4.10

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.
Files changed (3) hide show
  1. data/lib/twat.rb +3 -1
  2. data/lib/twat/actions.rb +13 -4
  3. metadata +7 -7
@@ -45,7 +45,7 @@ end
45
45
  module Twat
46
46
  VERSION_MAJOR = 0
47
47
  VERSION_MINOR = 4
48
- VERSION_PATCH = 9
48
+ VERSION_PATCH = 10
49
49
 
50
50
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"
51
51
  class Twat
@@ -83,6 +83,8 @@ module Twat
83
83
  puts "Invalid value, valid values are #{Options::BOOL_VALID.join("|")}"
84
84
  rescue InvalidInt
85
85
  puts "Invalid value, must be an integer"
86
+ rescue Errno::ECONNRESET
87
+ puts "Connection was reset by third party."
86
88
  end
87
89
  end
88
90
  end
@@ -3,7 +3,7 @@ module Twat
3
3
  CONSUMER_TOKENS = [ :consumer_key, :consumer_secret ]
4
4
  class Actions
5
5
 
6
- attr_accessor :config, :opts
6
+ attr_accessor :config, :opts, :failcount
7
7
 
8
8
  def tweet
9
9
  twitter_auth
@@ -85,16 +85,25 @@ module Twat
85
85
  # we will have to retrieve a few tweets from the timeline, and then poll
86
86
  # occasionally :/
87
87
  twitter_auth
88
+ failcount = 0
88
89
 
89
90
  # Get 5 tweets
90
91
  tweets = Twitter.home_timeline(:count => 5)
91
- begin
92
- while true do
92
+ while true do
93
+ begin
93
94
  last_id = process_followed(tweets) if tweets.any?
94
95
  sleep config.polling_interval
95
96
  tweets = Twitter.home_timeline(:since_id => last_id)
97
+ failcount = 0
98
+ rescue Interrupt
99
+ break
100
+ rescue Errno::ECONNRESET
101
+ if failcount > 2
102
+ puts "3 consecutive failures, giving up"
103
+ else
104
+ failcount += 1
105
+ end
96
106
  end
97
- rescue Interrupt
98
107
  end
99
108
  end
100
109
 
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.9
4
+ version: 0.4.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-08 00:00:00.000000000Z
12
+ date: 2011-10-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter
16
- requirement: &11785980 !ruby/object:Gem::Requirement
16
+ requirement: &16294500 !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: *11785980
24
+ version_requirements: *16294500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth
27
- requirement: &11785500 !ruby/object:Gem::Requirement
27
+ requirement: &16294000 !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: *11785500
35
+ version_requirements: *16294000
36
36
  description: Command line tool for tweeting and whatnot
37
37
  email:
38
38
  - richo@psych0tik.net
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 1.8.6
80
+ rubygems_version: 1.8.10
81
81
  signing_key:
82
82
  specification_version: 3
83
83
  summary: Command line tool for tweeting and whatnot