baby_erubis 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +69 -2
- data/Rakefile +2 -2
- data/baby_erubis.gemspec +3 -3
- data/bin/baby_erubis +2 -2
- data/lib/baby_erubis/rails.rb +2 -2
- data/lib/baby_erubis.rb +7 -3
- data/test/context_test.rb +2 -2
- data/test/rails_test.rb +2 -2
- data/test/renderer_test.rb +312 -0
- data/test/run_all.rb +2 -2
- data/test/script_test.rb +3 -2
- data/test/template_test.rb +2 -2
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e3e54829bebc2831ffe6e689adb929da5651f1
|
4
|
+
data.tar.gz: b96bd245ccfad8a9da0bf544adcd0810faf95cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5848f552207930cd84cb1e6babb2de0e102010f623b658e2a845870ab4d7ce0232f2ed0c734bfee32d1492e9c0ec08a29608c14f810d64170785896a707999f
|
7
|
+
data.tar.gz: e353121aaabdc3412b71c4dae60f164e7602bf5fedea44a0918bb631681365641e34857abc237971355786e602d7d00246648cd1e55cc02bae4ab4b2c0a5cc3a
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
BabyErubis.rb
|
2
2
|
=============
|
3
3
|
|
4
|
-
$Release: 2.
|
4
|
+
$Release: 2.1.0 $
|
5
5
|
|
6
6
|
BabyErubis is an yet another eRuby implementation, based on Erubis.
|
7
7
|
|
@@ -199,6 +199,67 @@ You can check syntax of Rails template in command-line:
|
|
199
199
|
(TODO: How to use BabyErubis in Ruby on Rails instead of Erubis)
|
200
200
|
|
201
201
|
|
202
|
+
Define Rendering Methods
|
203
|
+
------------------------
|
204
|
+
|
205
|
+
It is very easy to use BabyErubis as template engine in your app or framework,
|
206
|
+
because `BabyErubis/Renderer` module defines rendering methods:
|
207
|
+
|
208
|
+
require 'baby_erubis'
|
209
|
+
require 'baby_erubis/renderer'
|
210
|
+
|
211
|
+
class MyController
|
212
|
+
include BabyErubis::HtmlEscaper
|
213
|
+
include BabyErubis::Renderer # !!!!
|
214
|
+
|
215
|
+
ERUBY_PATH = ['.']
|
216
|
+
ERUBY_LAYOUT = :_layout
|
217
|
+
ERUBY_HTML = BabyErubis::Html
|
218
|
+
ERUBY_HTML_EXT = '.html.eruby'
|
219
|
+
ERUBY_TEXT = BabyErubis::Text
|
220
|
+
ERUBY_TEXT_EXT = '.eruby'
|
221
|
+
ERUBY_CACHE = {}
|
222
|
+
|
223
|
+
alias render_html eruby_render_html
|
224
|
+
alias render_text eruby_render_text
|
225
|
+
|
226
|
+
def index
|
227
|
+
@items = ['A', 'B', 'C']
|
228
|
+
## renders 'templates/welcome.html.eruby'
|
229
|
+
html = render_html(:welcome)
|
230
|
+
return html
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
`BabyErubis/Renderer` module defines the following methods:
|
236
|
+
|
237
|
+
* `eruby_render_html(template_name, layout: true, encoding: 'utf-8')` --
|
238
|
+
renders HTML template with layout template.
|
239
|
+
`layout` keyword argument is layout template name or boolean and use
|
240
|
+
default layout name (= ERUBY_TEMPLATE_LAYOUT) when its value is true.
|
241
|
+
* `eruby_render_text(template_name, layout: false, encoding: 'utf-8')` --
|
242
|
+
renders plain template.
|
243
|
+
|
244
|
+
Layout template example:
|
245
|
+
|
246
|
+
<%
|
247
|
+
## you can specify parent layout template name
|
248
|
+
#@_layout = :sitelayout
|
249
|
+
%>
|
250
|
+
<!doctype html>
|
251
|
+
<html>
|
252
|
+
<head>
|
253
|
+
<meta charset="utf-8" />
|
254
|
+
<title><%= @page_title %></title>
|
255
|
+
<head>
|
256
|
+
<body>
|
257
|
+
<div id="main" class="main">
|
258
|
+
<%== @_content %> ## or <% _buf << @_content %>
|
259
|
+
</div>
|
260
|
+
</body>
|
261
|
+
</html>
|
262
|
+
|
202
263
|
|
203
264
|
Customizing
|
204
265
|
===========
|
@@ -369,6 +430,12 @@ Changes
|
|
369
430
|
=======
|
370
431
|
|
371
432
|
|
433
|
+
Release 2.1.0 (2015-10-27)
|
434
|
+
--------------------------
|
435
|
+
|
436
|
+
* [enhance] Add new helper module `BabyErubis::Renderer`
|
437
|
+
|
438
|
+
|
372
439
|
Release 2.0.0 (2014-12-09)
|
373
440
|
--------------------------
|
374
441
|
|
@@ -403,4 +470,4 @@ $License: MIT License $
|
|
403
470
|
Copyright
|
404
471
|
=========
|
405
472
|
|
406
|
-
$Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
473
|
+
$Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
data/Rakefile
CHANGED
data/baby_erubis.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
4
|
+
### $Release: 2.1.0 $
|
5
5
|
### $License: MIT License $
|
6
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
6
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
7
7
|
###
|
8
8
|
|
9
9
|
require 'rubygems'
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.name = "baby_erubis"
|
14
14
|
s.author = "makoto kuwata"
|
15
15
|
s.email = "kwa(at)kuwata-lab.com"
|
16
|
-
s.version = "$Release: 2.
|
16
|
+
s.version = "$Release: 2.1.0 $".split()[1]
|
17
17
|
s.license = "MIT License"
|
18
18
|
s.platform = Gem::Platform::RUBY
|
19
19
|
s.homepage = "https://github.com/kwatch/BabyErubis/tree/ruby"
|
data/bin/baby_erubis
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
###
|
5
|
-
### $Release: 2.
|
6
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
5
|
+
### $Release: 2.1.0 $
|
6
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
7
7
|
### $License: MIT License $
|
8
8
|
###
|
9
9
|
|
data/lib/baby_erubis/rails.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
data/lib/baby_erubis.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
@@ -25,7 +25,11 @@
|
|
25
25
|
|
26
26
|
module BabyErubis
|
27
27
|
|
28
|
-
RELEASE = '$Release: 2.
|
28
|
+
RELEASE = '$Release: 2.1.0 $'.split(' ')[1]
|
29
|
+
|
30
|
+
|
31
|
+
class TemplateError < StandardError
|
32
|
+
end
|
29
33
|
|
30
34
|
|
31
35
|
class Template
|
data/test/context_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
data/test/rails_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
@@ -0,0 +1,312 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
###
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
|
+
### $License: MIT License $
|
7
|
+
###
|
8
|
+
|
9
|
+
libpath = File.class_eval { join(dirname(dirname(__FILE__)), 'lib') }
|
10
|
+
$: << libpath unless $:.include?(libpath)
|
11
|
+
|
12
|
+
require 'minitest/autorun'
|
13
|
+
|
14
|
+
require 'baby_erubis'
|
15
|
+
require 'baby_erubis/renderer'
|
16
|
+
|
17
|
+
|
18
|
+
class HelloClass
|
19
|
+
include BabyErubis::HtmlEscaper
|
20
|
+
include BabyErubis::Renderer
|
21
|
+
|
22
|
+
ERUBY_PATH = ['_t']
|
23
|
+
ERUBY_HTML_EXT = '.html.erb'
|
24
|
+
ERUBY_TEXT_EXT = '.erb'
|
25
|
+
|
26
|
+
def initialize(vars={})
|
27
|
+
vars.each do |k, v|
|
28
|
+
instance_variable_set("@#{k}", v)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
describe 'BabyErubis::Renderer' do
|
36
|
+
|
37
|
+
layout_template = <<'END'
|
38
|
+
<!doctype>
|
39
|
+
<html>
|
40
|
+
<head>
|
41
|
+
<meta charset="utf-8" />
|
42
|
+
<title><%= @page_title %></title>
|
43
|
+
</head>
|
44
|
+
<body>
|
45
|
+
<div id="main" class="main">
|
46
|
+
<%== @_content %>
|
47
|
+
</div>
|
48
|
+
</body>
|
49
|
+
</html>
|
50
|
+
END
|
51
|
+
|
52
|
+
html_template = <<'END'
|
53
|
+
<%
|
54
|
+
@page_title = 'Example'
|
55
|
+
%>
|
56
|
+
<h1><%= @page_title %></h1>
|
57
|
+
<ul>
|
58
|
+
<% for x in @items %>
|
59
|
+
<li><%= x %></li>
|
60
|
+
<% end %>
|
61
|
+
</ul>
|
62
|
+
END
|
63
|
+
|
64
|
+
layout2_template = <<'END'
|
65
|
+
<%
|
66
|
+
@_layout = true
|
67
|
+
%>
|
68
|
+
<section>
|
69
|
+
<%== @_content %>
|
70
|
+
</section>
|
71
|
+
END
|
72
|
+
|
73
|
+
text_template = <<'END'
|
74
|
+
title: <%= @title %>
|
75
|
+
date: <%= @date %>
|
76
|
+
END
|
77
|
+
|
78
|
+
before do
|
79
|
+
Dir.mkdir('_t')
|
80
|
+
File.open('_t/_layout.html.erb', 'w') {|f| f.write(layout_template) }
|
81
|
+
File.open('_t/_layout2.html.erb', 'w') {|f| f.write(layout2_template) }
|
82
|
+
File.open('_t/welcome.html.erb', 'w') {|f| f.write(html_template) }
|
83
|
+
File.open('_t/example.text.erb', 'w') {|f| f.write(text_template) }
|
84
|
+
end
|
85
|
+
|
86
|
+
after do
|
87
|
+
Dir.glob('_t/*').each {|fpath| File.unlink(fpath) if File.file?(fpath) }
|
88
|
+
Dir.rmdir('_t')
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
describe '#eruby_render_html()' do
|
93
|
+
|
94
|
+
it "renders html template." do
|
95
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
96
|
+
actual = obj.eruby_render_html(:'welcome', layout: false)
|
97
|
+
expected = <<'END'
|
98
|
+
<h1>Example</h1>
|
99
|
+
<ul>
|
100
|
+
<li>10</li>
|
101
|
+
<li>20</li>
|
102
|
+
<li>30</li>
|
103
|
+
</ul>
|
104
|
+
END
|
105
|
+
assert_equal expected, actual
|
106
|
+
end
|
107
|
+
|
108
|
+
it "renders with layout template." do
|
109
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
110
|
+
actual = obj.eruby_render_html(:'welcome', layout: :'_layout')
|
111
|
+
expected = <<'END'
|
112
|
+
<!doctype>
|
113
|
+
<html>
|
114
|
+
<head>
|
115
|
+
<meta charset="utf-8" />
|
116
|
+
<title>Example</title>
|
117
|
+
</head>
|
118
|
+
<body>
|
119
|
+
<div id="main" class="main">
|
120
|
+
<h1>Example</h1>
|
121
|
+
<ul>
|
122
|
+
<li>10</li>
|
123
|
+
<li>20</li>
|
124
|
+
<li>30</li>
|
125
|
+
</ul>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</body>
|
129
|
+
</html>
|
130
|
+
END
|
131
|
+
assert_equal expected, actual
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
describe '#eruby_render_text()' do
|
138
|
+
|
139
|
+
it "renders text template" do
|
140
|
+
obj = HelloClass.new(:title=>"Homhom", :date=>"2015-01-01")
|
141
|
+
actual = obj.eruby_render_text(:'example.text', layout: false)
|
142
|
+
expected = <<'END'
|
143
|
+
title: Homhom
|
144
|
+
date: 2015-01-01
|
145
|
+
END
|
146
|
+
assert_equal expected, actual
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
describe '#_eruby_find_template()' do
|
153
|
+
|
154
|
+
it "caches template object with timestamp." do
|
155
|
+
cache = HelloClass.const_get :ERUBY_CACHE
|
156
|
+
cache.clear()
|
157
|
+
assert_equal 0, cache.length
|
158
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
159
|
+
t1 = Time.now
|
160
|
+
obj.eruby_render_html(:'welcome')
|
161
|
+
t2 = Time.now
|
162
|
+
assert_equal 2, cache.length
|
163
|
+
tuple = cache['_t/welcome.html.erb']
|
164
|
+
assert tuple.is_a?(Array)
|
165
|
+
assert_equal 3, tuple.length
|
166
|
+
assert_equal BabyErubis::HtmlTemplate, tuple[0].class
|
167
|
+
assert_equal File.mtime('_t/welcome.html.erb'), tuple[1]
|
168
|
+
assert t1 < tuple[2]
|
169
|
+
assert t2 > tuple[2]
|
170
|
+
end
|
171
|
+
|
172
|
+
it "caches template object with timestamp." do
|
173
|
+
cache = HelloClass.const_get :ERUBY_CACHE
|
174
|
+
cache.clear()
|
175
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
176
|
+
obj.eruby_render_html(:'welcome')
|
177
|
+
tuple1 = cache['_t/welcome.html.erb']
|
178
|
+
templ1 = tuple1[0]
|
179
|
+
mtime1 = tuple1[1]
|
180
|
+
#
|
181
|
+
tstamp = Time.now - 30
|
182
|
+
File.utime(tstamp, tstamp, '_t/welcome.html.erb')
|
183
|
+
sleep(1.0)
|
184
|
+
obj.eruby_render_html(:'welcome')
|
185
|
+
tuple2 = cache['_t/welcome.html.erb']
|
186
|
+
templ2 = tuple2[0]
|
187
|
+
mtime2 = tuple2[1]
|
188
|
+
assert templ1 != templ2
|
189
|
+
assert mtime1 != mtime2
|
190
|
+
assert templ2.is_a?(BabyErubis::HtmlTemplate)
|
191
|
+
assert_equal tstamp.to_s, mtime2.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
it "raises BabyErubis::TempalteError when template file not found." do
|
195
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
196
|
+
ex = assert_raises(BabyErubis::TemplateError) do
|
197
|
+
obj.eruby_render_html(:'hello-homhom')
|
198
|
+
end
|
199
|
+
expected = "hello-homhom.html.erb: template not found in [\"_t\"]."
|
200
|
+
assert_equal expected, ex.message
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
describe '#_eruby_load_template()' do
|
207
|
+
|
208
|
+
_prepare = proc {
|
209
|
+
cache = HelloClass.const_get :ERUBY_CACHE
|
210
|
+
cache.clear()
|
211
|
+
obj = HelloClass.new(:items=>[10, 20, 30])
|
212
|
+
obj.eruby_render_html(:'welcome')
|
213
|
+
fpath = '_t/welcome.html.erb'
|
214
|
+
ts = Time.now - 30
|
215
|
+
File.utime(ts, ts, fpath)
|
216
|
+
[cache, obj, fpath]
|
217
|
+
}
|
218
|
+
|
219
|
+
_render = proc {|cache, obj, fpath, n, expected|
|
220
|
+
count = 0
|
221
|
+
n.times do
|
222
|
+
obj.eruby_render_html(:'welcome')
|
223
|
+
if expected != cache[fpath]
|
224
|
+
count += 1
|
225
|
+
cache[fpath] = expected
|
226
|
+
end
|
227
|
+
end
|
228
|
+
count
|
229
|
+
}
|
230
|
+
|
231
|
+
it "skips timestamp check in order to reduce syscall (= File.mtime())" do
|
232
|
+
cache, obj, fpath = _prepare.call()
|
233
|
+
#
|
234
|
+
sleep(0.1)
|
235
|
+
count = _render.call(cache, obj, fpath, 1000, cache[fpath])
|
236
|
+
assert count == 0, "#{count} == 0: failed"
|
237
|
+
end
|
238
|
+
|
239
|
+
it "checks timestamp only for 5% request in order to avoid thundering herd" do
|
240
|
+
cache, obj, fpath = _prepare.call()
|
241
|
+
#
|
242
|
+
sleep(0.6)
|
243
|
+
count = _render.call(cache, obj, fpath, 1000, cache[fpath])
|
244
|
+
assert count > 0, "#{count} > 0: failed"
|
245
|
+
assert count > 3, "#{count} > 3: failed"
|
246
|
+
assert count < 100, "#{count} < 100: failed"
|
247
|
+
end
|
248
|
+
|
249
|
+
it "update last_checked in cache when file timestamp is not changed" do
|
250
|
+
cache, obj, fpath = _prepare.call()
|
251
|
+
_, _, old_last_checked = cache[fpath]
|
252
|
+
#
|
253
|
+
sleep(1.0)
|
254
|
+
now = Time.now
|
255
|
+
obj.eruby_render_html(:'welcome')
|
256
|
+
_, _, new_last_checked = cache[fpath]
|
257
|
+
assert_operator new_last_checked, :'!=', old_last_checked
|
258
|
+
assert_operator (new_last_checked - old_last_checked), :'>=', 1.0
|
259
|
+
assert_operator (new_last_checked - now), :'<', 0.001
|
260
|
+
end
|
261
|
+
|
262
|
+
it "remove cache entry when file timestamp is changed" do
|
263
|
+
cache, obj, fpath = _prepare.call()
|
264
|
+
#
|
265
|
+
sleep(1.0)
|
266
|
+
count = _render.call(cache, obj, fpath, 1000, cache[fpath])
|
267
|
+
assert count == 1000, "#{count} == 1000: failed"
|
268
|
+
#
|
269
|
+
assert cache[fpath] != nil
|
270
|
+
ret = obj.__send__(:_eruby_load_template, cache, fpath, Time.now)
|
271
|
+
assert_nil ret
|
272
|
+
assert_nil cache[fpath]
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
|
278
|
+
describe '#_eruby_render_template()' do
|
279
|
+
|
280
|
+
it "recognizes '@_layout' variable" do
|
281
|
+
expected = <<'END'
|
282
|
+
<!doctype>
|
283
|
+
<html>
|
284
|
+
<head>
|
285
|
+
<meta charset="utf-8" />
|
286
|
+
<title>Example</title>
|
287
|
+
</head>
|
288
|
+
<body>
|
289
|
+
<div id="main" class="main">
|
290
|
+
<section>
|
291
|
+
<h1>Example</h1>
|
292
|
+
<ul>
|
293
|
+
<li>10</li>
|
294
|
+
<li>20</li>
|
295
|
+
<li>30</li>
|
296
|
+
</ul>
|
297
|
+
|
298
|
+
</section>
|
299
|
+
|
300
|
+
</div>
|
301
|
+
</body>
|
302
|
+
</html>
|
303
|
+
END
|
304
|
+
obj = HelloClass.new(:items=>[10,20,30])
|
305
|
+
actual = obj.eruby_render_html(:'welcome', layout: :'_layout2')
|
306
|
+
assert_equal expected, actual
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
|
312
|
+
end
|
data/test/run_all.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
data/test/script_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
@@ -479,6 +479,7 @@ END
|
|
479
479
|
end
|
480
480
|
end
|
481
481
|
expected = "-f #{ctx_file}: JSON syntax error: (JSON::ParserError) 743: unexpected token\n"
|
482
|
+
expected = expected.sub(/743/, '814') if RUBY_VERSION >= '2.2'
|
482
483
|
expected = expected.sub(/743/, '795') if RUBY_VERSION >= '2.0'
|
483
484
|
assert_equal "", sout
|
484
485
|
assert_equal expected, serr
|
data/test/template_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 2.
|
5
|
-
### $Copyright: copyright(c) 2014 kuwata-lab.com all rights reserved $
|
4
|
+
### $Release: 2.1.0 $
|
5
|
+
### $Copyright: copyright(c) 2014-2015 kuwata-lab.com all rights reserved $
|
6
6
|
### $License: MIT License $
|
7
7
|
###
|
8
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baby_erubis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- makoto kuwata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
BabyErubis is an yet another eRuby implementation, based on Erubis.
|
@@ -25,19 +25,20 @@ executables:
|
|
25
25
|
extensions: []
|
26
26
|
extra_rdoc_files: []
|
27
27
|
files:
|
28
|
+
- MIT-LICENSE
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- baby_erubis.gemspec
|
32
|
+
- bin/baby_erubis
|
28
33
|
- lib/baby_erubis.rb
|
29
34
|
- lib/baby_erubis/rails.rb
|
35
|
+
- setup.rb
|
30
36
|
- test/context_test.rb
|
31
37
|
- test/rails_test.rb
|
38
|
+
- test/renderer_test.rb
|
32
39
|
- test/run_all.rb
|
33
40
|
- test/script_test.rb
|
34
41
|
- test/template_test.rb
|
35
|
-
- bin/baby_erubis
|
36
|
-
- README.md
|
37
|
-
- MIT-LICENSE
|
38
|
-
- setup.rb
|
39
|
-
- baby_erubis.gemspec
|
40
|
-
- Rakefile
|
41
42
|
homepage: https://github.com/kwatch/BabyErubis/tree/ruby
|
42
43
|
licenses:
|
43
44
|
- MIT License
|
@@ -48,17 +49,17 @@ require_paths:
|
|
48
49
|
- lib
|
49
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
|
-
- -
|
52
|
+
- - ">="
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
54
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
56
|
requirements:
|
56
|
-
- -
|
57
|
+
- - ">="
|
57
58
|
- !ruby/object:Gem::Version
|
58
59
|
version: '0'
|
59
60
|
requirements: []
|
60
61
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
62
|
+
rubygems_version: 2.4.5.1
|
62
63
|
signing_key:
|
63
64
|
specification_version: 4
|
64
65
|
summary: yet another eRuby implementation based on Erubis
|