alephant-publisher 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c984eab1e8871d0a91156d544a8f194a42427da
4
- data.tar.gz: b001318354f020ca2d37bd8603be1a9c3cc429bd
3
+ metadata.gz: 0ffcbfe5a8bd5ca7202f003aa20ebc3e498c1fd3
4
+ data.tar.gz: c84321d14526f58e2170c716dd9ecb26c6435299
5
5
  SHA512:
6
- metadata.gz: e69212eb9d6d0efa802854b46dd5a8139e2d324e58b20f622c8ad308e15ff4b8735c1db7ffb100a6311edf6529251f3191597b97e0e2d2ea851d8e1847d3471a
7
- data.tar.gz: 0eb9f182d8a9c00cf939dcbaad3ebffb16006213b1ede65fcdd9dd3da12e999e017134e0ab1b721e5fc77ecdf134ea6d848acc14380574fc8fc896d2c0ae7d6f
6
+ metadata.gz: 72b807511b2523936302aab655003f5d452be68ba0f834b0bd74ef3cfef6486a819115744c66a876e9436523903c95e4296642afc25085647a8a30c1f573398d
7
+ data.tar.gz: 6896d2f96e6e2e79e5a1da7086ecf4ee9719e0daa533784f7efbd1f91ca38a42abd0bdc3c76ade488dfd41f0d2c8f1cc9cb2d7bb5f22bfe8ee22fc2ff46ebf65
@@ -56,8 +56,17 @@ module Alephant
56
56
  )
57
57
  end
58
58
 
59
+ def sqs_client
60
+ @sqs_client ||= AWS::SQS.new
61
+ end
62
+
63
+ def sqs_queue_options
64
+ opts.queue[:aws_account_id].nil? ? {} : { :queue_owner_aws_account_id => opts.queue[:aws_account_id] }
65
+ end
66
+
59
67
  def aws_queue
60
- AWS::SQS.new.queues.named(opts.queue[:sqs_queue_name])
68
+ queue_url = sqs_client.queues.url_for(opts.queue[:sqs_queue_name], sqs_queue_options)
69
+ sqs_client.queues[queue_url]
61
70
  end
62
71
 
63
72
  end
@@ -11,7 +11,8 @@ module Alephant
11
11
  QUEUE_OPTS = [
12
12
  :receive_wait_time,
13
13
  :sqs_queue_name,
14
- :visibility_timeout
14
+ :visibility_timeout,
15
+ :aws_account_id
15
16
  ]
16
17
 
