howler 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.gemrc +1 -0
  2. data/.gitignore +5 -0
  3. data/.rspec +2 -0
  4. data/.rvmrc +1 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +68 -0
  7. data/LICENSE +19 -0
  8. data/README.md +104 -0
  9. data/bin/howler +3 -0
  10. data/howler.gemspec +24 -0
  11. data/lib/howler.rb +34 -0
  12. data/lib/howler/async.rb +15 -0
  13. data/lib/howler/config.ru +4 -0
  14. data/lib/howler/exceptions.rb +5 -0
  15. data/lib/howler/exceptions/error.rb +25 -0
  16. data/lib/howler/exceptions/failed.rb +9 -0
  17. data/lib/howler/exceptions/notify.rb +15 -0
  18. data/lib/howler/exceptions/retry.rb +12 -0
  19. data/lib/howler/manager.rb +123 -0
  20. data/lib/howler/message.rb +15 -0
  21. data/lib/howler/queue.rb +138 -0
  22. data/lib/howler/runner.rb +34 -0
  23. data/lib/howler/support/config.rb +33 -0
  24. data/lib/howler/support/logger.rb +57 -0
  25. data/lib/howler/support/util.rb +23 -0
  26. data/lib/howler/support/version.rb +3 -0
  27. data/lib/howler/web.rb +47 -0
  28. data/lib/howler/web/public/application.css +24 -0
  29. data/lib/howler/web/public/bootstrap.css +3990 -0
  30. data/lib/howler/web/public/bootstrap.min.css +689 -0
  31. data/lib/howler/web/public/queues.css +19 -0
  32. data/lib/howler/web/views/failed_messages.erb +27 -0
  33. data/lib/howler/web/views/html.erb +10 -0
  34. data/lib/howler/web/views/index.erb +11 -0
  35. data/lib/howler/web/views/navigation.erb +25 -0
  36. data/lib/howler/web/views/notification_messages.erb +24 -0
  37. data/lib/howler/web/views/notifications.erb +15 -0
  38. data/lib/howler/web/views/pending_messages.erb +24 -0
  39. data/lib/howler/web/views/processed_messages.erb +28 -0
  40. data/lib/howler/web/views/queue.erb +36 -0
  41. data/lib/howler/web/views/queue_table.erb +27 -0
  42. data/lib/howler/web/views/queues.erb +15 -0
  43. data/lib/howler/worker.rb +17 -0
  44. data/spec/models/async_spec.rb +76 -0
  45. data/spec/models/exceptions/failed_spec.rb +15 -0
  46. data/spec/models/exceptions/message_spec.rb +53 -0
  47. data/spec/models/exceptions/notify_spec.rb +26 -0
  48. data/spec/models/exceptions/retry_spec.rb +49 -0
  49. data/spec/models/howler_spec.rb +69 -0
  50. data/spec/models/manager_spec.rb +397 -0
  51. data/spec/models/message_spec.rb +78 -0
  52. data/spec/models/queue_spec.rb +539 -0
  53. data/spec/models/runner_spec.rb +109 -0
  54. data/spec/models/support/config_spec.rb +56 -0
  55. data/spec/models/support/logger_spec.rb +147 -0
  56. data/spec/models/support/util_spec.rb +44 -0
  57. data/spec/models/worker_spec.rb +54 -0
  58. data/spec/requests/web_spec.rb +220 -0
  59. data/spec/spec_helper.rb +93 -0
  60. metadata +265 -0
