alephant 0.1.3-java → 0.1.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/alephant.gemspec +1 -1
- data/lib/alephant.rb +2 -2
- data/lib/alephant/models/writer.rb +0 -1
- data/lib/alephant/version.rb +1 -1
- data/spec/alephant_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- metadata +10 -14
- data/lib/alephant/models/jsonpath_lookup.rb +0 -16
- data/lib/alephant/models/parser.rb +0 -27
- data/spec/parser_spec.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e841b76d7e0ea7ea36452640b7ba205fc43955
|
4
|
+
data.tar.gz: 7ea57588028f5cb3a7a8f8ddde7922c9e3330d83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a36fbe69c63d9d30052a9f8d70d26f932c93daf3a9b5fcffb885a83d660773a4c568ec772e0906da1e66a5529a04a326742e45c258dcc887ac589bd623d6a9b
|
7
|
+
data.tar.gz: cfafebe0f3192e360aee7c7c5188ff50617f90ecb3e910d3a26ac6455a8096c3f8442319d3eb309eb38ba58325eacb9154541e3cb037f49ddc7bf8c32cddfe72
|
data/LICENSE
CHANGED
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|
652
652
|
If the program does terminal interaction, make it output a short
|
653
653
|
notice like this when it starts in an interactive mode:
|
654
654
|
|
655
|
-
|
655
|
+
alephant Copyright (C) 2014 BBC News
|
656
656
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657
657
|
This is free software, and you are welcome to redistribute it
|
658
658
|
under certain conditions; type `show c' for details.
|
data/alephant.gemspec
CHANGED
@@ -34,7 +34,6 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_runtime_dependency 'rake'
|
35
35
|
s.add_runtime_dependency 'aws-sdk', '~> 1.0'
|
36
36
|
s.add_runtime_dependency 'mustache', '>= 0.99.5'
|
37
|
-
s.add_runtime_dependency 'jsonpath'
|
38
37
|
|
39
38
|
s.add_runtime_dependency 'crimp'
|
40
39
|
s.add_runtime_dependency 'alephant-sequencer'
|
@@ -43,5 +42,6 @@ Gem::Specification.new do |s|
|
|
43
42
|
s.add_runtime_dependency 'alephant-renderer'
|
44
43
|
s.add_runtime_dependency 'alephant-lookup'
|
45
44
|
s.add_runtime_dependency 'alephant-preview'
|
45
|
+
s.add_runtime_dependency 'alephant-support'
|
46
46
|
end
|
47
47
|
|
data/lib/alephant.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'env'
|
2
2
|
|
3
3
|
require 'alephant/models/render_mapper'
|
4
|
-
require 'alephant/
|
4
|
+
require 'alephant/support'
|
5
5
|
require 'alephant/models/writer'
|
6
6
|
require 'alephant/models/queue'
|
7
7
|
|
@@ -21,7 +21,7 @@ module Alephant
|
|
21
21
|
def initialize(opts = {}, logger = nil)
|
22
22
|
::Alephant::Logger.set_logger(logger) unless logger.nil?
|
23
23
|
|
24
|
-
@parser = Parser.new(
|
24
|
+
@parser = Support::Parser.new(
|
25
25
|
opts[:msg_vary_id_path]
|
26
26
|
)
|
27
27
|
@sequencer = Sequencer.create(
|
data/lib/alephant/version.rb
CHANGED
data/spec/alephant_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Alephant::Alephant do
|
|
5
5
|
before(:each) do
|
6
6
|
Alephant::Writer.any_instance.stub(:initialize)
|
7
7
|
Alephant::Queue.any_instance.stub(:initialize)
|
8
|
-
Alephant::Parser.any_instance.stub(:initialize)
|
8
|
+
Alephant::Support::Parser.any_instance.stub(:initialize)
|
9
9
|
Alephant::Sequencer::Sequencer.any_instance.stub(:initialize)
|
10
10
|
end
|
11
11
|
|
@@ -13,7 +13,7 @@ describe Alephant::Alephant do
|
|
13
13
|
it "sets parser, sequencer, queue and writer" do
|
14
14
|
expect(subject.writer).to be_a Alephant::Writer
|
15
15
|
expect(subject.queue).to be_a Alephant::Queue
|
16
|
-
expect(subject.parser).to be_a Alephant::Parser
|
16
|
+
expect(subject.parser).to be_a Alephant::Support::Parser
|
17
17
|
expect(subject.sequencer).to be_a Alephant::Sequencer::Sequencer
|
18
18
|
end
|
19
19
|
end
|
@@ -39,7 +39,7 @@ describe Alephant::Alephant do
|
|
39
39
|
subject { Alephant::Alephant.new }
|
40
40
|
|
41
41
|
before(:each) do
|
42
|
-
Alephant::Parser.any_instance
|
42
|
+
Alephant::Support::Parser.any_instance
|
43
43
|
.stub(:parse)
|
44
44
|
.and_return(:parsed_msg)
|
45
45
|
Alephant::Sequencer::Sequencer
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Robert Kenny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
prerelease: false
|
194
194
|
type: :runtime
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: crimp
|
197
197
|
version_requirements: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - '>='
|
@@ -207,7 +207,7 @@ dependencies:
|
|
207
207
|
prerelease: false
|
208
208
|
type: :runtime
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
210
|
+
name: alephant-sequencer
|
211
211
|
version_requirements: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - '>='
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
prerelease: false
|
222
222
|
type: :runtime
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name: alephant-
|
224
|
+
name: alephant-logger
|
225
225
|
version_requirements: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - '>='
|
@@ -235,7 +235,7 @@ dependencies:
|
|
235
235
|
prerelease: false
|
236
236
|
type: :runtime
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name: alephant-
|
238
|
+
name: alephant-cache
|
239
239
|
version_requirements: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - '>='
|
@@ -249,7 +249,7 @@ dependencies:
|
|
249
249
|
prerelease: false
|
250
250
|
type: :runtime
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
|
-
name: alephant-
|
252
|
+
name: alephant-renderer
|
253
253
|
version_requirements: !ruby/object:Gem::Requirement
|
254
254
|
requirements:
|
255
255
|
- - '>='
|
@@ -263,7 +263,7 @@ dependencies:
|
|
263
263
|
prerelease: false
|
264
264
|
type: :runtime
|
265
265
|
- !ruby/object:Gem::Dependency
|
266
|
-
name: alephant-
|
266
|
+
name: alephant-lookup
|
267
267
|
version_requirements: !ruby/object:Gem::Requirement
|
268
268
|
requirements:
|
269
269
|
- - '>='
|
@@ -277,7 +277,7 @@ dependencies:
|
|
277
277
|
prerelease: false
|
278
278
|
type: :runtime
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
|
-
name: alephant-
|
280
|
+
name: alephant-preview
|
281
281
|
version_requirements: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
283
|
- - '>='
|
@@ -291,7 +291,7 @@ dependencies:
|
|
291
291
|
prerelease: false
|
292
292
|
type: :runtime
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
|
-
name: alephant-
|
294
|
+
name: alephant-support
|
295
295
|
version_requirements: !ruby/object:Gem::Requirement
|
296
296
|
requirements:
|
297
297
|
- - '>='
|
@@ -320,8 +320,6 @@ files:
|
|
320
320
|
- Rakefile
|
321
321
|
- alephant.gemspec
|
322
322
|
- lib/alephant.rb
|
323
|
-
- lib/alephant/models/jsonpath_lookup.rb
|
324
|
-
- lib/alephant/models/parser.rb
|
325
323
|
- lib/alephant/models/queue.rb
|
326
324
|
- lib/alephant/models/render_mapper.rb
|
327
325
|
- lib/alephant/models/writer.rb
|
@@ -332,7 +330,6 @@ files:
|
|
332
330
|
- spec/fixtures/components/foo/models/foo.rb
|
333
331
|
- spec/fixtures/components/foo/templates/bar.mustache
|
334
332
|
- spec/fixtures/components/foo/templates/foo.mustache
|
335
|
-
- spec/parser_spec.rb
|
336
333
|
- spec/queue_spec.rb
|
337
334
|
- spec/render_mapper_spec.rb
|
338
335
|
- spec/spec_helper.rb
|
@@ -367,7 +364,6 @@ test_files:
|
|
367
364
|
- spec/fixtures/components/foo/models/foo.rb
|
368
365
|
- spec/fixtures/components/foo/templates/bar.mustache
|
369
366
|
- spec/fixtures/components/foo/templates/foo.mustache
|
370
|
-
- spec/parser_spec.rb
|
371
367
|
- spec/queue_spec.rb
|
372
368
|
- spec/render_mapper_spec.rb
|
373
369
|
- spec/spec_helper.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'jsonpath'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module Alephant
|
5
|
-
class JsonPathLookup
|
6
|
-
attr_reader :path
|
7
|
-
def initialize(path)
|
8
|
-
@path = path
|
9
|
-
@jsonpath = JsonPath.new(path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def lookup(msg)
|
13
|
-
@jsonpath.on(JSON.parse(msg)).first
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module Alephant
|
4
|
-
class Parser
|
5
|
-
attr_reader :vary_lookup
|
6
|
-
|
7
|
-
def initialize(vary_jsonpath = nil)
|
8
|
-
@vary_lookup = vary_jsonpath ? JsonPathLookup.new(vary_jsonpath) : nil
|
9
|
-
end
|
10
|
-
|
11
|
-
def parse(msg)
|
12
|
-
symbolize(msg.body).tap { |o| o[:options] = options_for msg unless not o[:options].nil? }
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def symbolize(data)
|
17
|
-
JSON.parse(data, :symbolize_names => true)
|
18
|
-
end
|
19
|
-
|
20
|
-
def options_for(msg)
|
21
|
-
{}.tap do |o|
|
22
|
-
o[:variant] = vary_lookup.lookup(msg.body) if not vary_lookup.nil?
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
data/spec/parser_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Alephant::Parser do
|
4
|
-
describe "parse(msg)" do
|
5
|
-
let(:msg) { Struct.new(:body).new("{ \"foo\":\"bar\" }") }
|
6
|
-
let(:msg_with_options) do
|
7
|
-
Struct.new(:body).new(<<-EOS)
|
8
|
-
{
|
9
|
-
"some" : {
|
10
|
-
"location" : "bar"
|
11
|
-
}
|
12
|
-
}
|
13
|
-
EOS
|
14
|
-
end
|
15
|
-
it "returns parsed JSON with symbolized keys" do
|
16
|
-
subject.parse(msg)[:foo].should eq 'bar'
|
17
|
-
end
|
18
|
-
|
19
|
-
context "initialized with vary_jsonpath" do
|
20
|
-
subject { Alephant::Parser.new('$.some.location') }
|
21
|
-
|
22
|
-
it "adds the correct :options to the returned hash" do
|
23
|
-
expect(subject.parse(msg_with_options)[:options][:variant]).to eq "bar"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|