17
18
  WRITER_OPTS = [
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Publisher
3
- VERSION = "0.6.7"
3
+ VERSION = "0.6.8"
4
4
  end
5
5
  end
@@ -1,20 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Alephant::Publisher do
4
- let(:options) { Alephant::Publisher::Options.new }
5
- let(:instance) { Alephant::Publisher.create(options) }
4
+ let(:options) { Alephant::Publisher::Options.new }
5
+ let(:queue) { double('AWS::SQS::Queue', :url => nil ) }
6
+ let(:queue_double) { double('AWS::SQS::QueueCollection', :[] => queue, :url_for => nil) }
7
+ let(:client_double) { double('AWS::SQS', :queues => queue_double) }
6
8
 
7
9
  before(:each) do
8
- allow_any_instance_of(Alephant::Publisher::SQSHelper::Queue).to receive(:initialize)
10
+ expect(AWS::SQS).to receive(:new).and_return(client_double)
9
11
  end
10
12
 
11
- describe "#initialize(opts = {}, logger)" do
13
+ describe ".create" do
12
14
  it "sets parser, sequencer, queue and writer" do
13
- queue_double = double('AWS::SQS::QueueCollection', :named => 'test-queue')
14
- sqs_double = double('AWS::SQS', :queues => queue_double)
15
-
16
- expect(AWS::SQS).to receive(:new).and_return(sqs_double)
15
+ instance = Alephant::Publisher.create(options)
17
16
  expect(instance.queue).to be_a Alephant::Publisher::SQSHelper::Queue
18
17
  end
18
+
19
+ context "with account" do
20
+ it "creates a queue with an account number in the option hash" do
21
+ options = Alephant::Publisher::Options.new
22
+ options.add_queue({ :sqs_queue_name => 'bar', :aws_account_id => 'foo' })
23
+
24
+ expect(queue_double).to receive(:url_for).with('bar', { :queue_owner_aws_account_id => 'foo' })
25
+
26
+ Alephant::Publisher.create(options)
27
+ end
28
+ end
29
+
30
+ context "without account" do
31
+ it "creates a queue with an empty option hash" do
32
+ options = Alephant::Publisher::Options.new
33
+ options.add_queue({ :sqs_queue_name => 'bar' })
34
+
35
+ expect(queue_double).to receive(:url_for).with('bar', {})
36
+
37
+ Alephant::Publisher.create(options)
38
+ end
39
+ end
19
40
  end
20
41
  end
@@ -2,4 +2,7 @@ require 'pry'
2
2
 
3
3
  require 'aws-sdk'
4
4
  require 'alephant/publisher'
5
+ require 'alephant/publisher/views'
6
+ require 'alephant/publisher/views/json'
7
+ require 'alephant/publisher/views/html'
5
8
 
metadata CHANGED
@@ -1,351 +1,351 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Integralist
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-23 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- version_requirements: !ruby/object:Gem::Requirement
15
+ requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
- requirement: !ruby/object:Gem::Requirement
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
21
23
  requirements:
22
24
  - - ~>
23
25
  - !ruby/object:Gem::Version
24
26
  version: '1.5'
25
- prerelease: false
26
- type: :development
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
29
  requirement: !ruby/object:Gem::Requirement
35
30
  requirements:
36
31
  - - '>='
37
32
  - !ruby/object:Gem::Version
38
33
  version: '0'
39
- prerelease: false
40
34
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: rspec-nc
35
+ prerelease: false
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
38
  - - '>='
46
39
  - !ruby/object:Gem::Version
47
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-nc
48
43
  requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
45
  - - '>='
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
- prerelease: false
54
48
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: guard
49
+ prerelease: false
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
52
  - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
62
57
  requirement: !ruby/object:Gem::Requirement
63
58
  requirements:
64
59
  - - '>='
65
60
  - !ruby/object:Gem::Version
66
61
  version: '0'
67
- prerelease: false
68
62
  type: :development
69
- - !ruby/object:Gem::Dependency
70
- name: guard-rspec
63
+ prerelease: false
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
66
  - - '>='
74
67
  - !ruby/object:Gem::Version
75
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
76
71
  requirement: !ruby/object:Gem::Requirement
77
72
  requirements:
78
73
  - - '>='
79
74
  - !ruby/object:Gem::Version
80
75
  version: '0'
81
- prerelease: false
82
76
  type: :development
83
- - !ruby/object:Gem::Dependency
84
- name: pry
77
+ prerelease: false
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
80
  - - '>='
88
81
  - !ruby/object:Gem::Version
89
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
90
85
  requirement: !ruby/object:Gem::Requirement
91
86
  requirements:
92
87
  - - '>='
93
88
  - !ruby/object:Gem::Version
94
89
  version: '0'
95
- prerelease: false
96
90
  type: :development
97
- - !ruby/object:Gem::Dependency
98
- name: pry-remote
91
+ prerelease: false
99
92
  version_requirements: !ruby/object:Gem::Requirement
100
93
  requirements:
101
94
  - - '>='
102
95
  - !ruby/object:Gem::Version
103
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-remote
104
99
  requirement: !ruby/object:Gem::Requirement
105
100
  requirements:
106
101
  - - '>='
107
102
  - !ruby/object:Gem::Version
108
103
  version: '0'
109
- prerelease: false
110
104
  type: :development
111
- - !ruby/object:Gem::Dependency
112
- name: pry-nav
105
+ prerelease: false
113
106
  version_requirements: !ruby/object:Gem::Requirement
114
107
  requirements:
115
108
  - - '>='
116
109
  - !ruby/object:Gem::Version
117
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-nav
118
113
  requirement: !ruby/object:Gem::Requirement
119
114
  requirements:
120
115
  - - '>='
121
116
  - !ruby/object:Gem::Version
122
117
  version: '0'
123
- prerelease: false
124
118
  type: :development
125
- - !ruby/object:Gem::Dependency
126
- name: sinatra
119
+ prerelease: false
127
120
  version_requirements: !ruby/object:Gem::Requirement
128
121
  requirements:
129
122
  - - '>='
130
123
  - !ruby/object:Gem::Version
131
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sinatra
132
127
  requirement: !ruby/object:Gem::Requirement
133
128
  requirements:
134
129
  - - '>='
135
130
  - !ruby/object:Gem::Version
136
131
  version: '0'
137
- prerelease: false
138
132
  type: :runtime
139
- - !ruby/object:Gem::Dependency
140
- name: faraday
133
+ prerelease: false
141
134
  version_requirements: !ruby/object:Gem::Requirement
142
135
  requirements:
143
136
  - - '>='
144
137
  - !ruby/object:Gem::Version
145
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: faraday
146
141
  requirement: !ruby/object:Gem::Requirement
147
142
  requirements:
148
143
  - - '>='
149
144
  - !ruby/object:Gem::Version
150
145
  version: '0'
151
- prerelease: false
152
146
  type: :runtime
153
- - !ruby/object:Gem::Dependency
154
- name: trollop
147
+ prerelease: false
155
148
  version_requirements: !ruby/object:Gem::Requirement
156
149
  requirements:
157
150
  - - '>='
158
151
  - !ruby/object:Gem::Version
159
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: trollop
160
155
  requirement: !ruby/object:Gem::Requirement
161
156
  requirements:
162
157
  - - '>='
163
158
  - !ruby/object:Gem::Version
164
159
  version: '0'
165
- prerelease: false
166
160
  type: :runtime
167
- - !ruby/object:Gem::Dependency
168
- name: rake
161
+ prerelease: false
169
162
  version_requirements: !ruby/object:Gem::Requirement
170
163
  requirements:
171
164
  - - '>='
172
165
  - !ruby/object:Gem::Version
173
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rake
174
169
  requirement: !ruby/object:Gem::Requirement
175
170
  requirements:
176
171
  - - '>='
177
172
  - !ruby/object:Gem::Version
178
173
  version: '0'
179
- prerelease: false
180
174
  type: :runtime
181
- - !ruby/object:Gem::Dependency
182
- name: aws-sdk
175
+ prerelease: false
183
176
  version_requirements: !ruby/object:Gem::Requirement
184
177
  requirements:
185
- - - ~>
178
+ - - '>='
186
179
  - !ruby/object:Gem::Version
187
- version: '1.0'
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: aws-sdk
188
183
  requirement: !ruby/object:Gem::Requirement
189
184
  requirements:
190
185
  - - ~>
191
186
  - !ruby/object:Gem::Version
192
187
  version: '1.0'
193
- prerelease: false
194
188
  type: :runtime
195
- - !ruby/object:Gem::Dependency
196
- name: mustache
189
+ prerelease: false
197
190
  version_requirements: !ruby/object:Gem::Requirement
198
191
  requirements:
199
- - - '>='
192
+ - - ~>
200
193
  - !ruby/object:Gem::Version
201
- version: 0.99.5
194
+ version: '1.0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: mustache
202
197
  requirement: !ruby/object:Gem::Requirement
203
198
  requirements:
204
199
  - - '>='
205
200
  - !ruby/object:Gem::Version
206
201
  version: 0.99.5
207
- prerelease: false
208
202
  type: :runtime
209
- - !ruby/object:Gem::Dependency
210
- name: jsonpath
203
+ prerelease: false
211
204
  version_requirements: !ruby/object:Gem::Requirement
212
205
  requirements:
213
206
  - - '>='
214
207
  - !ruby/object:Gem::Version
215
- version: '0'
208
+ version: 0.99.5
209
+ - !ruby/object:Gem::Dependency
210
+ name: jsonpath
216
211
  requirement: !ruby/object:Gem::Requirement
217
212
  requirements:
218
213
  - - '>='
219
214
  - !ruby/object:Gem::Version
220
215
  version: '0'
221
- prerelease: false
222
216
  type: :runtime
223
- - !ruby/object:Gem::Dependency
224
- name: crimp
217
+ prerelease: false
225
218
  version_requirements: !ruby/object:Gem::Requirement
226
219
  requirements:
227
220
  - - '>='
228
221
  - !ruby/object:Gem::Version
229
222
  version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: crimp
230
225
  requirement: !ruby/object:Gem::Requirement
231
226
  requirements:
232
227
  - - '>='
233
228
  - !ruby/object:Gem::Version
234
229
  version: '0'
235
- prerelease: false
236
230
  type: :runtime
237
- - !ruby/object:Gem::Dependency
238
- name: peach
231
+ prerelease: false
239
232
  version_requirements: !ruby/object:Gem::Requirement
240
233
  requirements:
241
234
  - - '>='
242
235
  - !ruby/object:Gem::Version
243
236
  version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: peach
244
239
  requirement: !ruby/object:Gem::Requirement
245
240
  requirements:
246
241
  - - '>='
247
242
  - !ruby/object:Gem::Version
248
243
  version: '0'
249
- prerelease: false
250
244
  type: :runtime
251
- - !ruby/object:Gem::Dependency
252
- name: i18n
245
+ prerelease: false
253
246
  version_requirements: !ruby/object:Gem::Requirement
254
247
  requirements:
255
248
  - - '>='
256
249
  - !ruby/object:Gem::Version
257
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: i18n
258
253
  requirement: !ruby/object:Gem::Requirement
259
254
  requirements:
260
255
  - - '>='
261
256
  - !ruby/object:Gem::Version
262
257
  version: '0'
263
- prerelease: false
264
258
  type: :runtime
265
- - !ruby/object:Gem::Dependency
266
- name: hashie
259
+ prerelease: false
267
260
  version_requirements: !ruby/object:Gem::Requirement
268
261
  requirements:
269
262
  - - '>='
270
263
  - !ruby/object:Gem::Version
271
264
  version: '0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: hashie
272
267
  requirement: !ruby/object:Gem::Requirement
273
268
  requirements:
274
269
  - - '>='
275
270
  - !ruby/object:Gem::Version
276
271
  version: '0'
277
- prerelease: false
278
272
  type: :runtime
279
- - !ruby/object:Gem::Dependency
280
- name: alephant-support
273
+ prerelease: false
281
274
  version_requirements: !ruby/object:Gem::Requirement
282
275
  requirements:
283
276
  - - '>='
284
277
  - !ruby/object:Gem::Version
285
278
  version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ name: alephant-support
286
281
  requirement: !ruby/object:Gem::Requirement
287
282
  requirements:
288
283
  - - '>='
289
284
  - !ruby/object:Gem::Version
290
285
  version: '0'
291
- prerelease: false
292
286
  type: :runtime
293
- - !ruby/object:Gem::Dependency
294
- name: alephant-sequencer
287
+ prerelease: false
295
288
  version_requirements: !ruby/object:Gem::Requirement
296
289
  requirements:
297
290
  - - '>='
298
291
  - !ruby/object:Gem::Version
299
292
  version: '0'
293
+ - !ruby/object:Gem::Dependency
294
+ name: alephant-sequencer
300
295
  requirement: !ruby/object:Gem::Requirement
301
296
  requirements:
302
297
  - - '>='
303
298
  - !ruby/object:Gem::Version
304
299
  version: '0'
305
- prerelease: false
306
300
  type: :runtime
307
- - !ruby/object:Gem::Dependency
308
- name: alephant-cache
301
+ prerelease: false
309
302
  version_requirements: !ruby/object:Gem::Requirement
310
303
  requirements:
311
304
  - - '>='
312
305
  - !ruby/object:Gem::Version
313
306
  version: '0'
307
+ - !ruby/object:Gem::Dependency
308
+ name: alephant-cache
314
309
  requirement: !ruby/object:Gem::Requirement
315
310
  requirements:
316
311
  - - '>='
317
312
  - !ruby/object:Gem::Version
318
313
  version: '0'
319
- prerelease: false
320
314
  type: :runtime
321
- - !ruby/object:Gem::Dependency
322
- name: alephant-logger
315
+ prerelease: false
323
316
  version_requirements: !ruby/object:Gem::Requirement
324
317
  requirements:
325
318
  - - '>='
326
319
  - !ruby/object:Gem::Version
327
320
  version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: alephant-logger
328
323
  requirement: !ruby/object:Gem::Requirement
329
324
  requirements:
330
325
  - - '>='
331
326
  - !ruby/object:Gem::Version
332
327
  version: '0'
333
- prerelease: false
334
328
  type: :runtime
335
- - !ruby/object:Gem::Dependency
336
- name: alephant-lookup
329
+ prerelease: false
337
330
  version_requirements: !ruby/object:Gem::Requirement
338
331
  requirements:
339
332
  - - '>='
340
333
  - !ruby/object:Gem::Version
341
334
  version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: alephant-lookup
342
337
  requirement: !ruby/object:Gem::Requirement
343
338
  requirements:
344
339
  - - '>='
345
340
  - !ruby/object:Gem::Version
346
341
  version: '0'
347
- prerelease: false
348
342
  type: :runtime
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - '>='
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
349
349
  description: Static publishing to S3 based on SQS messages
350
350
  email:
351
351
  - mark.mcdx@gmail.com
@@ -392,7 +392,7 @@ homepage: https://github.com/BBC-News/alephant-publisher
392
392
  licenses:
393
393
  - MIT
394
394
  metadata: {}
395
- post_install_message:
395
+ post_install_message:
396
396
  rdoc_options: []
397
397
  require_paths:
398
398
  - lib
@@ -407,9 +407,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0'
409
409
  requirements: []
410
- rubyforge_project:
411
- rubygems_version: 2.1.9
412
- signing_key:
410
+ rubyforge_project:
411
+ rubygems_version: 2.2.2
412
+ signing_key:
413
413
  specification_version: 4
414
414
  summary: Static publishing to S3 based on SQS messages
415
415
  test_files: