pebblebed 0.1.3 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2NhMzIyNGVlMmIyM2IzNDVkZWM3ZmM1NmZmODEwY2IxMWM0OTNkYg==
5
+ data.tar.gz: !binary |-
6
+ MmM0MGZiNDJlZjhhOTczMGExYTIyM2Q5ZDhhMTBiYzM1OGExYmIxYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDRkZTg4Mzg2MThmOTQ0MjVhYzA0MzVkZWE3MmUxZTFlOTkyNjA0MjIzODUw
10
+ OTM4MjYwZjMxNTFmNzFkZmQwNmU5MDhjZjQ1ZDJmNDM1ZDFiNzIxNzA2MzE5
11
+ Mjk0YWZiYTMyYjg1NDIyNGY2NTk4NWFhYjQ5ZmUzNmZiODJlMWM=
12
+ data.tar.gz: !binary |-
13
+ ZjYyZDRmOTNjNTg3ZGQ5NGRhYmViYjg1NTUyZmM1Yzg4NmMzMTAzZDgwNTU0
14
+ MGZkNjBmYTk0ZTFkYTZkZjhlNDY5MDQ0YjEwNTBkOGFiNzYxYWUzMTgwMzY2
15
+ MDQ1NDUwMmU0NDE1MzFjMTIxY2VlMGQ0Y2E4MWM4YzFlMmE0ZTA=
@@ -8,6 +8,10 @@ module Pebblebed
8
8
  Pebblebed.memcached = value
9
9
  end
10
10
 
11
+ def session_cookie(value)
12
+ Pebblebed.session_cookie = value
13
+ end
14
+
11
15
  def service(name, options = {})
12
16
  Pebblebed.require_service(name, options)
13
17
  end
@@ -49,6 +53,14 @@ module Pebblebed
49
53
  @memcached = value
50
54
  end
51
55
 
56
+ def session_cookie
57
+ @session_cookie || 'checkpoint.session'
58
+ end
59
+
60
+ def session_cookie=(value)
61
+ @session_cookie = value
62
+ end
63
+
52
64
  def services
53
65
  @services.keys
54
66
  end
@@ -68,8 +80,12 @@ module Pebblebed
68
80
  @services[service.to_sym][:version] || 1
69
81
  end
70
82
 
83
+ def path_of(service)
84
+ @services[service.to_sym][:path] || "/api/#{service}"
85
+ end
86
+
71
87
  def root_url_for(service, url_opts={})
72
- URI.join(base_url_for(url_opts), "/api/#{service}/v#{version_of(service)}/")
88
+ URI.join(base_url_for(url_opts), "#{path_of(service)}/v#{version_of(service)}/")
73
89
  end
74
90
 
75
91
  def base_url_for(url_opts)
@@ -27,7 +27,6 @@ module Pebblebed
27
27
  def connect
28
28
  unless connected?
29
29
  bunny.start
30
- bunny.qos
31
30
  end
32
31
  end
33
32
 
@@ -48,7 +47,7 @@ module Pebblebed
48
47
 
49
48
  raise ArgumentError.new 'Queue must be named' unless options[:name]
50
49
 
51
- queue = bunny.queue(options[:name], :durable => true)
50
+ queue = channel.queue(options[:name], :durable => true)
52
51
  Subscription.new(options).queries.each do |key|
53
52
  queue.bind(exchange.name, :key => key)
54
53
  end
@@ -78,10 +77,15 @@ module Pebblebed
78
77
  environment == 'production'
79
78
  end
80
79
 
80
+ def channel
81
+ connect
82
+ @channel ||= @bunny.create_channel
83
+ end
84
+
81
85
  def exchange
82
86
  connect
83
87
 
84
- @exchange ||= bunny.exchange(exchange_name, :type => :topic, :durable => :true)
88
+ @exchange ||= channel.exchange(exchange_name, :type => :topic, :durable => :true)
85
89
  end
86
90
 
87
91
  end
@@ -28,7 +28,7 @@ module Sinatra
28
28
  end
29
29
 
30
30
  def current_session
31
- params[:session] || request.cookies['checkpoint.session']
31
+ params[:session] || request.cookies[::Pebblebed.session_cookie]
32
32
  end
33
33
  alias :checkpoint_session :current_session
34
34
 
@@ -93,7 +93,7 @@ module Sinatra
93
93
  end
94
94
 
95
95
  def require_access_to_path(path)
96
- require_identity
96
+ require_identity
97
97
  halt 403, "Access denied." unless has_access_to_path?(path)
98
98
  end
99
99
 
@@ -1,3 +1,3 @@
1
1
  module Pebblebed
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2"
3
3
  end
data/pebblebed.gemspec CHANGED
@@ -33,8 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency "futurevalue"
34
34
  s.add_runtime_dependency "pathbuilder"
