alephant-renderer 2.0.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +66 -8
- data/alephant-renderer.gemspec +1 -0
- data/lib/alephant/renderer/engine/mustache.rb +42 -0
- data/lib/alephant/renderer/i18n/locale_component_yaml.rb +53 -0
- data/lib/alephant/renderer/version.rb +1 -1
- data/lib/alephant/renderer/views/base.rb +5 -5
- data/lib/alephant/renderer/views/html.rb +31 -38
- data/spec/integration/engine_mustache_spec.rb +18 -0
- data/spec/integration/fixtures/components/lib/templates/legacy_shared_template.mustache +1 -0
- data/spec/integration/fixtures/components/locale/translations.yml +3 -0
- data/spec/integration/fixtures/components/test-renderer/models/legacy_module.rb +8 -0
- data/spec/integration/fixtures/components/test-renderer/models/legacy_shared_module.rb +8 -0
- data/spec/integration/fixtures/components/test-renderer/models/translating_module.rb +7 -0
- data/spec/integration/fixtures/components/test-renderer/templates/legacy_module.mustache +1 -0
- data/spec/integration/fixtures/components/test-renderer/templates/legacy_shared_module.mustache +1 -0
- data/spec/integration/fixtures/components/test-renderer/templates/translating_module.mustache +1 -0
- data/spec/integration/fixtures/templates/sample.mustache +1 -0
- data/spec/integration/fixtures/translations.yml +9 -0
- data/spec/integration/i18n_locale_component_yaml_spec.rb +35 -0
- data/spec/integration/views_html_spec.rb +43 -0
- data/spec/spec_helper.rb +1 -1
- metadata +81 -40
- data/trans.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9591905fd45c75107c668cd11a21c8beb281d83
|
4
|
+
data.tar.gz: 411a4f3a3b03a1f6adaf3aa78068bbeeb15b1e63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f568b783142251a21023d92f44daf86821c396c5c23b16baa5b2c512953a8fdb31a8dd364b1762cfaee8e6be4b984a41abd8f009ba63fd10a1deb999f27500e6
|
7
|
+
data.tar.gz: a7c27d89826d706bb0b414e7490b35cedf0f2811940106cd95377b93b938a75884539b9d2f37a69cc593438173df313c90b913dbd9534fbe43f1728e2c9a583c
|
data/README.md
CHANGED
@@ -134,11 +134,13 @@ For each translation, a seperate model and view is needed.
|
|
134
134
|
|
135
135
|
#### Model
|
136
136
|
|
137
|
-
|
137
|
+
A model should override the `locale` method:
|
138
138
|
|
139
139
|
```ruby
|
140
|
-
class TestModel < Alephant::Views::
|
141
|
-
|
140
|
+
class TestModel < Alephant::Views::HTML
|
141
|
+
def locale
|
142
|
+
:cy
|
143
|
+
end
|
142
144
|
end
|
143
145
|
```
|
144
146
|
|
@@ -178,20 +180,76 @@ en:
|
|
178
180
|
key: 'A translation!'
|
179
181
|
```
|
180
182
|
|
181
|
-
#####
|
183
|
+
##### Other options
|
182
184
|
|
183
|
-
|
185
|
+
The `t()` method takes a second hash argument for accessing other I18n features. Below are a few of the more common uses of this argument.
|
184
186
|
|
185
|
-
You can override this behaviour and provide
|
187
|
+
By default, if the translation key doesn't exist then the translation key is used as the translation. You can override this behaviour and provide an explicit default:
|
186
188
|
|
187
189
|
```ruby
|
188
190
|
def my_translation
|
189
|
-
t 'missing_key', :
|
191
|
+
t 'missing_key', default: 'Some default'
|
190
192
|
end
|
193
|
+
```
|
191
194
|
|
195
|
+
Plurality can also be handled, including support for languages with multiple pluralities. You would define your translation in the yaml file like this:
|
196
|
+
|
197
|
+
```yaml
|
198
|
+
en:
|
199
|
+
test_template:
|
200
|
+
pluralized_key:
|
201
|
+
one: 'Singular string'
|
202
|
+
other: 'Plural string'
|
203
|
+
```
|
204
|
+
and the code would look like:
|
205
|
+
```ruby
|
206
|
+
t 'pluralized_key', count: @num_of_things
|
192
207
|
```
|
193
208
|
|
194
|
-
|
209
|
+
You can force it to use a different locale if you need:
|
210
|
+
```ruby
|
211
|
+
t 'some_key', locale: :cy
|
212
|
+
```
|
213
|
+
|
214
|
+
You can use strings from another subsection of the translations. E.g. if your renderer was currently _myRenderer_ and your translations yaml looked like this:
|
215
|
+
```yaml
|
216
|
+
en:
|
217
|
+
myRenderer:
|
218
|
+
'some_key': 'some string'
|
219
|
+
general:
|
220
|
+
'another_key': 'another string'
|
221
|
+
```
|
222
|
+
You can do this in code:
|
223
|
+
```ruby
|
224
|
+
t 'another_key', scope: 'general'
|
225
|
+
```
|
226
|
+
|
227
|
+
You can do simple variable substitution, as often dynamic data can be in a different position in different strings. Your yaml might look like:
|
228
|
+
```yaml
|
229
|
+
en:
|
230
|
+
myRenderer:
|
231
|
+
'some_key': 'some %{insert} string'
|
232
|
+
```
|
233
|
+
and the code looks like:
|
234
|
+
```ruby
|
235
|
+
t 'some_key', insert: 'text inserted into a'
|
236
|
+
```
|
237
|
+
|
238
|
+
## Templates
|
239
|
+
|
240
|
+
The template engine is built into the Alephant::Views::HTML class. Create methods that correspond to variables, and they will become available to the template.
|
241
|
+
|
242
|
+
### Paths
|
243
|
+
|
244
|
+
There are two template paths in Alephant, the template path and the partials path. By default in HTML renderers, the template path is `../templates/` from your model, and the partials path is `../../lib/templates` from your model. You can change either of these pathing strategies by overridding the default renderer_engine instantiation.
|
245
|
+
|
246
|
+
```ruby
|
247
|
+
def renderer_engine
|
248
|
+
partial_path = File.join(base_path, 'templates/')
|
249
|
+
Alephant::Renderer::Engine::Mustache.new(base_path, template_name, partial_path)
|
250
|
+
end
|
251
|
+
```
|
252
|
+
In the above example, base_path is the parent of the current model folder, so this will make the partials path equal to the template path.
|
195
253
|
|
196
254
|
|
197
255
|
## Contributing
|
data/alephant-renderer.gemspec
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'mustache'
|
2
|
+
|
3
|
+
module Alephant
|
4
|
+
module Renderer
|
5
|
+
module Engine
|
6
|
+
class Mustache
|
7
|
+
def initialize(base_path, namespace, partials_path = nil)
|
8
|
+
@namespace = namespace
|
9
|
+
@base_path = base_path
|
10
|
+
@partial_path = partials_path || default_shared_partial_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(data)
|
14
|
+
mustache.template_path = @partial_path
|
15
|
+
mustache.render(template, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def default_shared_partial_path
|
19
|
+
File.join(@base_path, '../lib/templates')
|
20
|
+
end
|
21
|
+
|
22
|
+
def template_path
|
23
|
+
File.join(@base_path, 'templates')
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def template_file
|
29
|
+
File.join(template_path, "#{@namespace}.#{::Mustache.template_extension}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def template
|
33
|
+
@template_string ||= File.open(template_file).read
|
34
|
+
end
|
35
|
+
|
36
|
+
def mustache
|
37
|
+
::Mustache
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
|
3
|
+
module Alephant
|
4
|
+
module Renderer
|
5
|
+
module I18n
|
6
|
+
class LocaleComponentYaml
|
7
|
+
def initialize(locale, namespace, translations_path = nil)
|
8
|
+
@translations_path = translations_path
|
9
|
+
@locale = locale
|
10
|
+
@namespace = namespace
|
11
|
+
|
12
|
+
load_translations
|
13
|
+
end
|
14
|
+
|
15
|
+
def t(key, params = {})
|
16
|
+
i18n_lib.locale = @locale
|
17
|
+
params[:default] = key unless params[:default]
|
18
|
+
params[:scope] = @namespace unless params[:scope]
|
19
|
+
i18n_lib.translate(key, params)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def load_translations
|
25
|
+
return unless i18n_lib.available_locales.empty?
|
26
|
+
i18n_lib.backend.load_translations(translations_files)
|
27
|
+
end
|
28
|
+
|
29
|
+
def translations_files
|
30
|
+
Dir[translation_filename]
|
31
|
+
.flatten
|
32
|
+
.uniq
|
33
|
+
end
|
34
|
+
|
35
|
+
def translation_filename
|
36
|
+
File.join(
|
37
|
+
translations_path,
|
38
|
+
'*.yml')
|
39
|
+
end
|
40
|
+
|
41
|
+
def translations_path
|
42
|
+
@translations_path || './components/lib/locales'
|
43
|
+
end
|
44
|
+
|
45
|
+
def i18n_lib
|
46
|
+
i18n_lib = ::I18n
|
47
|
+
i18n_lib.enforce_available_locales = false
|
48
|
+
i18n_lib
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'alephant/renderer/views'
|
2
|
+
require 'hashie'
|
3
|
+
require 'pathname'
|
4
4
|
|
5
5
|
module Alephant
|
6
6
|
module Renderer
|
@@ -38,8 +38,8 @@ module Alephant
|
|
38
38
|
attr_accessor :base_path
|
39
39
|
|
40
40
|
def inherited(subclass)
|
41
|
-
current_dir = File.dirname(caller.first[
|
42
|
-
dir_path = Pathname.new(File.join(current_dir,
|
41
|
+
current_dir = File.dirname(caller.first[%r{/[^:]+}])
|
42
|
+
dir_path = Pathname.new(File.join(current_dir, '..')).realdirpath
|
43
43
|
|
44
44
|
subclass.base_path = dir_path.to_s
|
45
45
|
|
@@ -1,64 +1,57 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'alephant/renderer/views/base'
|
2
|
+
require 'alephant/renderer/engine/mustache'
|
3
|
+
require 'alephant/renderer/i18n/locale_component_yaml'
|
4
4
|
|
5
5
|
module Alephant
|
6
6
|
module Renderer
|
7
7
|
module Views
|
8
|
-
class Html
|
8
|
+
class Html
|
9
9
|
include ::Alephant::Renderer::Views::Base
|
10
10
|
|
11
|
+
class << self
|
12
|
+
# FIXME: remove this when we've gotten rid of all of the `self.template_path` directives
|
13
|
+
attr_accessor :template_path
|
14
|
+
end
|
15
|
+
|
11
16
|
def setup
|
12
|
-
@content_type =
|
13
|
-
|
17
|
+
@content_type = 'text/html'
|
18
|
+
@translator = translator
|
19
|
+
@renderer = renderer_engine
|
14
20
|
end
|
15
21
|
|
16
|
-
def
|
17
|
-
|
22
|
+
def render
|
23
|
+
@renderer.render self
|
18
24
|
end
|
19
25
|
|
20
26
|
private
|
21
27
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
+
def translator
|
29
|
+
Alephant::Renderer::I18n::LocaleComponentYaml.new(
|
30
|
+
locale,
|
31
|
+
template_name,
|
32
|
+
translations_path)
|
28
33
|
end
|
29
34
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"locale",
|
35
|
-
"*.yml")
|
36
|
-
]
|
37
|
-
.flatten
|
38
|
-
.uniq
|
35
|
+
def translations_path
|
36
|
+
File.join(
|
37
|
+
Pathname.new(base_path).parent,
|
38
|
+
'locale')
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
|
43
|
-
prefix = /\/([^\/]+)\.mustache/.match(template_file)[1]
|
44
|
-
params.merge! :default => key unless params[:default]
|
45
|
-
translation = I18n.translate("#{prefix}.#{key}", params)
|
41
|
+
def renderer_engine
|
42
|
+
Alephant::Renderer::Engine::Mustache.new(base_path, template_name)
|
46
43
|
end
|
47
44
|
|
48
|
-
def
|
49
|
-
@
|
45
|
+
def t(key, params = {})
|
46
|
+
@translator.t(key, params)
|
50
47
|
end
|
51
48
|
|
52
|
-
def
|
53
|
-
|
49
|
+
def locale
|
50
|
+
:en
|
54
51
|
end
|
55
52
|
|
56
|
-
def
|
57
|
-
|
58
|
-
base_path,
|
59
|
-
"templates",
|
60
|
-
"#{template_name}.#{template_extension}"
|
61
|
-
)
|
53
|
+
def template_name
|
54
|
+
Mustache.underscore(self.class.to_s).split('/').last
|
62
55
|
end
|
63
56
|
end
|
64
57
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Alephant::Renderer::Engine::Mustache do
|
4
|
+
let(:base_path) { File.join(File.dirname(__FILE__), 'fixtures') }
|
5
|
+
let(:namespace) { 'sample' }
|
6
|
+
|
7
|
+
subject { described_class.new(base_path, namespace) }
|
8
|
+
|
9
|
+
describe 'Renders a template' do
|
10
|
+
it 'should render some data to a template' do
|
11
|
+
data = {
|
12
|
+
item1: 'AAA',
|
13
|
+
item2: 'bbb'
|
14
|
+
}
|
15
|
+
expect(subject.render(data)).to eq('<span>AAA</span><span>bbb</span>')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{{module_type}} shared module template
|
@@ -0,0 +1 @@
|
|
1
|
+
{{module_type}} module template
|
data/spec/integration/fixtures/components/test-renderer/templates/legacy_shared_module.mustache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{{>legacy_shared_template}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{>legacy_shared_template}}
|
@@ -0,0 +1 @@
|
|
1
|
+
<span>{{item1}}</span><span>{{item2}}</span>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Alephant::Renderer::I18n::LocaleComponentYaml do
|
4
|
+
let(:template_path) { File.join(File.dirname(__FILE__), 'fixtures') }
|
5
|
+
let(:locale) { 'en' }
|
6
|
+
let(:namespace) { 'my_namespace' }
|
7
|
+
|
8
|
+
subject { described_class.new(locale, namespace, template_path) }
|
9
|
+
|
10
|
+
describe 'Performs a translation' do
|
11
|
+
it 'should return a translated string in 1 locale' do
|
12
|
+
expect(subject.t(:some_string)).to eq('some string')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'Overridding parameters' do
|
17
|
+
it 'should return a translation from a different locale/component' do
|
18
|
+
params = {
|
19
|
+
locale: 'cy',
|
20
|
+
scope: 'other_namespace',
|
21
|
+
count: 1
|
22
|
+
}
|
23
|
+
expect(subject.t(:some_string, params)).to eq('another string')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should return a pluralized translation with variable substitution' do
|
27
|
+
params = {
|
28
|
+
locale: 'cy',
|
29
|
+
scope: 'other_namespace',
|
30
|
+
count: 2
|
31
|
+
}
|
32
|
+
expect(subject.t(:some_string, params)).to eq('another 2 strings')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative 'fixtures/components/test-renderer/models/legacy_module'
|
3
|
+
require_relative 'fixtures/components/test-renderer/models/legacy_shared_module'
|
4
|
+
require_relative 'fixtures/components/test-renderer/models/translating_module'
|
5
|
+
|
6
|
+
describe Alephant::Renderer::Views::Html do
|
7
|
+
let(:data) { nil }
|
8
|
+
let(:test_renderer) { MyApp::LegacyModule }
|
9
|
+
|
10
|
+
subject { test_renderer.new(data) }
|
11
|
+
|
12
|
+
describe 'Interface tests (backwards compatibility)' do
|
13
|
+
it 'should accept self.template_path calls' do
|
14
|
+
expect(subject.class.template_path).to eq('/ignored/path/to/templates')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should render from a local template (with template_path set)' do
|
18
|
+
expect(subject.render).to eq('legacy module template')
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'Shared template test' do
|
22
|
+
let(:test_renderer) { MyApp::LegacySharedModule }
|
23
|
+
|
24
|
+
it 'should render a local template that points to a shared template (with template_path set)' do
|
25
|
+
expect(subject.render).to eq('legacy shared module template')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'Interface tests' do
|
31
|
+
describe 'Translation test' do
|
32
|
+
before(:all) do
|
33
|
+
::I18n.backend = I18n::Backend::Simple.new
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:test_renderer) { MyApp::TranslatingModule }
|
37
|
+
|
38
|
+
it 'should render a template with a translated string' do
|
39
|
+
expect(subject.render).to eq('modern shared module template')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,211 +1,225 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-renderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BBC News
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
14
20
|
requirement: !ruby/object:Gem::Requirement
|
15
21
|
requirements:
|
16
22
|
- - '>='
|
17
23
|
- !ruby/object:Gem::Version
|
18
24
|
version: '0'
|
19
|
-
name: rspec
|
20
25
|
prerelease: false
|
21
26
|
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-nc
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
31
|
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
30
36
|
- - '>='
|
31
37
|
- !ruby/object:Gem::Version
|
32
38
|
version: '0'
|
33
|
-
name: rspec-nc
|
34
39
|
prerelease: false
|
35
40
|
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
45
|
- - '>='
|
39
46
|
- !ruby/object:Gem::Version
|
40
47
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
43
49
|
requirements:
|
44
50
|
- - '>='
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: '0'
|
47
|
-
name: guard
|
48
53
|
prerelease: false
|
49
54
|
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
59
|
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
62
|
requirement: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
64
|
- - '>='
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: '0'
|
61
|
-
name: guard-rspec
|
62
67
|
prerelease: false
|
63
68
|
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
64
71
|
version_requirements: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
73
|
- - '>='
|
67
74
|
- !ruby/object:Gem::Version
|
68
75
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
76
|
requirement: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
78
|
- - '>='
|
73
79
|
- !ruby/object:Gem::Version
|
74
80
|
version: '0'
|
75
|
-
name: pry
|
76
81
|
prerelease: false
|
77
82
|
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-remote
|
78
85
|
version_requirements: !ruby/object:Gem::Requirement
|
79
86
|
requirements:
|
80
87
|
- - '>='
|
81
88
|
- !ruby/object:Gem::Version
|
82
89
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
90
|
requirement: !ruby/object:Gem::Requirement
|
85
91
|
requirements:
|
86
92
|
- - '>='
|
87
93
|
- !ruby/object:Gem::Version
|
88
94
|
version: '0'
|
89
|
-
name: pry-remote
|
90
95
|
prerelease: false
|
91
96
|
type: :development
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-nav
|
92
99
|
version_requirements: !ruby/object:Gem::Requirement
|
93
100
|
requirements:
|
94
101
|
- - '>='
|
95
102
|
- !ruby/object:Gem::Version
|
96
103
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
104
|
requirement: !ruby/object:Gem::Requirement
|
99
105
|
requirements:
|
100
106
|
- - '>='
|
101
107
|
- !ruby/object:Gem::Version
|
102
108
|
version: '0'
|
103
|
-
name: pry-nav
|
104
109
|
prerelease: false
|
105
110
|
type: :development
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
106
113
|
version_requirements: !ruby/object:Gem::Requirement
|
107
114
|
requirements:
|
108
|
-
- -
|
115
|
+
- - ~>
|
109
116
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
- !ruby/object:Gem::Dependency
|
117
|
+
version: '1.5'
|
112
118
|
requirement: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
120
|
- - ~>
|
115
121
|
- !ruby/object:Gem::Version
|
116
122
|
version: '1.5'
|
117
|
-
name: bundler
|
118
123
|
prerelease: false
|
119
124
|
type: :development
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
120
127
|
version_requirements: !ruby/object:Gem::Requirement
|
121
128
|
requirements:
|
122
|
-
- -
|
129
|
+
- - '>='
|
123
130
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
-
- !ruby/object:Gem::Dependency
|
131
|
+
version: '0'
|
126
132
|
requirement: !ruby/object:Gem::Requirement
|
127
133
|
requirements:
|
128
134
|
- - '>='
|
129
135
|
- !ruby/object:Gem::Version
|
130
136
|
version: '0'
|
131
|
-
name: rake
|
132
137
|
prerelease: false
|
133
138
|
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake-rspec
|
134
141
|
version_requirements: !ruby/object:Gem::Requirement
|
135
142
|
requirements:
|
136
143
|
- - '>='
|
137
144
|
- !ruby/object:Gem::Version
|
138
145
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
146
|
requirement: !ruby/object:Gem::Requirement
|
141
147
|
requirements:
|
142
148
|
- - '>='
|
143
149
|
- !ruby/object:Gem::Version
|
144
150
|
version: '0'
|
145
|
-
name: rake-rspec
|
146
151
|
prerelease: false
|
147
152
|
type: :development
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: i18n
|
148
155
|
version_requirements: !ruby/object:Gem::Requirement
|
149
156
|
requirements:
|
150
157
|
- - '>='
|
151
158
|
- !ruby/object:Gem::Version
|
152
159
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
160
|
requirement: !ruby/object:Gem::Requirement
|
155
161
|
requirements:
|
156
162
|
- - '>='
|
157
163
|
- !ruby/object:Gem::Version
|
158
164
|
version: '0'
|
159
|
-
name: i18n
|
160
165
|
prerelease: false
|
161
166
|
type: :runtime
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: mustache
|
162
169
|
version_requirements: !ruby/object:Gem::Requirement
|
163
170
|
requirements:
|
164
|
-
- -
|
171
|
+
- - ~>
|
165
172
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
167
|
-
- !ruby/object:Gem::Dependency
|
173
|
+
version: 0.99.5
|
168
174
|
requirement: !ruby/object:Gem::Requirement
|
169
175
|
requirements:
|
170
176
|
- - ~>
|
171
177
|
- !ruby/object:Gem::Version
|
172
178
|
version: 0.99.5
|
173
|
-
name: mustache
|
174
179
|
prerelease: false
|
175
180
|
type: :runtime
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: alephant-logger
|
176
183
|
version_requirements: !ruby/object:Gem::Requirement
|
177
184
|
requirements:
|
178
|
-
- -
|
185
|
+
- - '>='
|
179
186
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0
|
181
|
-
- !ruby/object:Gem::Dependency
|
187
|
+
version: '0'
|
182
188
|
requirement: !ruby/object:Gem::Requirement
|
183
189
|
requirements:
|
184
190
|
- - '>='
|
185
191
|
- !ruby/object:Gem::Version
|
186
192
|
version: '0'
|
187
|
-
name: alephant-logger
|
188
193
|
prerelease: false
|
189
194
|
type: :runtime
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: hashie
|
190
197
|
version_requirements: !ruby/object:Gem::Requirement
|
191
198
|
requirements:
|
192
199
|
- - '>='
|
193
200
|
- !ruby/object:Gem::Version
|
194
201
|
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
202
|
requirement: !ruby/object:Gem::Requirement
|
197
203
|
requirements:
|
198
204
|
- - '>='
|
199
205
|
- !ruby/object:Gem::Version
|
200
206
|
version: '0'
|
201
|
-
name: hashie
|
202
207
|
prerelease: false
|
203
208
|
type: :runtime
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: listen
|
204
211
|
version_requirements: !ruby/object:Gem::Requirement
|
205
212
|
requirements:
|
206
|
-
- -
|
213
|
+
- - ~>
|
207
214
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
215
|
+
version: 3.0.0
|
216
|
+
requirement: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ~>
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: 3.0.0
|
221
|
+
prerelease: false
|
222
|
+
type: :runtime
|
209
223
|
description:
|
210
224
|
email:
|
211
225
|
- FutureMediaNewsRubyGems@bbc.co.uk
|
@@ -223,7 +237,9 @@ files:
|
|
223
237
|
- Rakefile
|
224
238
|
- alephant-renderer.gemspec
|
225
239
|
- lib/alephant/renderer.rb
|
240
|
+
- lib/alephant/renderer/engine/mustache.rb
|
226
241
|
- lib/alephant/renderer/error/invalid_path.rb
|
242
|
+
- lib/alephant/renderer/i18n/locale_component_yaml.rb
|
227
243
|
- lib/alephant/renderer/response.rb
|
228
244
|
- lib/alephant/renderer/version.rb
|
229
245
|
- lib/alephant/renderer/view_mapper.rb
|
@@ -234,13 +250,25 @@ files:
|
|
234
250
|
- spec/fixtures/components/foo-renderer/models/BAR_ABC.rb
|
235
251
|
- spec/fixtures/components/foo-renderer/models/foo_xyz.rb
|
236
252
|
- spec/fixtures/components/foo-renderer/models/json.rb
|
253
|
+
- spec/integration/engine_mustache_spec.rb
|
254
|
+
- spec/integration/fixtures/components/lib/templates/legacy_shared_template.mustache
|
255
|
+
- spec/integration/fixtures/components/locale/translations.yml
|
256
|
+
- spec/integration/fixtures/components/test-renderer/models/legacy_module.rb
|
257
|
+
- spec/integration/fixtures/components/test-renderer/models/legacy_shared_module.rb
|
258
|
+
- spec/integration/fixtures/components/test-renderer/models/translating_module.rb
|
259
|
+
- spec/integration/fixtures/components/test-renderer/templates/legacy_module.mustache
|
260
|
+
- spec/integration/fixtures/components/test-renderer/templates/legacy_shared_module.mustache
|
261
|
+
- spec/integration/fixtures/components/test-renderer/templates/translating_module.mustache
|
262
|
+
- spec/integration/fixtures/templates/sample.mustache
|
263
|
+
- spec/integration/fixtures/translations.yml
|
264
|
+
- spec/integration/i18n_locale_component_yaml_spec.rb
|
237
265
|
- spec/integration/spec_helper.rb
|
266
|
+
- spec/integration/views_html_spec.rb
|
238
267
|
- spec/renderer_spec.rb
|
239
268
|
- spec/response_spec.rb
|
240
269
|
- spec/spec_helper.rb
|
241
270
|
- spec/view_mapper_spec.rb
|
242
271
|
- spec/views_json_spec.rb
|
243
|
-
- trans.yml
|
244
272
|
homepage: ''
|
245
273
|
licenses:
|
246
274
|
- MIT
|
@@ -269,7 +297,20 @@ test_files:
|
|
269
297
|
- spec/fixtures/components/foo-renderer/models/BAR_ABC.rb
|
270
298
|
- spec/fixtures/components/foo-renderer/models/foo_xyz.rb
|
271
299
|
- spec/fixtures/components/foo-renderer/models/json.rb
|
300
|
+
- spec/integration/engine_mustache_spec.rb
|
301
|
+
- spec/integration/fixtures/components/lib/templates/legacy_shared_template.mustache
|
302
|
+
- spec/integration/fixtures/components/locale/translations.yml
|
303
|
+
- spec/integration/fixtures/components/test-renderer/models/legacy_module.rb
|
304
|
+
- spec/integration/fixtures/components/test-renderer/models/legacy_shared_module.rb
|
305
|
+
- spec/integration/fixtures/components/test-renderer/models/translating_module.rb
|
306
|
+
- spec/integration/fixtures/components/test-renderer/templates/legacy_module.mustache
|
307
|
+
- spec/integration/fixtures/components/test-renderer/templates/legacy_shared_module.mustache
|
308
|
+
- spec/integration/fixtures/components/test-renderer/templates/translating_module.mustache
|
309
|
+
- spec/integration/fixtures/templates/sample.mustache
|
310
|
+
- spec/integration/fixtures/translations.yml
|
311
|
+
- spec/integration/i18n_locale_component_yaml_spec.rb
|
272
312
|
- spec/integration/spec_helper.rb
|
313
|
+
- spec/integration/views_html_spec.rb
|
273
314
|
- spec/renderer_spec.rb
|
274
315
|
- spec/response_spec.rb
|
275
316
|
- spec/spec_helper.rb
|
data/trans.yml
DELETED