erubis 2.6.2 → 2.6.3
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.txt +16 -5
- data/MIT-LICENSE +1 -1
- data/README.txt +2 -2
- data/benchmark/bench.rb +2 -2
- data/bin/erubis +4 -4
- data/contrib/erubis +3349 -5
- data/contrib/inline-require +2 -2
- data/doc-api/classes/Erubis.html +1 -1
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +24 -24
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +12 -12
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Converter.html +27 -27
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +6 -6
- data/doc-api/classes/Erubis/ErboutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +150 -150
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +49 -49
- data/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +12 -12
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +30 -30
- data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
- data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
- data/doc-api/classes/Erubis/NoTextEnhancer.html +6 -6
- data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
- data/doc-api/classes/Erubis/PI/Ec.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
- data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
- data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
- data/doc-api/classes/Erubis/PI/Eruby.html +6 -6
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +6 -6
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PreprocessingEruby.html +12 -12
- data/doc-api/classes/Erubis/PreprocessingHelper.html +22 -22
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +18 -18
- data/doc-api/classes/Erubis/RubyGenerator.html +48 -48
- data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -7
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/XmlHelper.html +30 -30
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +3 -3
- 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_form_helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/preprocessing_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_method_index.html +188 -188
- data/doc/users-guide.html +5 -5
- 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_form_helper.rb +2 -2
- data/lib/erubis/helpers/rails_helper.rb +2 -2
- data/lib/erubis/local-setting.rb +2 -2
- data/lib/erubis/main.rb +8 -7
- data/lib/erubis/preprocessing.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 +43 -16
- data/test/test-users-guide.rb +2 -2
- data/test/test.rb +2 -2
- data/test/testutil.rb +2 -2
- metadata +5 -10
- data/test/assert-text-equal.rbc +0 -0
- data/test/hoge.rb +0 -5
- data/test/test-engines.rbc +0 -0
- data/test/test-erubis.rbc +0 -0
- data/test/test-users-guide.rbc +0 -0
- data/test/test.rbc +0 -0
- data/test/testutil.rbc +0 -0
data/doc/users-guide.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
last update: $Date: 2008-06-13 08:04:21 +0900 (Fri, 13 Jun 2008) $<br>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<p>release: 2.6.
|
|
20
|
+
<p>release: 2.6.3
|
|
21
21
|
</p>
|
|
22
22
|
<a name="preface"></a>
|
|
23
23
|
<h2 class="section1">Preface</h2>
|
|
@@ -2986,8 +2986,8 @@ example of using NoCodeEnhancer with PHP file</div>
|
|
|
2986
2986
|
<p>Thanks Andrew R Jackson, he developed 'erubis-run.rb' which enables you to use Erubis with mod_ruby.
|
|
2987
2987
|
</p>
|
|
2988
2988
|
<ol type="1">
|
|
2989
|
-
<li>Copy 'erubis-2.6.
|
|
2990
|
-
<pre class="terminal">$ cd erubis-2.6.
|
|
2989
|
+
<li>Copy 'erubis-2.6.3/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.
|
|
2990
|
+
<pre class="terminal">$ cd erubis-2.6.3/
|
|
2991
2991
|
$ sudo copy contrib/erubis-run.rb /usr/local/lib/ruby/1.8/apache/
|
|
2992
2992
|
</pre>
|
|
2993
2993
|
</li>
|
|
@@ -3063,12 +3063,12 @@ p obj.render('world') #=> "hello world"
|
|
|
3063
3063
|
|
|
3064
3064
|
<a name="topics-benchmark"></a>
|
|
3065
3065
|
<h3 class="section2">Benchmark</h3>
|
|
3066
|
-
<p>A benchmark script is included in Erubis package at 'erubis-2.6.
|
|
3066
|
+
<p>A benchmark script is included in Erubis package at 'erubis-2.6.3/benchark/' directory.
|
|
3067
3067
|
Here is an example result of benchmark.
|
|
3068
3068
|
</p>
|
|
3069
3069
|
<div class="terminal_caption">
|
|
3070
3070
|
MacOS X 10.4 Tiger, Intel CoreDuo 1.83GHz, Ruby1.8.6, eruby1.0.5, gcc4.0.1</div>
|
|
3071
|
-
<pre class="terminal">$ cd erubis-2.6.
|
|
3071
|
+
<pre class="terminal">$ cd erubis-2.6.3/benchmark/
|
|
3072
3072
|
$ ruby bench.rb -n 10000 -m execute
|
|
3073
3073
|
*** ntimes=10000, testmode=execute
|
|
3074
3074
|
user system total real
|
data/lib/erubis.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
##
|
|
2
2
|
## $Rev: 99 $
|
|
3
|
-
## $Release: 2.6.
|
|
4
|
-
## copyright(c) 2006-
|
|
3
|
+
## $Release: 2.6.3 $
|
|
4
|
+
## copyright(c) 2006-2009 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.6.
|
|
51
|
+
VERSION = ('$Release: 2.6.3 $' =~ /([.\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
data/lib/erubis/local-setting.rb
CHANGED
data/lib/erubis/main.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
###
|
|
2
|
-
### $Rev:
|
|
3
|
-
### $Release: 2.6.
|
|
4
|
-
### copyright(c) 2006-
|
|
2
|
+
### $Rev: 122 $
|
|
3
|
+
### $Release: 2.6.3 $
|
|
4
|
+
### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
|
|
5
5
|
###
|
|
6
6
|
|
|
7
7
|
require 'yaml'
|
|
@@ -326,7 +326,7 @@ module Erubis
|
|
|
326
326
|
elsif arg_required.include?(optchar)
|
|
327
327
|
arg = optstr.empty? ? argv.shift : optstr
|
|
328
328
|
unless arg
|
|
329
|
-
mesg = "-#{optchar
|
|
329
|
+
mesg = "-#{optchar}: #{@option_names[optchar]} required."
|
|
330
330
|
raise CommandOptionError.new(mesg)
|
|
331
331
|
end
|
|
332
332
|
options[optchar] = arg
|
|
@@ -336,7 +336,7 @@ module Erubis
|
|
|
336
336
|
options[optchar] = arg
|
|
337
337
|
optstr = nil
|
|
338
338
|
else
|
|
339
|
-
raise CommandOptionError.new("-#{optchar
|
|
339
|
+
raise CommandOptionError.new("-#{optchar}: unknown option.")
|
|
340
340
|
end
|
|
341
341
|
end
|
|
342
342
|
end
|
|
@@ -395,11 +395,12 @@ module Erubis
|
|
|
395
395
|
enhancers = []
|
|
396
396
|
shortname = nil
|
|
397
397
|
begin
|
|
398
|
-
enhancer_names.split(/,/).each do |
|
|
398
|
+
enhancer_names.split(/,/).each do |name|
|
|
399
|
+
shortname = name
|
|
399
400
|
enhancers << Erubis.const_get("#{shortname}Enhancer")
|
|
400
401
|
end
|
|
401
402
|
rescue NameError
|
|
402
|
-
raise CommandOptionError.new("#{shortname}: no such Enhancer (try '-
|
|
403
|
+
raise CommandOptionError.new("#{shortname}: no such Enhancer (try '-h' to show all enhancers).")
|
|
403
404
|
end
|
|
404
405
|
return enhancers
|
|
405
406
|
end
|
data/lib/erubis/preprocessing.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,7 +1,7 @@
|
|
|
1
1
|
##
|
|
2
|
-
## $Rev:
|
|
3
|
-
## $Release: 2.6.
|
|
4
|
-
## $Date:
|
|
2
|
+
## $Rev: 122 $
|
|
3
|
+
## $Release: 2.6.3 $
|
|
4
|
+
## $Date: 2009-02-07 18:10:01 +0900 (Sat, 07 Feb 2009) $
|
|
5
5
|
##
|
|
6
6
|
|
|
7
7
|
require "#{File.dirname(__FILE__)}/test.rb"
|
|
@@ -152,17 +152,8 @@ END
|
|
|
152
152
|
end
|
|
153
153
|
File.open(@filename, 'w') { |f| f.write(@input) } if @filename
|
|
154
154
|
begin
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
#else
|
|
158
|
-
# command = "ruby #{$script} #{@options} #{@filename}"
|
|
159
|
-
#end
|
|
160
|
-
#output = `#{command}`
|
|
161
|
-
if @options.is_a?(Array)
|
|
162
|
-
argv = @options + [ @filename ]
|
|
163
|
-
else
|
|
164
|
-
argv = "#{@options} #{@filename}".split
|
|
165
|
-
end
|
|
155
|
+
argv = @options.is_a?(Array) ? @options.dup : @options.split
|
|
156
|
+
argv << @filename if @filename
|
|
166
157
|
$stdout = output = StringWriter.new
|
|
167
158
|
Erubis::Main.new.execute(argv)
|
|
168
159
|
ensure
|
|
@@ -172,6 +163,12 @@ END
|
|
|
172
163
|
assert_text_equal(@expected, output)
|
|
173
164
|
end
|
|
174
165
|
|
|
166
|
+
def _error_test(errclass, errmsg)
|
|
167
|
+
ex = assert_raise(errclass) { _test() }
|
|
168
|
+
assert_equal(errmsg, ex.message)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
|
|
175
172
|
def test_help # -h
|
|
176
173
|
@options = '-h'
|
|
177
174
|
m = Erubis::Main.new
|
|
@@ -182,7 +179,7 @@ END
|
|
|
182
179
|
|
|
183
180
|
def test_version # -v
|
|
184
181
|
@options = '-v'
|
|
185
|
-
@expected = (("$Release: 2.6.
|
|
182
|
+
@expected = (("$Release: 2.6.3 $" =~ /[.\d]+/) && $&) + "\n"
|
|
186
183
|
@filename = false
|
|
187
184
|
_test()
|
|
188
185
|
end
|
|
@@ -242,7 +239,7 @@ END
|
|
|
242
239
|
-:7: syntax error, unexpected $end, expecting ')'
|
|
243
240
|
END
|
|
244
241
|
errmsgs << <<'END'
|
|
245
|
-
7: syntax error, unexpected $end, expecting keyword_end
|
|
242
|
+
7: syntax error, unexpected $end, expecting keyword_end
|
|
246
243
|
END
|
|
247
244
|
else
|
|
248
245
|
errmsgs << <<'END'
|
|
@@ -617,6 +614,36 @@ END
|
|
|
617
614
|
end
|
|
618
615
|
|
|
619
616
|
|
|
617
|
+
def test_invalid_option # -1 (invalid option)
|
|
618
|
+
@input = INPUT
|
|
619
|
+
@options = '-1'
|
|
620
|
+
_error_test(Erubis::CommandOptionError, "-1: unknown option.")
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
def test_invalid_enhancer # -E hoge
|
|
625
|
+
@options = '-E hoge'
|
|
626
|
+
errmsg = "hoge: no such Enhancer (try '-h' to show all enhancers)."
|
|
627
|
+
_error_test(Erubis::CommandOptionError, errmsg)
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def test_invalid_lang # -l hoge
|
|
632
|
+
@options = '-l hoge'
|
|
633
|
+
errmsg = "-l hoge: invalid language name (class Erubis::Ehoge not found)."
|
|
634
|
+
_error_test(Erubis::CommandOptionError, errmsg)
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
def test_missing_argument # -E
|
|
639
|
+
@filename = false
|
|
640
|
+
@options = '-E'
|
|
641
|
+
_error_test(Erubis::CommandOptionError, "-E: enhancers required.")
|
|
642
|
+
@options = '-l'
|
|
643
|
+
_error_test(Erubis::CommandOptionError, "-l: lang required.")
|
|
644
|
+
end
|
|
645
|
+
|
|
646
|
+
|
|
620
647
|
def test_pi1 # --pi -x
|
|
621
648
|
@input = PI_INPUT
|
|
622
649
|
@expected = PI_SRC
|