35
35
  s.add_runtime_dependency "nokogiri"
36
- s.add_runtime_dependency "i18n"
37
36
  s.add_runtime_dependency "activesupport"
38
- s.add_runtime_dependency "bunny", "~> 0.8.0"
37
+ s.add_runtime_dependency "bunny", "~> 1.2.2"
39
38
 
40
39
  end
data/spec/config_spec.rb CHANGED
@@ -7,11 +7,13 @@ describe Pebblebed do
7
7
  Pebblebed.config do
8
8
  host "example.org"
9
9
  memcached "MemcachedClient"
10
+ session_cookie "my.session"
10
11
  service :checkpoint
11
12
  end
12
13
 
13
14
  Pebblebed.host.should eq "example.org"
14
15
  Pebblebed.memcached.should eq "MemcachedClient"
16
+ Pebblebed.session_cookie.should eq "my.session"
15
17
  Pebblebed::Connector.instance_methods.should include :checkpoint
16
18
  end
17
19
 
@@ -20,6 +22,11 @@ describe Pebblebed do
20
22
  -> {Pebblebed.memcached}.should raise_error RuntimeError
21
23
  end
22
24
 
25
+ it "has a default name of 'checkpoint.session' for the session cookie" do
26
+ Pebblebed.session_cookie = nil
27
+ Pebblebed.session_cookie.should eq "checkpoint.session"
28
+ end
29
+
23
30
  it "can calculate the root uri of any pebble" do
24
31
  Pebblebed.config do
25
32
  service :checkpoint
@@ -31,6 +38,17 @@ describe Pebblebed do
31
38
  Pebblebed.root_url_for(:foobar).to_s.should eq "http://example.org/api/foobar/v2/"
32
39
  end
33
40
 
41
+ it "allows the path of a pebble to be overridden" do
42
+ Pebblebed.config do
43
+ service :checkpoint, :path => '/my_api/my_checkpoint'
44
+ service :foobar, :version => 2
45
+ end
46
+ Pebblebed.host = "example.org"
47
+ Pebblebed.root_url_for(:checkpoint).to_s.should eq "http://example.org/my_api/my_checkpoint/v1/"
48
+ Pebblebed.root_url_for(:checkpoint, :host => 'checkpoint.dev').to_s.should eq "http://checkpoint.dev/my_api/my_checkpoint/v1/"
49
+ Pebblebed.root_url_for(:foobar).to_s.should eq "http://example.org/api/foobar/v2/"
50
+ end
51
+
34
52
  it "works with pebbles that are exposed via https" do
35
53
  Pebblebed.config do
36
54
  service :checkpoint
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebblebed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: '0.2'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Katrina Owen
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2014-06-20 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :development
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: rake
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: simplecov
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: sinatra
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ! '>='
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ! '>='
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: rack-test
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: memcache_mock
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,7 +91,6 @@ dependencies:
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
@@ -111,7 +98,6 @@ dependencies:
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: deepstruct
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
102
  - - ! '>='
117
103
  - !ruby/object:Gem::Version
@@ -119,7 +105,6 @@ dependencies:
119
105
  type: :runtime
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
109
  - - ! '>='
125
110
  - !ruby/object:Gem::Version
@@ -127,7 +112,6 @@ dependencies:
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: curb
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
116
  - - ! '>='
133
117
  - !ruby/object:Gem::Version
@@ -135,7 +119,6 @@ dependencies:
135
119
  type: :runtime
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
123
  - - ! '>='
141
124
  - !ruby/object:Gem::Version
@@ -143,7 +126,6 @@ dependencies:
143
126
  - !ruby/object:Gem::Dependency
144
127
  name: yajl-ruby
145
128
  requirement: !ruby/object:Gem::Requirement
146
- none: false
147
129
  requirements:
148
130
  - - ! '>='
149
131
  - !ruby/object:Gem::Version
@@ -151,7 +133,6 @@ dependencies:
151
133
  type: :runtime
152
134
  prerelease: false
153
135
  version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
136
  requirements:
156
137
  - - ! '>='
157
138
  - !ruby/object:Gem::Version
@@ -159,7 +140,6 @@ dependencies:
159
140
  - !ruby/object:Gem::Dependency
160
141
  name: queryparams
161
142
  requirement: !ruby/object:Gem::Requirement
162
- none: false
163
143
  requirements:
164
144
  - - ! '>='
165
145
  - !ruby/object:Gem::Version
@@ -167,7 +147,6 @@ dependencies:
167
147
  type: :runtime
168
148
  prerelease: false
169
149
  version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
150
  requirements:
172
151
  - - ! '>='
173
152
  - !ruby/object:Gem::Version
@@ -175,7 +154,6 @@ dependencies:
175
154
  - !ruby/object:Gem::Dependency
