stache 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -12,6 +12,8 @@ rdoc
12
12
  doc
13
13
  .yardoc
14
14
 
15
+ spec/dummy/log/
16
+
15
17
  # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
16
18
  #
17
19
  # * Create a file at ~/.gitignore
data/README.md CHANGED
@@ -9,7 +9,7 @@ A Rails 3.x (yes, even Rails *3.1*) compatible Mustache Template Handler, with s
9
9
  Install the gem. If you want to override any of the configuration options (see `stache/config`), toss an initializer in `config/initializers` and:
10
10
 
11
11
  ```ruby
12
- Stache.config do |c|
12
+ Stache.configure do |c|
13
13
  c.template_base_path = "..." # this is probably the one you'll want to change
14
14
  # it defaults to app/templates
15
15
  end
@@ -50,6 +50,10 @@ This project builds on work done by the following people and projects:
50
50
 
51
51
  So: thanks a ton to those guys.
52
52
 
53
+ ## Contributors
54
+
55
+ * [afeld](https://github.com/afeld) provided 1.8.7 compatibility fixes.
56
+
53
57
  ## Note on Patches/Pull Requests
54
58
 
55
59
  * Fork the project.
@@ -7,7 +7,7 @@ module Stache
7
7
  exploded = source.split("/")
8
8
  file = exploded.pop
9
9
  file = file.split(".").first
10
- template_path = ::Rails.root.join('app/views', *exploded, "_#{file}.html.mustache")
10
+ template_path = Stache.template_base_path.join(exploded.join("/"), "_#{file}.html.mustache")
11
11
  template = ::File.open(template_path, "rb")
12
12
  content_tag(:script, template.read.html_safe, :type => "text/html", :id => "#{file.dasherize.underscore}_template")
13
13
  end.join("\n").html_safe
data/lib/stache/config.rb CHANGED
@@ -19,6 +19,10 @@ module Stache
19
19
  def template_base_path
20
20
  @template_base_path ||= ::Rails.root.join('app', 'templates')
21
21
  end
22
+
23
+ def template_base_path= path
24
+ @template_base_path = Pathname.new(path)
25
+ end
22
26
 
23
27
  def template_extension
24
28
  @template_extension ||= 'html.mustache'
@@ -1,3 +1,3 @@
1
1
  module Stache
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/stache/view.rb CHANGED
@@ -1,9 +1,11 @@
1
+ require 'mustache'
2
+
1
3
  module Stache
2
4
  #
3
5
  # A Convienent Base Class for the views. Subclass this for autoloading magic with your templates.
4
6
  #
5
7
  # e.g. if the handler is loading a template from templates/
6
- class View < Mustache
8
+ class View < ::Mustache
7
9
  attr_accessor :view, :template
8
10
 
9
11
  def method_missing(method, *args, &block)
@@ -17,5 +17,14 @@ describe Stache::AssetHelper do
17
17
 
18
18
  helper.template_include_tag("widgets/oh_herro").should == "<script id=\"oh_herro_template\" type=\"text/html\">{{ awyeah }}</script>"
19
19
  end
20
+ it "uses the template_base_path config setting to locate the template" do
21
+ Stache.configure do |c|
22
+ c.template_base_path = "/tmp/whee"
23
+ end
24
+ File.stub!(:open).with(Pathname.new("/tmp/whee/_whooo.html.mustache"), "rb").
25
+ and_return(StringIO.new("{{ awyeah }}"))
26
+
27
+ helper.template_include_tag("whooo").should == "<script id=\"whooo_template\" type=\"text/html\">{{ awyeah }}</script>"
28
+ end
20
29
  end
21
30
  end
@@ -29,7 +29,7 @@ describe "Stache::Config" do
29
29
  Stache.configure do |config|
30
30
  config.template_base_path = "/dev/null"
31
31
  end
32
- Stache.template_base_path.should == "/dev/null"
32
+ Stache.template_base_path.should == Pathname.new("/dev/null")
33
33
  end
34
34
  end
35
35
 
@@ -7,7 +7,7 @@ describe Stache::Handler do
7
7
  # end
8
8
  before do
9
9
  @template = ActionView::Template.new("{{body}}", "hello mustache", Stache::Handler, { :virtual_path => "hello_world"})
10
- @handler = Stache::Handler.new(@template)
10
+ @handler = Stache::Handler.new
11
11
  end
12
12
 
13
13
  describe "#mustache_class_from_template" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: stache
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Wilson
@@ -150,10 +150,6 @@ files:
150
150
  - spec/dummy/config/initializers/stache.rb
151
151
  - spec/dummy/config/locales/en.yml
152
152
  - spec/dummy/config/routes.rb
153
- - spec/dummy/log/development.log
154
- - spec/dummy/log/production.log
155
- - spec/dummy/log/server.log
156
- - spec/dummy/log/test.log
157
153
  - spec/dummy/public/404.html
158
154
  - spec/dummy/public/422.html
159
155
  - spec/dummy/public/500.html
@@ -197,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
193
  requirements: []
198
194
 
199
195
  rubyforge_project:
200
- rubygems_version: 1.8.5
196
+ rubygems_version: 1.8.10
201
197
  signing_key:
202
198
  specification_version: 3
203
199
  summary: Configurable Mustache Handler and Helpers for Rails
@@ -227,10 +223,6 @@ test_files:
227
223
  - spec/dummy/config/initializers/stache.rb
228
224
  - spec/dummy/config/locales/en.yml
229
225
  - spec/dummy/config/routes.rb
230
- - spec/dummy/log/development.log
231
- - spec/dummy/log/production.log
232
- - spec/dummy/log/server.log
233
- - spec/dummy/log/test.log
234
226
  - spec/dummy/public/404.html
235
227
  - spec/dummy/public/422.html
236
228
  - spec/dummy/public/500.html
@@ -1,3 +0,0 @@
1
- DEPRECATION WARNING: config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates . (called from <top (required)> at /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/controllers/application_controller.rb:1)
2
- DEPRECATION WARNING: config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates . (called from <top (required)> at /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/controllers/application_controller.rb:1)
3
- DEPRECATION WARNING: config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates . (called from <top (required)> at /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/controllers/application_controller.rb:1)
File without changes
File without changes
@@ -1,223 +0,0 @@
1
- Processing by StacheController#index as HTML
2
- Completed 500 Internal Server Error in 15ms
3
- Processing by StacheController#index as HTML
4
- Completed 500 Internal Server Error in 15ms
5
- Processing by StacheController#index as HTML
6
- Completed 500 Internal Server Error in 17ms
7
- Processing by StacheController#index as HTML
8
- Completed 500 Internal Server Error in 13ms
9
- Processing by StacheController#index as HTML
10
- Completed 500 Internal Server Error in 14ms
11
- Processing by StacheController#index as HTML
12
- Completed 500 Internal Server Error in 15ms
13
- Processing by StacheController#index as HTML
14
- Completed 500 Internal Server Error in 16ms
15
- Processing by StacheController#index as HTML
16
- Completed 500 Internal Server Error in 14ms
17
- Processing by StacheController#index as HTML
18
- Completed 500 Internal Server Error in 14ms
19
- Processing by StacheController#index as HTML
20
- Completed 500 Internal Server Error in 14ms
21
- Processing by StacheController#index as HTML
22
- Completed 500 Internal Server Error in 15ms
23
- Processing by StacheController#index as HTML
24
- Completed 500 Internal Server Error in 18ms
25
- Processing by StacheController#index as HTML
26
- Completed 500 Internal Server Error in 14ms
27
- Processing by StacheController#index as HTML
28
- Completed 500 Internal Server Error in 39ms
29
- Processing by StacheController#index as HTML
30
- Completed 500 Internal Server Error in 36ms
31
- Processing by StacheController#index as HTML
32
- Completed 500 Internal Server Error in 39ms
33
- Processing by StacheController#index as HTML
34
- Completed 500 Internal Server Error in 41ms
35
- Processing by StacheController#index as HTML
36
- Completed 500 Internal Server Error in 37ms
37
- Processing by StacheController#index as HTML
38
- Completed 500 Internal Server Error in 43ms
39
- Processing by StacheController#index as HTML
40
- Completed 500 Internal Server Error in 35ms
41
- Processing by StacheController#index as HTML
42
- Completed 500 Internal Server Error in 36ms
43
- Processing by StacheController#index as HTML
44
- Completed 500 Internal Server Error in 40ms
45
- Processing by StacheController#index as HTML
46
- Completed 500 Internal Server Error in 39ms
47
- Processing by StacheController#index as HTML
48
- Completed 500 Internal Server Error in 38ms
49
- Processing by StacheController#index as HTML
50
- Completed 500 Internal Server Error in 37ms
51
- Processing by StacheController#index as HTML
52
- Completed 500 Internal Server Error in 38ms
53
- Processing by StacheController#index as HTML
54
- Completed 500 Internal Server Error in 37ms
55
- Processing by StacheController#index as HTML
56
- Completed 500 Internal Server Error in 41ms
57
- Processing by StacheController#index as HTML
58
- Completed 500 Internal Server Error in 37ms
59
- Processing by StacheController#index as HTML
60
- Completed 500 Internal Server Error in 38ms
61
- Processing by StacheController#index as HTML
62
- Completed 500 Internal Server Error in 38ms
63
- Processing by StacheController#index as HTML
64
- Completed 500 Internal Server Error in 38ms
65
- Processing by StacheController#index as HTML
66
- Completed 500 Internal Server Error in 37ms
67
- Processing by StacheController#index as HTML
68
- Completed 500 Internal Server Error in 40ms
69
- Processing by StacheController#index as HTML
70
- Completed 500 Internal Server Error in 37ms
71
- Processing by StacheController#index as HTML
72
- Completed 500 Internal Server Error in 38ms
73
- Processing by StacheController#index as HTML
74
- Completed 500 Internal Server Error in 36ms
75
- Processing by StacheController#index as HTML
76
- Rendered stache/index.html.mustache within layouts/application (10.2ms)
77
- Completed 200 OK in 40ms (Views: 40.1ms)
78
- Processing by StacheController#index as HTML
79
- Rendered stache/index.html.mustache within layouts/application (8.8ms)
80
- Completed 200 OK in 42ms (Views: 41.7ms)
81
- Processing by StacheController#index as HTML
82
- Rendered stache/index.html.mustache within layouts/application (9.3ms)
83
- Completed 200 OK in 43ms (Views: 42.5ms)
84
- Processing by StacheController#index as HTML
85
- Rendered stache/index.html.mustache within layouts/application (10.0ms)
86
- Completed 200 OK in 41ms (Views: 40.3ms)
87
- Processing by StacheController#index as HTML
88
- Rendered stache/index.html.mustache within layouts/application (9.9ms)
89
- Completed 200 OK in 45ms (Views: 45.1ms)
90
- Processing by StacheController#index as HTML
91
- Rendered stache/index.html.mustache within layouts/application (13.3ms)
92
- Completed 200 OK in 50ms (Views: 49.9ms)
93
- Processing by StacheController#index as HTML
94
- Rendered stache/index.html.mustache within layouts/application (9.2ms)
95
- Completed 200 OK in 41ms (Views: 41.1ms)
96
- Processing by StacheController#index as HTML
97
- Rendered stache/index.html.mustache within layouts/application (9.4ms)
98
- Completed 200 OK in 44ms (Views: 43.5ms)
99
- Processing by StacheController#index as HTML
100
- Rendered stache/index.html.mustache within layouts/application (8.5ms)
101
- Completed 200 OK in 45ms (Views: 44.5ms)
102
- Processing by StacheController#index as HTML
103
- Rendered stache/index.html.mustache within layouts/application (10.0ms)
104
- Completed 200 OK in 42ms (Views: 41.6ms)
105
- Processing by StacheController#with_partials as HTML
106
- Completed 500 Internal Server Error in 22ms
107
- Processing by StacheController#index as HTML
108
- Rendered stache/index.html.mustache within layouts/application (9.7ms)
109
- Completed 200 OK in 41ms (Views: 40.8ms)
110
- Processing by StacheController#with_partials as HTML
111
- Completed 500 Internal Server Error in 22ms
112
- Processing by StacheController#index as HTML
113
- Rendered stache/index.html.mustache within layouts/application (9.6ms)
114
- Completed 200 OK in 43ms (Views: 42.3ms)
115
- Processing by StacheController#with_partials as HTML
116
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
117
- Completed 500 Internal Server Error in 24ms
118
- Processing by StacheController#index as HTML
119
- Rendered stache/index.html.mustache within layouts/application (9.6ms)
120
- Completed 200 OK in 44ms (Views: 43.6ms)
121
- Processing by StacheController#with_partials as HTML
122
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
123
- Completed 500 Internal Server Error in 28ms
124
- Processing by StacheController#index as HTML
125
- Rendered stache/index.html.mustache within layouts/application (8.7ms)
126
- Completed 200 OK in 42ms (Views: 41.4ms)
127
- Processing by StacheController#with_partials as HTML
128
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
129
- Completed 500 Internal Server Error in 22ms
130
- Processing by StacheController#index as HTML
131
- Rendered stache/index.html.mustache within layouts/application (9.3ms)
132
- Completed 200 OK in 42ms (Views: 41.7ms)
133
- Processing by StacheController#with_partials as HTML
134
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
135
- Completed 500 Internal Server Error in 24ms
136
- Processing by StacheController#index as HTML
137
- Rendered stache/index.html.mustache within layouts/application (10.6ms)
138
- Completed 200 OK in 45ms (Views: 44.8ms)
139
- Processing by StacheController#with_partials as HTML
140
- Completed 500 Internal Server Error in 25ms
141
- Processing by StacheController#index as HTML
142
- Rendered stache/index.html.mustache within layouts/application (15.0ms)
143
- Completed 200 OK in 53ms (Views: 52.1ms)
144
- Processing by StacheController#with_partials as HTML
145
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
146
- Completed 500 Internal Server Error in 26ms
147
- Processing by StacheController#index as HTML
148
- Rendered stache/index.html.mustache within layouts/application (9.4ms)
149
- Completed 200 OK in 44ms (Views: 44.0ms)
150
- Processing by StacheController#with_partials as HTML
151
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
152
- Completed 500 Internal Server Error in 23ms
153
- Processing by StacheController#index as HTML
154
- Rendered stache/index.html.mustache within layouts/application (8.6ms)
155
- Completed 200 OK in 41ms (Views: 40.7ms)
156
- Processing by StacheController#with_partials as HTML
157
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
158
- Completed 500 Internal Server Error in 24ms
159
- Processing by StacheController#index as HTML
160
- Rendered stache/index.html.mustache within layouts/application (9.6ms)
161
- Completed 200 OK in 42ms (Views: 41.3ms)
162
- Processing by StacheController#with_partials as HTML
163
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/templates/shared/_eaten_by_a.html.mustache
164
- Completed 500 Internal Server Error in 23ms
165
- Processing by StacheController#index as HTML
166
- Rendered stache/index.html.mustache within layouts/application (8.3ms)
167
- Completed 200 OK in 39ms (Views: 38.5ms)
168
- Processing by StacheController#with_partials as HTML
169
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/views/stache/_eaten_by_a.html.mustache
170
- Completed 200 OK in 13ms (Views: 12.4ms)
171
- Processing by StacheController#index as HTML
172
- Rendered stache/index.html.mustache within layouts/application (9.8ms)
173
- Completed 200 OK in 42ms (Views: 41.2ms)
174
- Processing by StacheController#with_partials as HTML
175
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/views/stache/_eaten_by_a.html.mustache
176
- Completed 200 OK in 14ms (Views: 13.8ms)
177
- Processing by StacheController#index as HTML
178
- Rendered stache/index.html.mustache within layouts/application (10.2ms)
179
- Completed 200 OK in 40ms (Views: 40.0ms)
180
- Processing by StacheController#with_partials as HTML
181
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/views/stache/_eaten_by_a.html.mustache
182
- Completed 200 OK in 11ms (Views: 10.5ms)
183
- Processing by StacheController#index as HTML
184
- Rendered stache/index.html.mustache within layouts/application (8.7ms)
185
- Completed 200 OK in 42ms (Views: 41.3ms)
186
- Processing by StacheController#with_partials as HTML
187
- LOADING PARTIAL: /Users/mhw/Dropbox/Projects/agora/stache/spec/dummy/app/views/stache/_eaten_by_a.html.mustache
188
- Completed 200 OK in 12ms (Views: 11.2ms)
189
- Processing by StacheController#index as HTML
190
- Rendered stache/index.html.mustache within layouts/application (11.6ms)
191
- Completed 200 OK in 50ms (Views: 49.8ms)
192
- Processing by StacheController#with_partials as HTML
193
- Completed 200 OK in 14ms (Views: 13.4ms)
194
- Processing by StacheController#index as HTML
195
- Rendered stache/index.html.mustache within layouts/application (9.7ms)
196
- Completed 200 OK in 47ms (Views: 47.0ms)
197
- Processing by StacheController#with_partials as HTML
198
- Completed 200 OK in 14ms (Views: 13.9ms)
199
- Processing by StacheController#index as HTML
200
- Rendered stache/index.html.mustache within layouts/application (14.3ms)
201
- Completed 200 OK in 51ms (Views: 50.8ms)
202
- Processing by StacheController#with_partials as HTML
203
- Completed 200 OK in 13ms (Views: 12.5ms)
204
- Processing by StacheController#index as HTML
205
- Rendered stache/index.html.mustache within layouts/application (11.5ms)
206
- Completed 200 OK in 54ms (Views: 53.8ms)
207
- Processing by StacheController#with_partials as HTML
208
- Completed 200 OK in 14ms (Views: 13.9ms)
209
- Processing by StacheController#index as HTML
210
- Rendered stache/index.html.mustache within layouts/application (14.1ms)
211
- Completed 200 OK in 77ms (Views: 76.8ms)
212
- Processing by StacheController#with_partials as HTML
213
- Completed 200 OK in 16ms (Views: 15.8ms)
214
- Processing by StacheController#index as HTML
215
- Rendered stache/index.html.mustache within layouts/application (4.3ms)
216
- Completed 200 OK in 65ms (Views: 64.0ms)
217
- Processing by StacheController#with_partials as HTML
218
- Completed 200 OK in 8ms (Views: 8.0ms)
219
- Processing by StacheController#index as HTML
220
- Rendered stache/index.html.mustache within layouts/application (4.5ms)
221
- Completed 200 OK in 41ms (Views: 40.3ms)
222
- Processing by StacheController#with_partials as HTML
223
- Completed 200 OK in 7ms (Views: 6.6ms)