erubis 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/CHANGES.txt +16 -2
  2. data/README.txt +2 -1
  3. data/benchmark/bench.rb +1 -1
  4. data/bin/erubis +1 -1
  5. data/contrib/erubis +1 -1
  6. data/contrib/inline-require +1 -1
  7. data/doc-api/classes/Erubis.html +1 -1
  8. data/doc-api/classes/Erubis/Basic/Converter.html +3 -2
  9. data/doc-api/classes/Erubis/BiPatternEnhancer.html +6 -3
  10. data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
  11. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +6 -3
  12. data/doc-api/classes/Erubis/InterpolationEnhancer.html +7 -6
  13. data/doc-api/classes/Erubis/Main.html +26 -26
  14. data/doc-api/classes/Erubis/PI/Converter.html +5 -4
  15. data/doc-api/classes/Erubis/PI/TinyEruby.html +6 -5
  16. data/doc-api/classes/Erubis/PercentLineEnhancer.html +3 -2
  17. data/doc-api/classes/Erubis/RubyEvaluator.html +18 -13
  18. data/doc-api/classes/Erubis/SimplifyEnhancer.html +2 -1
  19. data/doc-api/classes/Erubis/TinyEruby.html +4 -3
  20. data/doc-api/created.rid +1 -1
  21. data/doc-api/files/README_txt.html +4 -3
  22. data/doc-api/files/erubis/context_rb.html +1 -1
  23. data/doc-api/files/erubis/converter_rb.html +2 -2
  24. data/doc-api/files/erubis/engine/ec_rb.html +1 -1
  25. data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
  26. data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
  27. data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
  28. data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
  29. data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
  30. data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
  31. data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
  32. data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
  33. data/doc-api/files/erubis/engine_rb.html +1 -1
  34. data/doc-api/files/erubis/enhancer_rb.html +2 -2
  35. data/doc-api/files/erubis/error_rb.html +1 -1
  36. data/doc-api/files/erubis/evaluator_rb.html +2 -2
  37. data/doc-api/files/erubis/generator_rb.html +1 -1
  38. data/doc-api/files/erubis/helper_rb.html +1 -1
  39. data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +1 -1
  40. data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
  41. data/doc-api/files/erubis/local-setting_rb.html +1 -1
  42. data/doc-api/files/erubis/main_rb.html +2 -2
  43. data/doc-api/files/erubis/preprocessing_rb.html +1 -1
  44. data/doc-api/files/erubis/tiny_rb.html +2 -2
  45. data/doc-api/files/erubis_rb.html +1 -1
  46. data/doc/users-guide.html +13 -11
  47. data/lib/erubis.rb +2 -2
  48. data/lib/erubis/context.rb +1 -1
  49. data/lib/erubis/converter.rb +6 -4
  50. data/lib/erubis/engine.rb +1 -1
  51. data/lib/erubis/engine/ec.rb +1 -1
  52. data/lib/erubis/engine/ejava.rb +1 -1
  53. data/lib/erubis/engine/ejavascript.rb +1 -1
  54. data/lib/erubis/engine/enhanced.rb +1 -1
  55. data/lib/erubis/engine/eperl.rb +1 -1
  56. data/lib/erubis/engine/ephp.rb +1 -1
  57. data/lib/erubis/engine/eruby.rb +1 -1
  58. data/lib/erubis/engine/escheme.rb +1 -1
  59. data/lib/erubis/engine/optimized.rb +1 -1
  60. data/lib/erubis/enhancer.rb +16 -7
  61. data/lib/erubis/error.rb +1 -1
  62. data/lib/erubis/evaluator.rb +17 -12
  63. data/lib/erubis/generator.rb +1 -1
  64. data/lib/erubis/helper.rb +1 -1
  65. data/lib/erubis/helpers/rails_form_helper.rb +1 -1
  66. data/lib/erubis/helpers/rails_helper.rb +1 -1
  67. data/lib/erubis/local-setting.rb +1 -1
  68. data/lib/erubis/main.rb +32 -31
  69. data/lib/erubis/preprocessing.rb +1 -1
  70. data/lib/erubis/tiny.rb +6 -4
  71. data/test/assert-text-equal.rb +1 -1
  72. data/test/assert-text-equal.rbc +0 -0
  73. data/test/data/users-guide/example1.rb +1 -0
  74. data/test/data/users-guide/main_program2.result +1 -1
  75. data/test/hoge.rb +5 -0
  76. data/test/test-engines.rb +5 -2
  77. data/test/test-engines.rbc +0 -0
  78. data/test/test-enhancers.rb +4 -2
  79. data/test/test-erubis.rb +11 -5
  80. data/test/test-erubis.rbc +0 -0
  81. data/test/test-main.rb +27 -6
  82. data/test/test-users-guide.rb +4 -2
  83. data/test/test-users-guide.rbc +0 -0
  84. data/test/test.rb +1 -1
  85. data/test/test.rbc +0 -0
  86. data/test/testutil.rb +29 -3
  87. data/test/testutil.rbc +0 -0
  88. metadata +9 -4
  89. data/lib/erubis/converter.rb: +0 -0
  90. data/test/data/users-guide/stderr.log +0 -3
