alephant-renderer 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +5 -2
- data/lib/alephant/renderer.rb +1 -1
- data/lib/alephant/renderer/error/{invalid_path.rb → invalid_base_path.rb} +10 -0
- data/lib/alephant/renderer/version.rb +1 -1
- data/lib/alephant/renderer/view_mapper.rb +2 -14
- data/spec/spec_helper.rb +1 -1
- data/spec/view_mapper_spec.rb +2 -2
- metadata +96 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5453bd0fbd29bcef66f32158b2111f95b0fe8f60
|
4
|
+
data.tar.gz: bf08b3b652ef6704d8716f2ba281f96ae83ead64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3016141f890cbab1b78582e758c65547468f845342aec525297238e9783c1cce63f9757b95921570ce4738f7c784ea9afa4300c437c1b5b7f5f1a25a9cbc40e2
|
7
|
+
data.tar.gz: 07e0f9f0963c99d33c8d97cafe267702377ebc9010ae0033f96f1a0e1d28786477821f8774c89e5c2cc696c53de22a2a30e69c6701288624919b7035c1418f9c
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
data/lib/alephant/renderer.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
+
require 'alephant/logger'
|
2
|
+
|
1
3
|
module Alephant
|
2
4
|
module Renderer
|
3
5
|
module Error
|
4
6
|
class InvalidBasePath < StandardError
|
7
|
+
include Logger
|
8
|
+
|
5
9
|
def initialize(path)
|
6
10
|
super "Path '#{path}' to renderer/queue directory is invalid"
|
11
|
+
|
12
|
+
logger.metric('ViewMapperInvalidPath')
|
13
|
+
logger.error(
|
14
|
+
event: :ViewMapperInvalidPath,
|
15
|
+
path: path
|
16
|
+
)
|
7
17
|
end
|
8
18
|
end
|
9
19
|
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
require 'alephant/renderer/error/
|
2
|
-
require 'alephant/logger'
|
1
|
+
require 'alephant/renderer/error/invalid_base_path'
|
3
2
|
|
4
3
|
module Alephant
|
5
4
|
module Renderer
|
6
5
|
class ViewMapper
|
7
|
-
include Logger
|
8
6
|
|
9
7
|
DEFAULT_LOCATION = 'components'.freeze
|
10
8
|
|
@@ -17,7 +15,7 @@ module Alephant
|
|
17
15
|
end
|
18
16
|
|
19
17
|
def base_path=(path)
|
20
|
-
@base_path = File.directory?(path) ? path :
|
18
|
+
@base_path = File.directory?(path) ? path : raise(Error::InvalidBasePath.new(path))
|
21
19
|
end
|
22
20
|
|
23
21
|
def generate(data)
|
@@ -30,16 +28,6 @@ module Alephant
|
|
30
28
|
|
31
29
|
private
|
32
30
|
|
33
|
-
def raise_error(path)
|
34
|
-
logger.metric('ViewMapperInvalidPath')
|
35
|
-
logger.error(
|
36
|
-
event: :ViewMapperBasePathInvalidFound,
|
37
|
-
path: path,
|
38
|
-
method: "#{self.class}#raise_error"
|
39
|
-
)
|
40
|
-
raise(Error::InvalidBasePath.new(path))
|
41
|
-
end
|
42
|
-
|
43
31
|
def model(view_id, data)
|
44
32
|
require model_location_for view_id
|
45
33
|
Views.get_registered_class(view_id).new(data)
|
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ require 'pry'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
require 'alephant/renderer'
|
7
|
-
require 'alephant/renderer/error/
|
7
|
+
require 'alephant/renderer/error/invalid_base_path'
|
8
8
|
require 'alephant/renderer/views'
|
9
9
|
require 'alephant/renderer/views/json'
|
10
10
|
require 'alephant/renderer/views/envelope'
|
data/spec/view_mapper_spec.rb
CHANGED
@@ -8,10 +8,10 @@ describe Alephant::Renderer::ViewMapper do
|
|
8
8
|
subject { Alephant::Renderer::ViewMapper }
|
9
9
|
|
10
10
|
describe 'initialize(view_base_path)' do
|
11
|
-
context 'view_base_path =
|
11
|
+
context 'view_base_path = invalid_base_path' do
|
12
12
|
it 'should raise an error' do
|
13
13
|
expect do
|
14
|
-
subject.new(renderer_id, './
|
14
|
+
subject.new(renderer_id, './invalid_base_path')
|
15
15
|
end.to raise_error ::Alephant::Renderer::Error::InvalidBasePath
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,235 +1,235 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-renderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
15
|
requirement: !ruby/object:Gem::Requirement
|
21
16
|
requirements:
|
22
|
-
- -
|
17
|
+
- - ">="
|
23
18
|
- !ruby/object:Gem::Version
|
24
19
|
version: '0'
|
25
|
-
prerelease: false
|
26
20
|
type: :development
|
27
|
-
|
28
|
-
name: rspec-nc
|
21
|
+
prerelease: false
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
|
-
- -
|
24
|
+
- - ">="
|
32
25
|
- !ruby/object:Gem::Version
|
33
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-nc
|
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
|
-
|
42
|
-
name: guard
|
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: guard
|
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
|
-
|
56
|
-
name: guard-rspec
|
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-rspec
|
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
|
-
|
70
|
-
name: pry
|
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: pry
|
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
|
-
|
84
|
-
name: pry-remote
|
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-remote
|
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
|
-
|
98
|
-
name: pry-nav
|
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-nav
|
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
|
-
|
112
|
-
name: bundler
|
105
|
+
prerelease: false
|
113
106
|
version_requirements: !ruby/object:Gem::Requirement
|
114
107
|
requirements:
|
115
|
-
- -
|
108
|
+
- - ">="
|
116
109
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
118
113
|
requirement: !ruby/object:Gem::Requirement
|
119
114
|
requirements:
|
120
|
-
- - ~>
|
115
|
+
- - "~>"
|
121
116
|
- !ruby/object:Gem::Version
|
122
117
|
version: '1.5'
|
123
|
-
prerelease: false
|
124
118
|
type: :development
|
125
|
-
|
126
|
-
name: rake
|
119
|
+
prerelease: false
|
127
120
|
version_requirements: !ruby/object:Gem::Requirement
|
128
121
|
requirements:
|
129
|
-
- -
|
122
|
+
- - "~>"
|
130
123
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
124
|
+
version: '1.5'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
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: :development
|
139
|
-
|
140
|
-
name: rake-rspec
|
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: rake-rspec
|
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: :development
|
153
|
-
|
154
|
-
name: i18n
|
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: i18n
|
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
|
-
|
168
|
-
name: mustache
|
161
|
+
prerelease: false
|
169
162
|
version_requirements: !ruby/object:Gem::Requirement
|
170
163
|
requirements:
|
171
|
-
- -
|
164
|
+
- - ">="
|
172
165
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: mustache
|
174
169
|
requirement: !ruby/object:Gem::Requirement
|
175
170
|
requirements:
|
176
|
-
- - ~>
|
171
|
+
- - "~>"
|
177
172
|
- !ruby/object:Gem::Version
|
178
173
|
version: 0.99.5
|
179
|
-
prerelease: false
|
180
174
|
type: :runtime
|
181
|
-
|
182
|
-
name: alephant-logger
|
175
|
+
prerelease: false
|
183
176
|
version_requirements: !ruby/object:Gem::Requirement
|
184
177
|
requirements:
|
185
|
-
- -
|
178
|
+
- - "~>"
|
186
179
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
180
|
+
version: 0.99.5
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: alephant-logger
|
188
183
|
requirement: !ruby/object:Gem::Requirement
|
189
184
|
requirements:
|
190
|
-
- -
|
185
|
+
- - ">="
|
191
186
|
- !ruby/object:Gem::Version
|
192
187
|
version: '0'
|
193
|
-
prerelease: false
|
194
188
|
type: :runtime
|
195
|
-
|
196
|
-
name: hashie
|
189
|
+
prerelease: false
|
197
190
|
version_requirements: !ruby/object:Gem::Requirement
|
198
191
|
requirements:
|
199
|
-
- -
|
192
|
+
- - ">="
|
200
193
|
- !ruby/object:Gem::Version
|
201
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: hashie
|
202
197
|
requirement: !ruby/object:Gem::Requirement
|
203
198
|
requirements:
|
204
|
-
- -
|
199
|
+
- - ">="
|
205
200
|
- !ruby/object:Gem::Version
|
206
201
|
version: '0'
|
207
|
-
prerelease: false
|
208
202
|
type: :runtime
|
209
|
-
|
210
|
-
name: listen
|
203
|
+
prerelease: false
|
211
204
|
version_requirements: !ruby/object:Gem::Requirement
|
212
205
|
requirements:
|
213
|
-
- -
|
206
|
+
- - ">="
|
214
207
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: listen
|
216
211
|
requirement: !ruby/object:Gem::Requirement
|
217
212
|
requirements:
|
218
|
-
- - ~>
|
213
|
+
- - "~>"
|
219
214
|
- !ruby/object:Gem::Version
|
220
215
|
version: 3.0.0
|
221
|
-
prerelease: false
|
222
216
|
type: :runtime
|
223
|
-
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 3.0.0
|
223
|
+
description:
|
224
224
|
email:
|
225
225
|
- FutureMediaNewsRubyGems@bbc.co.uk
|
226
226
|
executables: []
|
227
227
|
extensions: []
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
|
-
- .gitignore
|
231
|
-
- .ruby-version
|
232
|
-
- .travis.yml
|
230
|
+
- ".gitignore"
|
231
|
+
- ".ruby-version"
|
232
|
+
- ".travis.yml"
|
233
233
|
- Gemfile
|
234
234
|
- Guardfile
|
235
235
|
- LICENSE.txt
|
@@ -238,7 +238,7 @@ files:
|
|
238
238
|
- alephant-renderer.gemspec
|
239
239
|
- lib/alephant/renderer.rb
|
240
240
|
- lib/alephant/renderer/engine/mustache.rb
|
241
|
-
- lib/alephant/renderer/error/
|
241
|
+
- lib/alephant/renderer/error/invalid_base_path.rb
|
242
242
|
- lib/alephant/renderer/i18n/json.rb
|
243
243
|
- lib/alephant/renderer/i18n/locale_component_yaml.rb
|
244
244
|
- lib/alephant/renderer/response.rb
|
@@ -280,24 +280,24 @@ homepage: ''
|
|
280
280
|
licenses:
|
281
281
|
- MIT
|
282
282
|
metadata: {}
|
283
|
-
post_install_message:
|
283
|
+
post_install_message:
|
284
284
|
rdoc_options: []
|
285
285
|
require_paths:
|
286
286
|
- lib
|
287
287
|
required_ruby_version: !ruby/object:Gem::Requirement
|
288
288
|
requirements:
|
289
|
-
- -
|
289
|
+
- - ">="
|
290
290
|
- !ruby/object:Gem::Version
|
291
291
|
version: '0'
|
292
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
293
|
requirements:
|
294
|
-
- -
|
294
|
+
- - ">="
|
295
295
|
- !ruby/object:Gem::Version
|
296
296
|
version: '0'
|
297
297
|
requirements: []
|
298
|
-
rubyforge_project:
|
299
|
-
rubygems_version: 2.1
|
300
|
-
signing_key:
|
298
|
+
rubyforge_project:
|
299
|
+
rubygems_version: 2.5.1
|
300
|
+
signing_key:
|
301
301
|
specification_version: 4
|
302
302
|
summary: Render HTML snippets
|
303
303
|
test_files:
|