176
155
  name: futurevalue
177
156
  requirement: !ruby/object:Gem::Requirement
178
- none: false
179
157
  requirements:
180
158
  - - ! '>='
181
159
  - !ruby/object:Gem::Version
@@ -183,7 +161,6 @@ dependencies:
183
161
  type: :runtime
184
162
  prerelease: false
185
163
  version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
164
  requirements:
188
165
  - - ! '>='
189
166
  - !ruby/object:Gem::Version
@@ -191,7 +168,6 @@ dependencies:
191
168
  - !ruby/object:Gem::Dependency
192
169
  name: pathbuilder
193
170
  requirement: !ruby/object:Gem::Requirement
194
- none: false
195
171
  requirements:
196
172
  - - ! '>='
197
173
  - !ruby/object:Gem::Version
@@ -199,7 +175,6 @@ dependencies:
199
175
  type: :runtime
200
176
  prerelease: false
201
177
  version_requirements: !ruby/object:Gem::Requirement
202
- none: false
203
178
  requirements:
204
179
  - - ! '>='
205
180
  - !ruby/object:Gem::Version
@@ -207,7 +182,6 @@ dependencies:
207
182
  - !ruby/object:Gem::Dependency
208
183
  name: nokogiri
209
184
  requirement: !ruby/object:Gem::Requirement
210
- none: false
211
185
  requirements:
212
186
  - - ! '>='
213
187
  - !ruby/object:Gem::Version
@@ -215,23 +189,6 @@ dependencies:
215
189
  type: :runtime
216
190
  prerelease: false
217
191
  version_requirements: !ruby/object:Gem::Requirement
218
- none: false
219
- requirements:
220
- - - ! '>='
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
- - !ruby/object:Gem::Dependency
224
- name: i18n
225
- requirement: !ruby/object:Gem::Requirement
226
- none: false
227
- requirements:
228
- - - ! '>='
229
- - !ruby/object:Gem::Version
230
- version: '0'
231
- type: :runtime
232
- prerelease: false
233
- version_requirements: !ruby/object:Gem::Requirement
234
- none: false
235
192
  requirements:
236
193
  - - ! '>='
237
194
  - !ruby/object:Gem::Version
@@ -239,7 +196,6 @@ dependencies:
239
196
  - !ruby/object:Gem::Dependency
240
197
  name: activesupport
241
198
  requirement: !ruby/object:Gem::Requirement
242
- none: false
243
199
  requirements:
244
200
  - - ! '>='
245
201
  - !ruby/object:Gem::Version
@@ -247,7 +203,6 @@ dependencies:
247
203
  type: :runtime
248
204
  prerelease: false
249
205
  version_requirements: !ruby/object:Gem::Requirement
250
- none: false
251
206
  requirements:
252
207
  - - ! '>='
253
208
  - !ruby/object:Gem::Version
@@ -255,19 +210,17 @@ dependencies:
255
210
  - !ruby/object:Gem::Dependency
256
211
  name: bunny
257
212
  requirement: !ruby/object:Gem::Requirement
258
- none: false
259
213
  requirements:
260
214
  - - ~>
261
215
  - !ruby/object:Gem::Version
262
- version: 0.8.0
216
+ version: 1.2.2
263
217
  type: :runtime
264
218
  prerelease: false
265
219
  version_requirements: !ruby/object:Gem::Requirement
266
- none: false
267
220
  requirements:
268
221
  - - ~>
269
222
  - !ruby/object:Gem::Version
270
- version: 0.8.0
223
+ version: 1.2.2
271
224
  description: Development tools for working with Pebblebed
272
225
  email:
273
226
  - katrina@bengler.no
@@ -319,27 +272,26 @@ files:
319
272
  - spec/uid_spec.rb
320
273
  homepage: ''
321
274
  licenses: []
275
+ metadata: {}
322
276
  post_install_message:
323
277
  rdoc_options: []
324
278
  require_paths:
325
279
  - lib
326
280
  required_ruby_version: !ruby/object:Gem::Requirement
327
- none: false
328
281
  requirements:
329
282
  - - ! '>='
330
283
  - !ruby/object:Gem::Version
331
284
  version: '0'
332
285
  required_rubygems_version: !ruby/object:Gem::Requirement
333
- none: false
334
286
  requirements:
335
287
  - - ! '>='
336
288
  - !ruby/object:Gem::Version
337
289
  version: '0'
338
290
  requirements: []
339
291
  rubyforge_project: pebblebed
340
- rubygems_version: 1.8.25
292
+ rubygems_version: 2.2.2
341
293
  signing_key:
342
- specification_version: 3
294
+ specification_version: 4
343
295
  summary: Development tools for working with Pebblebed
344
296
  test_files:
345
297
  - spec/config_spec.rb