@@ -8,6 +8,7 @@ puts eruby.src # print script source
8
8
  puts "---------- result ----------"
9
9
  list = ['aaa', 'bbb', 'ccc']
10
10
  puts eruby.result(binding()) # get result
11
+ ## or puts eruby.result(:list=>list) # or pass Hash instead of Binding
11
12
 
12
13
  ## # or
13
14
  ## eruby = Erubis::Eruby.new
@@ -2,5 +2,5 @@ $ ruby main_program2.rb
2
2
  item = foo
3
3
  item = bar
4
4
  item = baz
5
- ** debug: local variables=["x", "_buf"]
5
+ ** debug: local variables=["_context", "x", "_buf"]
6
6
  ** debug: x=1
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% for item in list %>
3
+ <li><%= item[:name]] %></li>
4
+ <% end %>
5
+ </ul>
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 95 $
3
- ## $Release: 2.6.1 $
2
+ ## $Rev: 115 $
3
+ ## $Release: 2.6.2 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -29,6 +29,9 @@ class EnginesTest < Test::Unit::TestCase
29
29
  assert_text_equal(@expected, actual)
30
30
  end
31
31
 
32
+
33
+ self.post_definition()
34
+
32
35
  end
33
36
 
34
37
  __END__
Binary file
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 93 $
3
- ## $Release: 2.6.1 $
2
+ ## $Rev: 115 $
3
+ ## $Release: 2.6.2 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -98,6 +98,8 @@ class EnhancersTest < Test::Unit::TestCase
98
98
  end
99
99
 
100
100
 
101
+ self.post_definition()
102
+
101
103
  end
102
104
 
103
105
  __END__
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 104 $
3
- ## $Release: 2.6.1 $
2
+ ## $Rev: 115 $
3
+ ## $Release: 2.6.2 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -157,12 +157,16 @@ END
157
157
  class Dummy
158
158
  end
159
159
 
160
+ def _class_has_instance_method(klass, method)
161
+ return klass.instance_methods.collect{|m| m.to_s}.include?(method.to_s)
162
+ end
163
+
160
164
  def test_def_method1
161
165
  s = "<%for i in list%>i=<%=i%>\n<%end%>"
162
166
  eruby = Erubis::Eruby.new(s)
163
- assert(! Dummy.instance_methods.include?('render'))
167
+ assert(! _class_has_instance_method(Dummy, 'render'))
164
168
  eruby.def_method(Dummy, 'render(list)', 'foo.rhtml')
165
- assert(Dummy.instance_methods.include?('render'))
169
+ assert(_class_has_instance_method(Dummy, 'render'))
166
170
  actual = Dummy.new().render(%w[1 2 3])
167
171
  assert_equal("i=1\ni=2\ni=3\n", actual)
168
172
  end
@@ -175,7 +179,7 @@ END
175
179
  assert eruby.respond_to?(:render)
176
180
  actual = eruby.render([1, 2, 3])
177
181
  assert_equal("i=1\ni=2\ni=3\n", actual)
