firering 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/firering.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'firering'
7
- s.version = '0.1.0'
8
- s.date = '2010-05-30'
7
+ s.version = '0.1.1'
8
+ s.date = '2010-08-08'
9
9
  s.rubyforge_project = 'firering'
10
10
 
11
11
  s.summary = "Campfire API interface powered by EventMachine and Yajl."
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.extra_rdoc_files = %w[README.rdoc LICENSE]
25
25
 
26
26
  s.add_dependency('eventmachine', [">= 0.12.10"])
27
- s.add_dependency('em-http-request', [">= 0.2.7"])
27
+ s.add_dependency('em-http-request', [">= 0.2.10"])
28
28
  s.add_dependency('yajl-ruby', [">= 0.7.6"])
29
29
 
30
30
  s.add_development_dependency('rspec', [">= 1.3.0"])
data/lib/firering/http.rb CHANGED
@@ -2,9 +2,10 @@ module Firering
2
2
  module HTTP
3
3
  extend self
4
4
 
5
- attr_accessor :host
5
+ attr_accessor :host, :retry_delay
6
6
 
7
7
  HTTP.host = "campfirenow.com"
8
+ HTTP.retry_delay = 2
8
9
 
9
10
  # helper to perform an http request following redirects
10
11
  def http(method, path, data = nil, user = Firering.token, password = "X", &block)
@@ -22,7 +23,16 @@ module Firering
22
23
  http = EventMachine::HttpRequest.new(url).send method, parameters
23
24
 
24
25
  http.errback do
25
- raise Firering::Error, "#{http.errors}\n#{url}, #{method}, #{parameters.inspect}\n#{http.response_header.status}\n#{http.response}"
26
+ if EventMachine.reactor_running?
27
+ puts "Error: #{http.error}. Trying again in #{HTTP.retry_delay} seconds..."
28
+
29
+ EventMachine::add_timer(HTTP.retry_delay) do
30
+ puts "reconnecting"
31
+ http(method, path, data, user, password, &block)
32
+ end
33
+ else
34
+ raise Firering::Error, "#{http.error}\n#{url}, #{method}, #{parameters.inspect}\n#{http.response_header.status}\n#{http.response}"
35
+ end
26
36
  end
27
37
 
28
38
  http.callback do
@@ -32,7 +42,7 @@ module Firering
32
42
  when "302"
33
43
  http(method, http.response_header["Location"], user, password, &block) # follow redirects
34
44
  else
35
- raise Firering::Error, "#{http.errors}\n#{url}, #{method}, #{parameters.inspect}\n#{http.response_header.status}\n#{http.response}"
45
+ raise Firering::Error, "#{http.error}\n#{url}, #{method}, #{parameters.inspect}\n#{http.response_header.status}\n#{http.response}"
36
46
  end
37
47
  end
38
48
 
@@ -34,7 +34,7 @@ module Firering
34
34
  # few seconds before trying to reconnect. Formats
35
35
  http.errback do
36
36
  if EventMachine.reactor_running?
37
- puts "Error: #{http.errors}. Reconnecting in #{Streaming.reconnect_delay} seconds..."
37
+ puts "Error: #{http.error}. Reconnecting in #{Streaming.reconnect_delay} seconds..."
38
38
 
39
39
  EventMachine::add_timer(Streaming.reconnect_delay) do
40
40
  puts "reconnecting"
data/lib/firering.rb CHANGED
@@ -4,7 +4,7 @@ require 'em-http'
4
4
  require 'date'
5
5
 
6
6
  module Firering
7
- VERSION = '0.1.0'
7
+ VERSION = '0.1.1'
8
8
 
9
9
  class Error < StandardError; end
10
10
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firering
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 0
9
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Emmanuel Oga
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-30 00:00:00 -03:00
18
+ date: 2010-08-08 00:00:00 -03:00
18
19
  default_executable: campf-notify
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: eventmachine
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 59
27
30
  segments:
28
31
  - 0
29
32
  - 12
@@ -35,23 +38,27 @@ dependencies:
35
38
  name: em-http-request
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 3
41
46
  segments:
42
47
  - 0
43
48
  - 2
44
- - 7
45
- version: 0.2.7
49
+ - 10
50
+ version: 0.2.10
46
51
  type: :runtime
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: yajl-ruby
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 15
55
62
  segments:
56
63
  - 0
57
64
  - 7
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: rspec
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 27
69
78
  segments:
70
79
  - 1
71
80
  - 3
@@ -77,9 +86,11 @@ dependencies:
77
86
  name: sinatra
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ">="
82
92
  - !ruby/object:Gem::Version
93
+ hash: 23
83
94
  segments:
84
95
  - 1
85
96
  - 0
@@ -167,23 +178,27 @@ rdoc_options:
167
178
  require_paths:
168
179
  - lib
169
180
  required_ruby_version: !ruby/object:Gem::Requirement
181
+ none: false
170
182
  requirements:
171
183
  - - ">="
172
184
  - !ruby/object:Gem::Version
185
+ hash: 3
173
186
  segments:
174
187
  - 0
175
188
  version: "0"
176
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
+ none: false
177
191
  requirements:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
194
+ hash: 3
180
195
  segments:
181
196
  - 0
182
197
  version: "0"
183
198
  requirements: []
184
199
 
185
200
  rubyforge_project: firering
186
- rubygems_version: 1.3.6
201
+ rubygems_version: 1.3.7
187
202
  signing_key:
188
203
  specification_version: 2
189
204
  summary: Campfire API interface powered by EventMachine and Yajl.