@@ -0,0 +1,93 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'timecop'
5
+ require 'benchmark'
6
+ require 'capybara'
7
+ require 'capybara/dsl'
8
+
9
+ require 'multi_json'
10
+ require 'logger'
11
+
12
+ class MockLogger
13
+ class Formatter; end
14
+ def initialize(*); end
15
+ def formatter=(*); end
16
+ def info(*); end
17
+ end
18
+
19
+ # suppress_warnings
20
+ original, $VERBOSE = $VERBOSE, nil
21
+ Logger = MockLogger
22
+ $VERBOSE = original
23
+
24
+ require 'howler'
25
+ require 'howler/async'
26
+ require 'howler/web'
27
+
28
+ Capybara.default_driver = :selenium
29
+
30
+ Capybara.app = Howler::Web
31
+
32
+ RSpec.configure do |config|
33
+ config.mock_with :rspec
34
+
35
+ config.before(:each) do
36
+ Howler.send(:_redis).flushall
37
+ Howler::Config.class_eval("@@options={:concurrency => 1}")
38
+ Howler.stub(:next).with(:id).and_return(123)
39
+ end
40
+
41
+ config.after(:suite) do
42
+ Howler.send(:_redis).flushall
43
+ end
44
+ end
45
+
46
+ class Change
47
+ attr_accessor :queue
48
+ def length_by(amount)
49
+ redis = Howler.send(:_redis)
50
+
51
+ [:llen, :zcard].each do |method|
52
+ begin
53
+ before = redis.send(method, queue)
54
+ yield
55
+ return (redis.send(method, queue) - before).should == amount
56
+ rescue RuntimeError
57
+ end
58
+ end
59
+ end
60
+ end
61
+ def should_change(queue)
62
+ change = Change.new
63
+ change.queue = queue
64
+ change
65
+ end
66
+
67
+ module FixnumMethods
68
+ def minutes
69
+ self * 60
70
+ end
71
+
72
+ def hours
73
+ self * 60.minutes
74
+ end
75
+
76
+ def days
77
+ self * 24.hours
78
+ end
79
+
80
+ alias :minute :minutes
81
+ alias :hour :hours
82
+ alias :day :days
83
+ end
84
+
85
+ Fixnum.send(:include, FixnumMethods)
86
+
87
+ def generate_exception(ex = nil)
88
+ begin
89
+ raise (ex || Exception)
90
+ rescue Exception => e
91
+ e
92
+ end
93
+ end
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: howler
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Brian Norton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: redis
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: celluloid
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: connection_pool
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: multi_json
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sinatra
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: capybara
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: timecop
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ description: An Asynchronous Message Queue that's always Chewing on Something
159
+ email:
160
+ - brian.nort@gmail.com
161
+ executables:
162
+ - howler
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - .gemrc
167
+ - .gitignore
168
+ - .rspec
169
+ - .rvmrc
170
+ - Gemfile
171
+ - Gemfile.lock
172
+ - LICENSE
173
+ - README.md
174
+ - bin/howler
175
+ - howler.gemspec
176
+ - lib/howler.rb
177
+ - lib/howler/async.rb
178
+ - lib/howler/config.ru
179
+ - lib/howler/exceptions.rb
180
+ - lib/howler/exceptions/error.rb
181
+ - lib/howler/exceptions/failed.rb
182
+ - lib/howler/exceptions/notify.rb
183
+ - lib/howler/exceptions/retry.rb
184
+ - lib/howler/manager.rb
185
+ - lib/howler/message.rb
186
+ - lib/howler/queue.rb
187
+ - lib/howler/runner.rb
188
+ - lib/howler/support/config.rb
189
+ - lib/howler/support/logger.rb
190
+ - lib/howler/support/util.rb
191
+ - lib/howler/support/version.rb
192
+ - lib/howler/web.rb
193
+ - lib/howler/web/public/application.css
194
+ - lib/howler/web/public/bootstrap.css
195
+ - lib/howler/web/public/bootstrap.min.css
196
+ - lib/howler/web/public/queues.css
197
+ - lib/howler/web/views/failed_messages.erb
198
+ - lib/howler/web/views/html.erb
199
+ - lib/howler/web/views/index.erb
200
+ - lib/howler/web/views/navigation.erb
201
+ - lib/howler/web/views/notification_messages.erb
202
+ - lib/howler/web/views/notifications.erb
203
+ - lib/howler/web/views/pending_messages.erb
204
+ - lib/howler/web/views/processed_messages.erb
205
+ - lib/howler/web/views/queue.erb
206
+ - lib/howler/web/views/queue_table.erb
207
+ - lib/howler/web/views/queues.erb
208
+ - lib/howler/worker.rb
209
+ - spec/models/async_spec.rb
210
+ - spec/models/exceptions/failed_spec.rb
211
+ - spec/models/exceptions/message_spec.rb
212
+ - spec/models/exceptions/notify_spec.rb
213
+ - spec/models/exceptions/retry_spec.rb
214
+ - spec/models/howler_spec.rb
215
+ - spec/models/manager_spec.rb
216
+ - spec/models/message_spec.rb
217
+ - spec/models/queue_spec.rb
218
+ - spec/models/runner_spec.rb
219
+ - spec/models/support/config_spec.rb
220
+ - spec/models/support/logger_spec.rb
221
+ - spec/models/support/util_spec.rb
222
+ - spec/models/worker_spec.rb
223
+ - spec/requests/web_spec.rb
224
+ - spec/spec_helper.rb
225
+ homepage: http://github.com/bnorton/howler
226
+ licenses: []
227
+ post_install_message:
228
+ rdoc_options: []
229
+ require_paths:
230
+ - lib
231
+ required_ruby_version: !ruby/object:Gem::Requirement
232
+ none: false
233
+ requirements:
234
+ - - ! '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ required_rubygems_version: !ruby/object:Gem::Requirement
238
+ none: false
239
+ requirements:
240
+ - - ! '>='
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
243
+ requirements: []
244
+ rubyforge_project:
245
+ rubygems_version: 1.8.21
246
+ signing_key:
247
+ specification_version: 3
248
+ summary: An Asynchronous Message Queue that's always Chewing on Something
249
+ test_files:
250
+ - spec/models/async_spec.rb
251
+ - spec/models/exceptions/failed_spec.rb
252
+ - spec/models/exceptions/message_spec.rb
253
+ - spec/models/exceptions/notify_spec.rb
254
+ - spec/models/exceptions/retry_spec.rb
255
+ - spec/models/howler_spec.rb
256
+ - spec/models/manager_spec.rb
257
+ - spec/models/message_spec.rb
258
+ - spec/models/queue_spec.rb
259
+ - spec/models/runner_spec.rb
260
+ - spec/models/support/config_spec.rb
261
+ - spec/models/support/logger_spec.rb
262
+ - spec/models/support/util_spec.rb
263
+ - spec/models/worker_spec.rb
264
+ - spec/requests/web_spec.rb
265
+ - spec/spec_helper.rb