178
- assert !(eruby.class.instance_methods.include? :render)
182
+ assert(! _class_has_instance_method(eruby.class, 'render'))
179
183
  end
180
184
 
181
185
  def test_evaluate_creates_proc
@@ -203,6 +207,8 @@ END
203
207
  # puts "*** actual=#{actual.inspect}, x=#{_x.inspect}, y=#{_y.inspect}"
204
208
  #end
205
209
 
210
+ self.post_definition()
211
+
206
212
  end
207
213
 
208
214
  x = 10
Binary file
@@ -1,7 +1,7 @@
1
1
  ##
2
- ## $Rev: 87 $
3
- ## $Release: 2.6.1 $
4
- ## $Date: 2007-07-12 05:01:24 +0900 (Thu, 12 Jul 2007) $
2
+ ## $Rev: 116 $
3
+ ## $Release: 2.6.2 $
4
+ ## $Date: 2008-06-12 21:08:47 +0900 (Thu, 12 Jun 2008) $
5
5
  ##
6
6
 
7
7
  require "#{File.dirname(__FILE__)}/test.rb"
@@ -22,6 +22,9 @@ class StringWriter < String
22
22
  def write(arg)
23
23
  self << arg
24
24
  end
25
+ def flush(*args)
26
+ # pass
27
+ end
25
28
  end
26
29
 
27
30
  class Erubis::Main
@@ -144,6 +147,7 @@ END
144
147
  end
145
148
  if @filename.nil?
