sanford-nm 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -31,6 +31,14 @@ Nm doesn't allow overriding the template scope but instead allows you to pass in
31
31
  end
32
32
  ```
33
33
 
34
+ Nm doesn't cache templates by default. To enable caching, pass a `'cache'` option when registering:
35
+
36
+ ```ruby
37
+ c.template_source "/path/to/templates" do |s|
38
+ s.engine 'nm', Sanford::Nm::TemplateEngine, 'cache' => true
39
+ end
40
+ ```
41
+
34
42
  ## Installation
35
43
 
36
44
  Add this line to your application's Gemfile:
@@ -1,4 +1,4 @@
1
1
  module Sanford; end
2
2
  module Sanford::Nm
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
data/lib/sanford-nm.rb CHANGED
@@ -11,7 +11,8 @@ module Sanford::Nm
11
11
 
12
12
  def nm_source
13
13
  @nm_source ||= Nm::Source.new(self.source_path, {
14
- self.nm_logger_local => self.logger
14
+ :cache => self.opts['cache'],
15
+ :locals => { self.nm_logger_local => self.logger }
15
16
  })
16
17
  end
17
18
 
data/sanford-nm.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_development_dependency("assert", ["~> 2.12"])
22
22
 
23
- gem.add_dependency("sanford", ["~> 0.12"])
24
- gem.add_dependency("nm", ["~> 0.4"])
23
+ gem.add_dependency("sanford", ["~> 0.13"])
24
+ gem.add_dependency("nm", ["~> 0.5"])
25
25
 
26
26
  end
@@ -38,6 +38,11 @@ class Sanford::Nm::TemplateEngine
38
38
  assert_equal handler_local, engine.nm_handler_local
39
39
  end
40
40
 
41
+ should "pass any given cache option to the Nm source" do
42
+ engine = Sanford::Nm::TemplateEngine.new('cache' => true)
43
+ assert_kind_of Hash, engine.nm_source.cache
44
+ end
45
+
41
46
  should "use 'logger' as the logger local name by default" do
42
47
  assert_equal 'logger', subject.nm_logger_local
43
48
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanford-nm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2014-12-08 00:00:00 Z
19
+ date: 2015-02-04 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -39,11 +39,11 @@ dependencies:
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- hash: 19
42
+ hash: 17
43
43
  segments:
44
44
  - 0
45
- - 12
46
- version: "0.12"
45
+ - 13
46
+ version: "0.13"
47
47
  type: :runtime
48
48
  name: sanford
49
49
  version_requirements: *id002
@@ -54,11 +54,11 @@ dependencies:
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- hash: 3
57
+ hash: 1
58
58
  segments:
59
59
  - 0
60
- - 4
61
- version: "0.4"
60
+ - 5
61
+ version: "0.5"
62
62
  type: :runtime
63
63
  name: nm
64
64
  version_requirements: *id003