erubis 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +12 -4
- data/MIT-LICENSE +1 -1
- data/README.txt +2 -2
- data/benchmark/bench.rb +2 -2
- data/bin/erubis +2 -2
- data/contrib/erubis +2 -2
- data/contrib/inline-require +2 -2
- data/doc-api/classes/{ActionView/Base/ERB.html → ERB.html} +3 -3
- data/doc-api/classes/Erubis.html +1 -1
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +1 -1
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +5 -5
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +1 -1
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
- data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
- data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
- data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
- data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
- data/doc-api/files/erubis/engine_rb.html +1 -1
- data/doc-api/files/erubis/enhancer_rb.html +1 -1
- data/doc-api/files/erubis/error_rb.html +1 -1
- data/doc-api/files/erubis/evaluator_rb.html +1 -1
- data/doc-api/files/erubis/generator_rb.html +1 -1
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +2 -2
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +1 -1
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc-api/fr_class_index.html +1 -1
- data/doc/users-guide.html +6 -6
- data/lib/erubis.rb +3 -3
- data/lib/erubis/context.rb +2 -2
- data/lib/erubis/converter.rb +2 -2
- data/lib/erubis/engine.rb +2 -2
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ejava.rb +2 -2
- data/lib/erubis/engine/ejavascript.rb +2 -2
- data/lib/erubis/engine/enhanced.rb +2 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +2 -2
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +2 -2
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +2 -2
- data/lib/erubis/helper.rb +2 -2
- data/lib/erubis/helpers/rails_helper.rb +72 -7
- data/lib/erubis/local-setting.rb +2 -2
- data/lib/erubis/main.rb +2 -2
- data/lib/erubis/tiny.rb +2 -2
- data/test/assert-text-equal.rb +2 -2
- data/test/data/users-guide/stderr.log +3 -0
- data/test/test-engines.rb +2 -2
- data/test/test-enhancers.rb +2 -2
- data/test/test-erubis.rb +2 -2
- data/test/test-main.rb +2 -2
- data/test/test-users-guide.rb +2 -2
- data/test/test.rb +2 -2
- data/test/testutil.rb +2 -2
- metadata +4 -5
data/CHANGES
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
# $Rev:
|
|
2
|
-
# $Release: 2.3.
|
|
3
|
-
# copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
1
|
+
# $Rev: 83 $
|
|
2
|
+
# $Release: 2.3.1 $
|
|
3
|
+
# copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
- release: 2.3.1
|
|
8
|
+
date: 2007-05-26
|
|
9
|
+
bugfix:
|
|
10
|
+
- A serious bug in 'helpers/rails_helper.rb' is fixed.
|
|
11
|
+
You must be update if you are using Erubis with Ruby on Rails.
|
|
4
12
|
|
|
5
13
|
|
|
6
14
|
#
|
|
7
15
|
- release: 2.3.0
|
|
8
|
-
date:
|
|
16
|
+
date: 2007-05-23
|
|
9
17
|
enhancements:
|
|
10
18
|
- |
|
|
11
19
|
New class 'Erubis::FastEruby' is added.
|
data/MIT-LICENSE
CHANGED
data/README.txt
CHANGED
data/benchmark/bench.rb
CHANGED
data/bin/erubis
CHANGED
data/contrib/erubis
CHANGED
data/contrib/inline-require
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
7
|
<head>
|
|
8
|
-
<title>Module:
|
|
8
|
+
<title>Module: ERB</title>
|
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="
|
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
12
|
<script type="text/javascript">
|
|
13
13
|
// <![CDATA[
|
|
14
14
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<table class="header-table">
|
|
51
51
|
<tr class="top-aligned-row">
|
|
52
52
|
<td><strong>Module</strong></td>
|
|
53
|
-
<td class="class-name-in-header">
|
|
53
|
+
<td class="class-name-in-header">ERB</td>
|
|
54
54
|
</tr>
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
data/doc-api/classes/Erubis.html
CHANGED
|
@@ -313,7 +313,7 @@ Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
|
|
|
313
313
|
<tr class="top-aligned-row context-row">
|
|
314
314
|
<td class="context-item-name">VERSION</td>
|
|
315
315
|
<td>=</td>
|
|
316
|
-
<td class="context-item-value">('$Release: 2.3.
|
|
316
|
+
<td class="context-item-value">('$Release: 2.3.1 $' =~ /([.\d]+)/) && $1</td>
|
|
317
317
|
</tr>
|
|
318
318
|
</table>
|
|
319
319
|
</div>
|
data/doc-api/created.rid
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Sat, 26 May 2007 20:38:34 +0900
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Sat May 26 20:38:33 +0900 2007</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
<div id="description">
|
|
72
72
|
<h1>README</h1>
|
|
73
73
|
<table>
|
|
74
|
-
<tr><td valign="top">release:</td><td>2.3.
|
|
74
|
+
<tr><td valign="top">release:</td><td>2.3.1
|
|
75
75
|
|
|
76
76
|
</td></tr>
|
|
77
|
-
<tr><td valign="top">copyright:</td><td>copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
77
|
+
<tr><td valign="top">copyright:</td><td>copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
|
78
78
|
|
|
79
79
|
</td></tr>
|
|
80
80
|
</table>
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
It has the following features.
|
|
85
85
|
</p>
|
|
86
86
|
<ul>
|
|
87
|
-
<li>Very fast, almost three times faster than
|
|
88
|
-
eruby
|
|
87
|
+
<li>Very fast, almost three times faster than <a
|
|
88
|
+
href="../classes/ERB.html">ERB</a> and even 10% faster than eruby
|
|
89
89
|
|
|
90
90
|
</li>
|
|
91
91
|
<li>Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
<tr class="top-aligned-row">
|
|
58
58
|
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>
|
|
59
|
+
<td>Sat May 26 20:34:03 +0900 2007</td>
|
|
60
60
|
</tr>
|
|
61
61
|
</table>
|
|
62
62
|
</div>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
<div id="description">
|
|
72
72
|
<p>
|
|
73
|
-
$Rev:
|
|
73
|
+
$Rev: 82 $ $Release: 2.3.1 $ copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
|
74
74
|
</p>
|
|
75
75
|
|
|
76
76
|
</div>
|
data/doc-api/fr_class_index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<div id="index">
|
|
21
21
|
<h1 class="section-bar">Classes</h1>
|
|
22
22
|
<div id="index-entries">
|
|
23
|
-
<a href="classes/
|
|
23
|
+
<a href="classes/ERB.html">ERB</a><br />
|
|
24
24
|
<a href="classes/Erubis.html">Erubis</a><br />
|
|
25
25
|
<a href="classes/Erubis/ArrayBufferEnhancer.html">Erubis::ArrayBufferEnhancer</a><br />
|
|
26
26
|
<a href="classes/Erubis/ArrayBufferEruby.html">Erubis::ArrayBufferEruby</a><br />
|
data/doc/users-guide.html
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
<div align="left"><h1>Erubis Users' Guide</h1></div>
|
|
16
16
|
<div align="left">
|
|
17
|
-
last update: $Date: 2007-05-
|
|
17
|
+
last update: $Date: 2007-05-26 13:29:48 +0900 (Sat, 26 May 2007) $<br>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<p>release: 2.3.
|
|
20
|
+
<p>release: 2.3.1
|
|
21
21
|
</p>
|
|
22
22
|
<a name="preface"></a>
|
|
23
23
|
<h2 class="section1">Preface</h2>
|
|
@@ -2571,8 +2571,8 @@ example of using NoCodeEnhancer with PHP file</div>
|
|
|
2571
2571
|
<p>Thanks Andrew R Jackson, he developed 'erubis-run.rb' which enables you to use Erubis with mod_ruby.
|
|
2572
2572
|
</p>
|
|
2573
2573
|
<ol type="1">
|
|
2574
|
-
<li>Copy 'erubis-2.3.
|
|
2575
|
-
<pre class="terminal">$ cd erubis-2.3.
|
|
2574
|
+
<li>Copy 'erubis-2.3.1/contrib/erubis-run.rb' to the 'RUBYLIBDIR/apache' directory (for example '/usr/local/lib/ruby/1.8/apache') which contains 'ruby-run.rb', 'eruby-run.rb', and so on.
|
|
2575
|
+
<pre class="terminal">$ cd erubis-2.3.1/
|
|
2576
2576
|
$ sudo copy contrib/erubis-run.rb /usr/local/lib/ruby/1.8/apache/
|
|
2577
2577
|
</pre>
|
|
2578
2578
|
</li>
|
|
@@ -2625,12 +2625,12 @@ in the same directory as '*.rhtml' file.
|
|
|
2625
2625
|
|
|
2626
2626
|
<a name="topics-benchmark"></a>
|
|
2627
2627
|
<h3 class="section2">Benchmark</h3>
|
|
2628
|
-
<p>A benchmark script is included in Erubis package at 'erubis-2.3.
|
|
2628
|
+
<p>A benchmark script is included in Erubis package at 'erubis-2.3.1/benchark/' directory.
|
|
2629
2629
|
Here is an example result of benchmark.
|
|
2630
2630
|
</p>
|
|
2631
2631
|
<div class="terminal_caption">
|
|
2632
2632
|
MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.6, eruby1.0.5, gcc4.0.1</div>
|
|
2633
|
-
<pre class="terminal">$ cd erubis-2.3.
|
|
2633
|
+
<pre class="terminal">$ cd erubis-2.3.1/benchmark/
|
|
2634
2634
|
$ ruby bench.rb -n 10000 -m execute
|
|
2635
2635
|
*** ntimes=10000, testmode=execute
|
|
2636
2636
|
user system total real
|
data/lib/erubis.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
##
|
|
2
2
|
## $Rev: 59 $
|
|
3
|
-
## 2.3.
|
|
4
|
-
## copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
3
|
+
## 2.3.1
|
|
4
|
+
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
|
5
5
|
##
|
|
6
6
|
|
|
7
7
|
##
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
module Erubis
|
|
51
|
-
VERSION = ('$Release: 2.3.
|
|
51
|
+
VERSION = ('$Release: 2.3.1 $' =~ /([.\d]+)/) && $1
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
require 'erubis/engine'
|
data/lib/erubis/context.rb
CHANGED
data/lib/erubis/converter.rb
CHANGED
data/lib/erubis/engine.rb
CHANGED
data/lib/erubis/engine/ec.rb
CHANGED
data/lib/erubis/engine/ejava.rb
CHANGED
data/lib/erubis/engine/eperl.rb
CHANGED
data/lib/erubis/engine/ephp.rb
CHANGED
data/lib/erubis/engine/eruby.rb
CHANGED
data/lib/erubis/enhancer.rb
CHANGED
data/lib/erubis/error.rb
CHANGED
data/lib/erubis/evaluator.rb
CHANGED
data/lib/erubis/generator.rb
CHANGED
data/lib/erubis/helper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
###
|
|
2
|
-
### $Rev:
|
|
3
|
-
### $Release: 2.3.
|
|
4
|
-
### copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
2
|
+
### $Rev: 82 $
|
|
3
|
+
### $Release: 2.3.1 $
|
|
4
|
+
### copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
|
5
5
|
###
|
|
6
6
|
|
|
7
7
|
|
|
@@ -113,15 +113,80 @@ if ActionPack::VERSION::MINOR <= 12 ### Rails 1.1
|
|
|
113
113
|
when :rxml
|
|
114
114
|
"xml = Builder::XmlMarkup.new(:indent => 2)\n" +
|
|
115
115
|
"@controller.headers['Content-Type'] ||= 'application/xml'\n" +
|
|
116
|
+
template
|
|
117
|
+
when :rjs
|
|
118
|
+
"@controller.headers['Content-Type'] ||= 'text/javascript'\n" +
|
|
119
|
+
"update_page do |page|\n#{template}\nend"
|
|
120
|
+
end
|
|
121
|
+
else
|
|
122
|
+
#body = ERB.new(template, nil, @@erb_trim_mode).src
|
|
123
|
+
body = convert_template_into_ruby_code(template)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@@template_args[render_symbol] ||= {}
|
|
127
|
+
locals_keys = @@template_args[render_symbol].keys | locals
|
|
128
|
+
@@template_args[render_symbol] = locals_keys.inject({}) { |h, k| h[k] = true; h }
|
|
129
|
+
|
|
130
|
+
locals_code = ""
|
|
131
|
+
locals_keys.each do |key|
|
|
132
|
+
locals_code << "#{key} = local_assigns[:#{key}] if local_assigns.has_key?(:#{key})\n"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
"def #{render_symbol}(local_assigns)\n#{locals_code}#{body}\nend"
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
else ### Rails 1.2 or later
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Create source code for given template
|
|
143
|
+
def create_template_source(extension, template, render_symbol, locals)
|
|
144
|
+
if template_requires_setup?(extension)
|
|
145
|
+
body = case extension.to_sym
|
|
146
|
+
when :rxml
|
|
147
|
+
"controller.response.content_type ||= 'application/xml'\n" +
|
|
148
|
+
"xml = Builder::XmlMarkup.new(:indent => 2)\n" +
|
|
149
|
+
template
|
|
150
|
+
when :rjs
|
|
151
|
+
"controller.response.content_type ||= 'text/javascript'\n" +
|
|
152
|
+
"update_page do |page|\n#{template}\nend"
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
#body = ERB.new(template, nil, @@erb_trim_mode).src
|
|
156
|
+
body = convert_template_into_ruby_code(template)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
@@template_args[render_symbol] ||= {}
|
|
160
|
+
locals_keys = @@template_args[render_symbol].keys | locals
|
|
161
|
+
@@template_args[render_symbol] = locals_keys.inject({}) { |h, k| h[k] = true; h }
|
|
162
|
+
|
|
163
|
+
locals_code = ""
|
|
164
|
+
locals_keys.each do |key|
|
|
165
|
+
locals_code << "#{key} = local_assigns[:#{key}]\n"
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
"def #{render_symbol}(local_assigns)\n#{locals_code}#{body}\nend"
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
end ###
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
|
|
116
182
|
## set Erubis as eRuby compiler in Ruby on Rails instead of ERB
|
|
117
183
|
class ActionView::Base # :nodoc:
|
|
118
184
|
private
|
|
119
185
|
def convert_template_into_ruby_code(template)
|
|
120
186
|
#src = Erubis::Eruby.new(template).src
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
show_src = rails_helper.show_src
|
|
187
|
+
klass = Erubis::Helpers::RailsHelper.engine_class
|
|
188
|
+
properties = Erubis::Helpers::RailsHelper.init_properties
|
|
189
|
+
show_src = Erubis::Helpers::RailsHelper.show_src
|
|
125
190
|
src = klass.new(template, properties).src
|
|
126
191
|
#src.insert(0, '_erbout = ')
|
|
127
192
|
logger.debug "** Erubis: src==<<'END'\n#{src}END\n" if show_src
|
data/lib/erubis/local-setting.rb
CHANGED
data/lib/erubis/main.rb
CHANGED
data/lib/erubis/tiny.rb
CHANGED
data/test/assert-text-equal.rb
CHANGED
data/test/test-engines.rb
CHANGED
data/test/test-enhancers.rb
CHANGED
data/test/test-erubis.rb
CHANGED
data/test/test-main.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
##
|
|
2
2
|
## $Rev: 78 $
|
|
3
|
-
## $Release: 2.3.
|
|
3
|
+
## $Release: 2.3.1 $
|
|
4
4
|
## $Date: 2007-05-23 06:41:27 +0900 (Wed, 23 May 2007) $
|
|
5
5
|
##
|
|
6
6
|
|
|
@@ -165,7 +165,7 @@ END
|
|
|
165
165
|
|
|
166
166
|
def test_version # -v
|
|
167
167
|
@options = '-v'
|
|
168
|
-
@expected = (("$Release: 2.3.
|
|
168
|
+
@expected = (("$Release: 2.3.1 $" =~ /[.\d]+/) && $&) + "\n"
|
|
169
169
|
@filename = false
|
|
170
170
|
_test()
|
|
171
171
|
end
|
data/test/test-users-guide.rb
CHANGED
data/test/test.rb
CHANGED
data/test/testutil.rb
CHANGED
metadata
CHANGED
|
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
|
3
3
|
specification_version: 1
|
|
4
4
|
name: erubis
|
|
5
5
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 2.3.
|
|
7
|
-
date: 2007-05-
|
|
6
|
+
version: 2.3.1
|
|
7
|
+
date: 2007-05-26 00:00:00 +09:00
|
|
8
8
|
summary: a fast and extensible eRuby implementation which supports multi-language
|
|
9
9
|
require_paths:
|
|
10
10
|
- lib
|
|
@@ -173,6 +173,7 @@ files:
|
|
|
173
173
|
- test/data/users-guide/printenabled-example.rb
|
|
174
174
|
- test/data/users-guide/printstatement_example.result
|
|
175
175
|
- test/data/users-guide/simplify_example.result
|
|
176
|
+
- test/data/users-guide/stderr.log
|
|
176
177
|
- test/data/users-guide/stdout_exmple.result
|
|
177
178
|
- test/data/users-guide/stringbuffer_example.result
|
|
178
179
|
- doc/docstyle.css
|
|
@@ -195,9 +196,7 @@ files:
|
|
|
195
196
|
- benchmark/templates/bench_erubis.rhtml
|
|
196
197
|
- benchmark/templates/bench_eruby.rhtml
|
|
197
198
|
- doc-api/classes
|
|
198
|
-
- doc-api/classes/
|
|
199
|
-
- doc-api/classes/ActionView/Base
|
|
200
|
-
- doc-api/classes/ActionView/Base/ERB.html
|
|
199
|
+
- doc-api/classes/ERB.html
|
|
201
200
|
- doc-api/classes/Erubis
|
|
202
201
|
- doc-api/classes/Erubis/ArrayBufferEnhancer.html
|
|
203
202
|
- doc-api/classes/Erubis/ArrayBufferEruby.html
|