sanford-nm 0.4.4 → 0.4.5

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
- SHA512:
3
- metadata.gz: 4538cb3737eb14abb624f073411372dc75e97200eb1bd4966bf248923ea39676afbb85b054377521b38803cbee45d25bd72f50ef490f975719b624f98796fbd9
4
- data.tar.gz: 56699ba02420925b6424f83efa940fff51eaf50113ec037cb305394481a2584d4f07cba272c95aae618d9d286692ade00df5c6432f780d6f9641cf95427c4f3d
5
2
  SHA1:
6
- metadata.gz: c05831ad8888f746f2997401b7b260dcc642ef48
7
- data.tar.gz: 4f21829d6c180b99d4f32a18d3755924a684e456
3
+ data.tar.gz: bb0f54e117216f9dacfcb5cfdb5a63d7d9c59fdc
4
+ metadata.gz: d54d833d58d64941c97ca4bb697ed083e8f11dc6
5
+ SHA512:
6
+ data.tar.gz: 385d8bbf4bb6515d62a3b09e250b9ff55376727bbfd4d5352fc13d4e7b06cb48b465477f9f8041eaf8026dbdaa15acfa9ab5e00f165f9958d61c77566fc67488
7
+ metadata.gz: f5d55ffae7998fa11ccda8761268be95d4ee22e617d430c781e15d03c3fed9c1360511e35d17818e36a51344b5d2e191991c5e091166fdde0acb22856d1485ea
@@ -29,6 +29,10 @@ module Sanford::Nm
29
29
  self.nm_source.render(path, render_locals(service_handler, locals))
30
30
  end
31
31
 
32
+ def partial(path, locals)
33
+ self.nm_source.partial(path, locals)
34
+ end
35
+
32
36
  private
33
37
 
34
38
  def render_locals(service_handler, locals)
@@ -1,4 +1,4 @@
1
1
  module Sanford; end
2
2
  module Sanford::Nm
3
- VERSION = "0.4.4"
3
+ VERSION = "0.4.5"
4
4
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_development_dependency("assert", ["~> 2.16.3"])
22
22
 
23
- gem.add_dependency("sanford", ["~> 0.19.0"])
24
- gem.add_dependency("nm", ["~> 0.5.3"])
23
+ gem.add_dependency("sanford", ["~> 0.19.1"])
24
+ gem.add_dependency("nm", ["~> 0.5.4"])
25
25
 
26
26
  end
@@ -3,10 +3,18 @@ require 'assert/factory'
3
3
  module Factory
4
4
  extend Assert::Factory
5
5
 
6
- def self.template_json_rendered(engine, service_handler, locals)
6
+ def self.render_template_json_rendered(engine, service_handler, locals)
7
+ { 'thing' => {
8
+ 'id' => service_handler.identifier,
9
+ 'name' => service_handler.name,
10
+ 'local1' => locals['local1'],
11
+ 'logger' => engine.logger.to_s
12
+ }
13
+ }
14
+ end
15
+
16
+ def self.partial_template_json_rendered(engine, locals)
7
17
  { 'thing' => {
8
- 'id' => service_handler.identifier,
9
- 'name' => service_handler.name,
10
18
  'local1' => locals['local1'],
11
19
  'logger' => engine.logger.to_s
12
20
  }
@@ -0,0 +1,4 @@
1
+ node 'thing' do
2
+ node 'local1', local1
3
+ node 'logger', logger.to_s
4
+ end
@@ -0,0 +1,6 @@
1
+ node 'thing' do
2
+ node 'id', view.identifier
3
+ node 'name', view.name
4
+ node 'local1', local1
5
+ node 'logger', logger.to_s
6
+ end
@@ -17,7 +17,7 @@ class Sanford::Nm::TemplateEngine
17
17
  subject{ @engine }
18
18
 
19
19
  should have_imeths :nm_source, :nm_handler_local, :nm_logger_local
20
- should have_imeths :render
20
+ should have_imeths :render, :partial
21
21
 
22
22
  should "be a Sanford template engine" do
23
23
  assert_kind_of Sanford::TemplateEngine, subject
@@ -66,8 +66,14 @@ class Sanford::Nm::TemplateEngine
66
66
  :name => Factory.string
67
67
  })
68
68
  locals = { 'local1' => Factory.string }
69
- exp = Factory.template_json_rendered(subject, service_handler, locals)
70
- assert_equal exp, subject.render('template.json', service_handler, locals)
69
+ exp = Factory.render_template_json_rendered(subject, service_handler, locals)
70
+ assert_equal exp, subject.render('render_template.json', service_handler, locals)
71
+ end
72
+
73
+ should "render nm partial template files" do
74
+ locals = { 'local1' => Factory.string }
75
+ exp = Factory.partial_template_json_rendered(subject, locals)
76
+ assert_equal exp, subject.partial('partial_template.json', locals)
71
77
  end
72
78
 
73
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanford-nm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2016-09-15 00:00:00 Z
13
+ date: 2017-08-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 0.19.0
32
+ version: 0.19.1
33
33
  type: :runtime
34
34
  version_requirements: *id002
35
35
  - !ruby/object:Gem::Dependency
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: 0.5.3
42
+ version: 0.5.4
43
43
  type: :runtime
44
44
  version_requirements: *id003
45
45
  description: Sanford template engine for Nm templates
@@ -63,8 +63,9 @@ files:
63
63
  - sanford-nm.gemspec
64
64
  - test/helper.rb
65
65
  - test/support/factory.rb
66
- - test/support/template.json.aaa
67
- - test/support/template.json.nm
66
+ - test/support/partial_template.json.nm
67
+ - test/support/render_template.json.aaa
68
+ - test/support/render_template.json.nm
68
69
  - test/unit/template_engine_tests.rb
69
70
  - tmp/.gitkeep
70
71
  homepage: http://github.com/redding/sanford-nm
@@ -89,13 +90,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements: []
90
91
 
91
92
  rubyforge_project:
92
- rubygems_version: 2.6.4
93
+ rubygems_version: 2.6.6
93
94
  signing_key:
94
95
  specification_version: 4
95
96
  summary: Sanford template engine for Nm templates
96
97
  test_files:
97
98
  - test/helper.rb
98
99
  - test/support/factory.rb
99
- - test/support/template.json.aaa
100
- - test/support/template.json.nm
100
+ - test/support/partial_template.json.nm
101
+ - test/support/render_template.json.aaa
102
+ - test/support/render_template.json.nm
101
103
  - test/unit/template_engine_tests.rb
@@ -1,6 +0,0 @@
1
- node('thing') {
2
- node('id', view.identifier)
3
- node('name', view.name)
4
- node('local1', local1)
5
- node('logger', logger.to_s)
6
- }