146
149
  method = (caller[0] =~ /in `(.*)'/) && $1 #'
150
+ method =~ /block in (.*)/ and method = $1 # for Ruby 1.9
147
151
  @filename = "tmp.#{method}"
148
152
  end
149
153
  File.open(@filename, 'w') { |f| f.write(@input) } if @filename
@@ -178,7 +182,7 @@ END
178
182
 
179
183
  def test_version # -v
180
184
  @options = '-v'
181
- @expected = (("$Release: 2.6.1 $" =~ /[.\d]+/) && $&) + "\n"
185
+ @expected = (("$Release: 2.6.2 $" =~ /[.\d]+/) && $&) + "\n"
182
186
  @filename = false
183
187
  _test()
184
188
  end
@@ -227,7 +231,21 @@ END
227
231
  basename = 'tmp.test_syntax2_%d.rhtml'
228
232
  filenames = [ basename % 0, basename % 1 ]
229
233
  errmsgs = []
230
- errmsgs << <<'END'
234
+ if ruby19?
235
+ errmsgs << <<'END'
236
+ 3: syntax error, unexpected ']', expecting ')'
237
+ _buf << ' <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
238
+ ^
239
+ -:4: syntax error, unexpected keyword_end, expecting ')'
240
+ '; end
241
+ ^
242
+ -:7: syntax error, unexpected $end, expecting ')'
243
+ END
244
+ errmsgs << <<'END'
245
+ 7: syntax error, unexpected $end, expecting keyword_end or keyword_endfor
246
+ END
247
+ else
248
+ errmsgs << <<'END'
231
249
  3: syntax error, unexpected ']', expecting ')'
232
250
  _buf << ' <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
233
251
  ^
@@ -236,9 +254,10 @@ END
236
254
  ^
237
255
  -:7: syntax error, unexpected $end, expecting ')'
238
256
  END
239
- errmsgs << <<'END'
257
+ errmsgs << <<'END'
240
258
  7: syntax error, unexpected $end, expecting kEND
241
259
  END
260
+ end
242
261
  #
243
262
  max = inputs.length
244
263
  (0...max).each do |i|
@@ -650,4 +669,6 @@ END
650
669
  end
651
670
 
652
671
 
672
+ self.post_definition()
673
+
653
674
  end
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Rev: 77 $
3
- ### $Release: 2.6.1 $
2
+ ### $Rev: 115 $
3
+ ### $Release: 2.6.2 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
@@ -53,4 +53,6 @@ class KwarkUsersGuideTest < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
 
56
+ self.post_definition()
57
+
56
58
  end
Binary file
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 77 $
3
- ## $Release: 2.6.1 $
3
+ ## $Release: 2.6.2 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
Binary file
@@ -1,6 +1,6 @@
1
1
  ###
2
- ### $Rev: 77 $
3
- ### $Release: 2.6.1 $
2
+ ### $Rev: 116 $
3
+ ### $Release: 2.6.2 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
@@ -9,6 +9,21 @@ require 'yaml'
9
9
  require 'test/unit/testcase'
10
10
 
11
11
 
12
+
13
+ def _ruby_ver_str # :nodoc:
14
+ return /\d+\.\d+/.match(RUBY_VERSION)[0]
15
+ end
16
+
17
+ def ruby18? # :nodoc:
18
+ _ruby_ver_str() == "1.8"
19
+ end
20
+
21
+ def ruby19? # :nodoc:
22
+ _ruby_ver_str() > "1.8"
23
+ end
24
+
25
+
26
+
12
27
  class Test::Unit::TestCase
13
28
 
14
29
 
@@ -21,7 +36,7 @@ class Test::Unit::TestCase
21
36
  end
22
37
  # untabify
23
38
  unless options[:tabify] == false
24
- s = s.inject('') do |sb, line|
39
+ s = s.split(/^/).inject('') do |sb, line|
25
40
  sb << line.gsub(/([^\t]{8})|([^\t]*)\t/n) { [$+].pack("A8") }
26
41
  end
27
42
  end
@@ -72,4 +87,15 @@ class Test::Unit::TestCase
72
87
  end
73
88
 
74
89
 
90
+ def self.post_definition
91
+ if ENV['TEST']
92
+ target = "test_#{ENV['TEST']}"
93
+ self.instance_methods.each do |method_name|
94
+ m = method_name.to_s
95
+ private m if m =~ /\Atest_/ && m != target
96
+ end
97
+ end
98
+ end
99
+
100
+
75
101
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erubis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - makoto kuwata
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-06 00:00:00 +09:00
12
+ date: 2008-06-13 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,6 @@ files:
33
33
  - lib/erubis
34
34
  - lib/erubis/context.rb
35
35
  - lib/erubis/converter.rb
36
- - "lib/erubis/converter.rb:"
37
36
  - lib/erubis/engine
38
37
  - lib/erubis/engine/ec.rb
39
38
  - lib/erubis/engine/ejava.rb
@@ -78,6 +77,7 @@ files:
78
77
  - examples/pi/example.escheme
79
78
  - examples/pi/Makefile
80
79
  - test/assert-text-equal.rb
80
+ - test/assert-text-equal.rbc
81
81
  - test/data
82
82
  - test/data/users-guide
83
83
  - test/data/users-guide/array_example.result
@@ -177,20 +177,25 @@ files:
177
177
  - test/data/users-guide/printenabled-example.rb
178
178
  - test/data/users-guide/printstatement_example.result
179
179
  - test/data/users-guide/simplify_example.result
180
- - test/data/users-guide/stderr.log
181
180
  - test/data/users-guide/stdout_exmple.result
182
181
  - test/data/users-guide/stringbuffer_example.result
183
182
  - test/data/users-guide/tail_260.result
184
183
  - test/data/users-guide/tailnewline.rhtml
185
184
  - test/data/users-guide/template1.rhtml
186
185
  - test/data/users-guide/template2.rhtml
186
+ - test/hoge.rb
187
187
  - test/test-engines.rb
188
+ - test/test-engines.rbc
188
189
  - test/test-enhancers.rb
189
190
  - test/test-erubis.rb
191
+ - test/test-erubis.rbc
190
192
  - test/test-main.rb
191
193
  - test/test-users-guide.rb
194
+ - test/test-users-guide.rbc
192
195
  - test/test.rb
196
+ - test/test.rbc
193
197
  - test/testutil.rb
198
+ - test/testutil.rbc
194
199
  - doc/docstyle.css
195
200
  - doc/users-guide.html
196
201
  - README.txt
File without changes
@@ -1,3 +0,0 @@
1
- *** debug: item="<aaa>"
2
- *** debug: item="b&b"
3
- *** debug: item="\"ccc\""