qup 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.autotest +41 -0
  2. data/.gemtest +1 -0
  3. data/ADAPTER_API.rdoc +97 -0
  4. data/HISTORY.rdoc +9 -0
  5. data/Manifest.txt +52 -0
  6. data/README.rdoc +156 -0
  7. data/Rakefile +246 -0
  8. data/lib/qup.rb +48 -0
  9. data/lib/qup/adapter.rb +57 -0
  10. data/lib/qup/adapter/kestrel.rb +56 -0
  11. data/lib/qup/adapter/kestrel/destination.rb +54 -0
  12. data/lib/qup/adapter/kestrel/queue.rb +101 -0
  13. data/lib/qup/adapter/kestrel/topic.rb +68 -0
  14. data/lib/qup/adapter/maildir.rb +57 -0
  15. data/lib/qup/adapter/maildir/queue.rb +123 -0
  16. data/lib/qup/adapter/maildir/topic.rb +85 -0
  17. data/lib/qup/adapter/redis.rb +55 -0
  18. data/lib/qup/adapter/redis/connection.rb +32 -0
  19. data/lib/qup/adapter/redis/queue.rb +97 -0
  20. data/lib/qup/adapter/redis/topic.rb +76 -0
  21. data/lib/qup/consumer.rb +42 -0
  22. data/lib/qup/message.rb +18 -0
  23. data/lib/qup/producer.rb +28 -0
  24. data/lib/qup/publisher.rb +30 -0
  25. data/lib/qup/queue_api.rb +124 -0
  26. data/lib/qup/session.rb +111 -0
  27. data/lib/qup/subscriber.rb +28 -0
  28. data/lib/qup/topic_api.rb +92 -0
  29. data/spec/qup/adapter/kestrel/queue_spec.rb +9 -0
  30. data/spec/qup/adapter/kestrel/topic_spec.rb +9 -0
  31. data/spec/qup/adapter/kestrel_context.rb +8 -0
  32. data/spec/qup/adapter/kestrel_spec.rb +8 -0
  33. data/spec/qup/adapter/maildir/queue_spec.rb +9 -0
  34. data/spec/qup/adapter/maildir/topic_spec.rb +9 -0
  35. data/spec/qup/adapter/maildir_context.rb +10 -0
  36. data/spec/qup/adapter/maildir_spec.rb +8 -0
  37. data/spec/qup/adapter/redis/queue_spec.rb +9 -0
  38. data/spec/qup/adapter/redis/topic_spec.rb +9 -0
  39. data/spec/qup/adapter/redis_context.rb +6 -0
  40. data/spec/qup/adapter/redis_spec.rb +8 -0
  41. data/spec/qup/adapter_spec.rb +28 -0
  42. data/spec/qup/consumer_spec.rb +40 -0
  43. data/spec/qup/message_spec.rb +13 -0
  44. data/spec/qup/producer_spec.rb +18 -0
  45. data/spec/qup/queue_api_spec.rb +21 -0
  46. data/spec/qup/session_spec.rb +81 -0
  47. data/spec/qup/shared_adapter_examples.rb +29 -0
  48. data/spec/qup/shared_queue_examples.rb +71 -0
  49. data/spec/qup/shared_topic_examples.rb +57 -0
  50. data/spec/qup/topic_api_spec.rb +21 -0
  51. data/spec/qup_spec.rb +37 -0
  52. data/spec/spec_helper.rb +26 -0
  53. metadata +281 -0
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ class Qup::TopicAPITest
4
+ include Qup::TopicAPI
5
+ end
6
+
7
+ describe "Not Implementing the Topic API" do
8
+ let( :api ) { Qup::TopicAPITest.new }
9
+
10
+ %w[ name destroy publisher subscriber_count ].each do |method|
11
+ it "##{method} kaboom!" do
12
+ lambda { api.send( method ) }.should raise_error( NotImplementedError, /please implement '#{method}'/ )
13
+ end
14
+ end
15
+
16
+ %w[ publish subscriber ].each do |method|
17
+ it "##{method} kaboom!" do
18
+ lambda { api.send( method, nil ) }.should raise_error( NotImplementedError, /please implement '#{method}'/ )
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ require "qup"
2
+
3
+ describe Qup do
4
+
5
+ let( :path ) { temp_dir( "qup" ) }
6
+ let( :uri ) { "maildir://#{path}" }
7
+
8
+ it "should have a version" do
9
+ Qup::VERSION.should =~ ( %r[\A\d+\.\d+\.\d+\Z] )
10
+ end
11
+
12
+ describe '#open' do
13
+ it 'returns a new session' do
14
+ s = Qup.open( uri )
15
+ s.closed?.should be_false
16
+ end
17
+
18
+ it 'yields a new session' do
19
+ Qup.open( uri ) do |s|
20
+ s.closed?.should be_false
21
+ end
22
+ end
23
+
24
+ it 'closes a session at the end of the block' do
25
+ save_s = nil
26
+ Qup.open( uri ) do |s|
27
+ s.closed?.should be_false
28
+ save_s = s
29
+ end
30
+ save_s.closed?.should be_true
31
+ end
32
+ end
33
+
34
+
35
+ it "opens a new session" do
36
+ end
37
+ end
@@ -0,0 +1,26 @@
1
+ require "rspec/autorun"
2
+ require 'qup'
3
+
4
+ require 'tmpdir'
5
+ def temp_dir( token, unique_id = Process.pid )
6
+ dirname = File.join( Dir.tmpdir, "#{token}-#{unique_id}")
7
+ FileUtils.mkdir_p( dirname ) unless File.directory?( dirname )
8
+ # on osx the directory is different when you are in it than what it is when it
9
+ # is created
10
+ dirname = Dir.chdir( dirname ) { Dir.pwd }
11
+ return dirname
12
+ end
13
+
14
+ RSpec.configure do |conf|
15
+ Qup::KNOWN_ADAPTERS.each do |adapter, gemname|
16
+ begin
17
+ require "qup/adapter/#{adapter}"
18
+ rescue LoadError
19
+ warn "NOTICE:"
20
+ warn "NOTICE: The tests for the '#{adapter}' will be skipped as the '#{gemname}' is not installed"
21
+ warn "NOTICE:"
22
+ sym = adapter.to_sym
23
+ conf.filter_run_excluding sym => true
24
+ end
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,281 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qup
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 0
10
+ version: 1.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Jeremy Hinegardner
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-12 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: maildir
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 15
29
+ segments:
30
+ - 2
31
+ - 0
32
+ - 0
33
+ version: 2.0.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: kestrel-client
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 1
45
+ segments:
46
+ - 0
47
+ - 7
48
+ - 1
49
+ version: 0.7.1
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: redis
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 2
63
+ - 2
64
+ - 2
65
+ version: 2.2.2
66
+ type: :development
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: SystemTimer
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 25
77
+ segments:
78
+ - 1
79
+ - 2
80
+ - 3
81
+ version: 1.2.3
82
+ type: :development
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 11
93
+ segments:
94
+ - 0
95
+ - 9
96
+ - 2
97
+ - 2
98
+ version: 0.9.2.2
99
+ type: :development
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: rcov
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 23
110
+ segments:
111
+ - 1
112
+ - 0
113
+ - 0
114
+ version: 1.0.0
115
+ type: :development
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ hash: 47
126
+ segments:
127
+ - 2
128
+ - 8
129
+ - 0
130
+ version: 2.8.0
131
+ type: :development
132
+ version_requirements: *id007
133
+ - !ruby/object:Gem::Dependency
134
+ name: rdoc
135
+ prerelease: false
136
+ requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ hash: 31
142
+ segments:
143
+ - 3
144
+ - 12
145
+ version: "3.12"
146
+ type: :development
147
+ version_requirements: *id008
148
+ description: |-
149
+ Qup is a generalized API for Message Queue and Publish/Subscribe messaging
150
+ patterns with the ability to plug in an appropriate messaging infrastructure
151
+ based upon your needs.
152
+
153
+ Qup ships with support for {Kestrel}[https://github.com/robey/kestrel] and a
154
+ filesystem infrastructure based on {Maildir}[https://rubygems.org/gems/maildir].
155
+ Additional Adapters will be developed as needs arise. {Please submit an
156
+ Issue}[https://github.com/copiousfreetime/qup/issues] to have a new Adapter
157
+ created. Pull requests gladly accepted.
158
+ email: jeremy@copiousfreetime.org
159
+ executables: []
160
+
161
+ extensions: []
162
+
163
+ extra_rdoc_files:
164
+ - ADAPTER_API.rdoc
165
+ - HISTORY.rdoc
166
+ - Manifest.txt
167
+ - README.rdoc
168
+ files:
169
+ - .autotest
170
+ - .gemtest
171
+ - ADAPTER_API.rdoc
172
+ - HISTORY.rdoc
173
+ - Manifest.txt
174
+ - README.rdoc
175
+ - Rakefile
176
+ - lib/qup.rb
177
+ - lib/qup/adapter.rb
178
+ - lib/qup/adapter/kestrel.rb
179
+ - lib/qup/adapter/kestrel/destination.rb
180
+ - lib/qup/adapter/kestrel/queue.rb
181
+ - lib/qup/adapter/kestrel/topic.rb
182
+ - lib/qup/adapter/maildir.rb
183
+ - lib/qup/adapter/maildir/queue.rb
184
+ - lib/qup/adapter/maildir/topic.rb
185
+ - lib/qup/adapter/redis.rb
186
+ - lib/qup/adapter/redis/connection.rb
187
+ - lib/qup/adapter/redis/queue.rb
188
+ - lib/qup/adapter/redis/topic.rb
189
+ - lib/qup/consumer.rb
190
+ - lib/qup/message.rb
191
+ - lib/qup/producer.rb
192
+ - lib/qup/publisher.rb
193
+ - lib/qup/queue_api.rb
194
+ - lib/qup/session.rb
195
+ - lib/qup/subscriber.rb
196
+ - lib/qup/topic_api.rb
197
+ - spec/qup/adapter/kestrel/queue_spec.rb
198
+ - spec/qup/adapter/kestrel/topic_spec.rb
199
+ - spec/qup/adapter/kestrel_context.rb
200
+ - spec/qup/adapter/kestrel_spec.rb
201
+ - spec/qup/adapter/maildir/queue_spec.rb
202
+ - spec/qup/adapter/maildir/topic_spec.rb
203
+ - spec/qup/adapter/maildir_context.rb
204
+ - spec/qup/adapter/maildir_spec.rb
205
+ - spec/qup/adapter/redis/queue_spec.rb
206
+ - spec/qup/adapter/redis/topic_spec.rb
207
+ - spec/qup/adapter/redis_context.rb
208
+ - spec/qup/adapter/redis_spec.rb
209
+ - spec/qup/adapter_spec.rb
210
+ - spec/qup/consumer_spec.rb
211
+ - spec/qup/message_spec.rb
212
+ - spec/qup/producer_spec.rb
213
+ - spec/qup/queue_api_spec.rb
214
+ - spec/qup/session_spec.rb
215
+ - spec/qup/shared_adapter_examples.rb
216
+ - spec/qup/shared_queue_examples.rb
217
+ - spec/qup/shared_topic_examples.rb
218
+ - spec/qup/topic_api_spec.rb
219
+ - spec/qup_spec.rb
220
+ - spec/spec_helper.rb
221
+ homepage: http://github.com/copiousfreetime/qup
222
+ licenses: []
223
+
224
+ post_install_message:
225
+ rdoc_options:
226
+ - --main
227
+ - README.rdoc
228
+ - --markup
229
+ - tomdoc
230
+ require_paths:
231
+ - lib
232
+ required_ruby_version: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ">="
236
+ - !ruby/object:Gem::Version
237
+ hash: 3
238
+ segments:
239
+ - 0
240
+ version: "0"
241
+ required_rubygems_version: !ruby/object:Gem::Requirement
242
+ none: false
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ hash: 3
247
+ segments:
248
+ - 0
249
+ version: "0"
250
+ requirements: []
251
+
252
+ rubyforge_project:
253
+ rubygems_version: 1.8.16
254
+ signing_key:
255
+ specification_version: 3
256
+ summary: Qup is a generalized API for Message Queue and Publish/Subscribe messaging patterns with the ability to plug in an appropriate messaging infrastructure based upon your needs.
257
+ test_files:
258
+ - spec/qup/adapter/kestrel/queue_spec.rb
259
+ - spec/qup/adapter/kestrel/topic_spec.rb
260
+ - spec/qup/adapter/kestrel_context.rb
261
+ - spec/qup/adapter/kestrel_spec.rb
262
+ - spec/qup/adapter/maildir/queue_spec.rb
263
+ - spec/qup/adapter/maildir/topic_spec.rb
264
+ - spec/qup/adapter/maildir_context.rb
265
+ - spec/qup/adapter/maildir_spec.rb
266
+ - spec/qup/adapter/redis/queue_spec.rb
267
+ - spec/qup/adapter/redis/topic_spec.rb
268
+ - spec/qup/adapter/redis_context.rb
269
+ - spec/qup/adapter/redis_spec.rb
270
+ - spec/qup/adapter_spec.rb
271
+ - spec/qup/consumer_spec.rb
272
+ - spec/qup/message_spec.rb
273
+ - spec/qup/producer_spec.rb
274
+ - spec/qup/queue_api_spec.rb
275
+ - spec/qup/session_spec.rb
276
+ - spec/qup/shared_adapter_examples.rb
277
+ - spec/qup/shared_queue_examples.rb
278
+ - spec/qup/shared_topic_examples.rb
279
+ - spec/qup/topic_api_spec.rb
280
+ - spec/qup_spec.rb
281
+ - spec/spec_helper.rb