simple-templater 0.0.1.4 → 0.0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (917) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +5 -2
  3. data/LICENSE +1 -1
  4. data/bin/simple-templater +10 -6
  5. data/gems/cache/nake-0.0.8.gem +0 -0
  6. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  7. data/lib/simple-templater/builder.rb +5 -5
  8. data/lib/simple-templater/generator.rb +4 -4
  9. data/lib/simple-templater/helpers.rb +2 -2
  10. data/lib/simple-templater/hooks/hook.rb +2 -2
  11. data/lib/simple-templater.rb +8 -0
  12. data/simple-templater.gemspec +15 -4
  13. data/spec/simple-templater/hooks/hook_spec.rb +0 -1
  14. data/spec/simple-templater/hooks/postprocess/git_repository_spec.rb +0 -1
  15. data/spec/spec_helper.rb +33 -0
  16. data/spec/stubs/test_generator/test_generator.gemspec +1 -1
  17. data/stubs/project/content/%name%.gemspec.rbt +16 -6
  18. data/stubs/project/content/%name%.pre.gemspec.rbt +8 -0
  19. data/stubs/project/content/.gitignore +12 -0
  20. data/stubs/project/content/CHANGELOG +1 -1
  21. data/stubs/project/content/Gemfile +8 -0
  22. data/stubs/project/content/README.textile.rbt +2 -2
  23. data/stubs/project/content/bin/%name%.rbt +1 -0
  24. data/{gems/gems/rspec-1.2.9/spec/spec/runner/empty_file.txt → stubs/project/content/examples/.gitignore} +0 -0
  25. data/{gems/gems/rspec-1.2.9/spec/spec/runner/resources/a_bar.rb → stubs/project/content/lib/%name%/.gitignore} +0 -0
  26. data/stubs/project/content/lib/%name%/version.rb.rbt +5 -0
  27. data/stubs/project/content/lib/%name%.rb.rbt +0 -1
  28. data/{gems/gems/rspec-1.2.9/spec/spec/runner/resources/a_foo.rb → stubs/project/content/spec/%name%/.gitignore} +0 -0
  29. data/stubs/project/content/tasks/%name%.nake +0 -0
  30. data/stubs/project/content/tasks.rb.rbt +37 -0
  31. data/stubs/stub/content/content/.gitignore +0 -0
  32. data/tasks.rb +37 -0
  33. metadata +48 -904
  34. data/Rakefile +0 -29
  35. data/gems/environment.rb +0 -107
  36. data/gems/gems/abstract-1.0.0/ChangeLog +0 -3
  37. data/gems/gems/abstract-1.0.0/README.txt +0 -57
  38. data/gems/gems/abstract-1.0.0/abstract.gemspec +0 -48
  39. data/gems/gems/abstract-1.0.0/lib/abstract.rb +0 -75
  40. data/gems/gems/abstract-1.0.0/setup.rb +0 -1331
  41. data/gems/gems/abstract-1.0.0/test/test.rb +0 -91
  42. data/gems/gems/erubis-2.6.5/CHANGES.txt +0 -744
  43. data/gems/gems/erubis-2.6.5/MIT-LICENSE +0 -20
  44. data/gems/gems/erubis-2.6.5/README.txt +0 -102
  45. data/gems/gems/erubis-2.6.5/benchmark/Makefile +0 -6
  46. data/gems/gems/erubis-2.6.5/benchmark/bench.rb +0 -313
  47. data/gems/gems/erubis-2.6.5/benchmark/bench_context.yaml +0 -141
  48. data/gems/gems/erubis-2.6.5/benchmark/templates/_footer.html +0 -4
  49. data/gems/gems/erubis-2.6.5/benchmark/templates/_header.html +0 -52
  50. data/gems/gems/erubis-2.6.5/benchmark/templates/bench_erb.rhtml +0 -29
  51. data/gems/gems/erubis-2.6.5/benchmark/templates/bench_erubis.rhtml +0 -29
  52. data/gems/gems/erubis-2.6.5/benchmark/templates/bench_eruby.rhtml +0 -29
  53. data/gems/gems/erubis-2.6.5/bin/erubis +0 -10
  54. data/gems/gems/erubis-2.6.5/contrib/erubis +0 -3330
  55. data/gems/gems/erubis-2.6.5/contrib/erubis-run.rb +0 -132
  56. data/gems/gems/erubis-2.6.5/contrib/inline-require +0 -179
  57. data/gems/gems/erubis-2.6.5/doc/docstyle.css +0 -188
  58. data/gems/gems/erubis-2.6.5/doc/users-guide.html +0 -3285
  59. data/gems/gems/erubis-2.6.5/doc-api/classes/ActionView/TemplateHandlers/ErubisHandler.html +0 -209
  60. data/gems/gems/erubis-2.6.5/doc-api/classes/ActionView.html +0 -105
  61. data/gems/gems/erubis-2.6.5/doc-api/classes/ERB.html +0 -101
  62. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ArrayBufferEnhancer.html +0 -175
  63. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ArrayBufferEruby.html +0 -120
  64. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ArrayEnhancer.html +0 -174
  65. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ArrayEruby.html +0 -120
  66. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Basic/Converter.html +0 -327
  67. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Basic/Engine.html +0 -130
  68. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Basic.html +0 -112
  69. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/BiPatternEnhancer.html +0 -215
  70. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/BiPatternEruby.html +0 -120
  71. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/CGenerator.html +0 -386
  72. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/CommandOptionError.html +0 -113
  73. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Context.html +0 -344
  74. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Converter.html +0 -283
  75. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/DeleteIndentEnhancer.html +0 -150
  76. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/DeleteIndentEruby.html +0 -120
  77. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Ec.html +0 -126
  78. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Ejava.html +0 -126
  79. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Ejavascript.html +0 -126
  80. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Engine.html +0 -305
  81. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Eperl.html +0 -126
  82. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Ephp.html +0 -126
  83. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ErboutEnhancer.html +0 -175
  84. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ErboutEruby.html +0 -120
  85. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/ErubisError.html +0 -117
  86. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Eruby.html +0 -132
  87. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapeEnhancer.html +0 -165
  88. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEc.html +0 -120
  89. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEjava.html +0 -120
  90. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEjavascript.html +0 -120
  91. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEperl.html +0 -120
  92. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEphp.html +0 -120
  93. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEruby.html +0 -127
  94. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/EscapedEscheme.html +0 -120
  95. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Escheme.html +0 -126
  96. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Evaluator.html +0 -212
  97. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/FastEruby.html +0 -131
  98. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Generator.html +0 -416
  99. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/HeaderFooterEnhancer.html +0 -267
  100. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/HeaderFooterEruby.html +0 -120
  101. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +0 -787
  102. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +0 -213
  103. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Helpers/RailsHelper.html +0 -349
  104. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Helpers.html +0 -116
  105. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/InterpolationEnhancer.html +0 -306
  106. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/InterpolationEruby.html +0 -120
  107. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/JavaGenerator.html +0 -359
  108. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/JavascriptGenerator.html +0 -386
  109. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/Main.html +0 -341
  110. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/NoCodeEnhancer.html +0 -249
  111. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/NoCodeEruby.html +0 -120
  112. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/NoTextEnhancer.html +0 -159
  113. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/NoTextEruby.html +0 -120
  114. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/NotSupportedError.html +0 -119
  115. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/OptimizedEruby.html +0 -163
  116. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/OptimizedGenerator.html +0 -439
  117. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/OptimizedXmlEruby.html +0 -163
  118. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Converter.html +0 -266
  119. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Ec.html +0 -166
  120. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Ejava.html +0 -166
  121. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Ejavascript.html +0 -166
  122. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Engine.html +0 -122
  123. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Eperl.html +0 -166
  124. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Ephp.html +0 -166
  125. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Eruby.html +0 -155
  126. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/Escheme.html +0 -166
  127. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI/TinyEruby.html +0 -293
  128. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PI.html +0 -124
  129. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PercentLineEnhancer.html +0 -179
  130. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PercentLineEruby.html +0 -120
  131. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PerlGenerator.html +0 -344
  132. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PhpGenerator.html +0 -350
  133. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PreprocessingEruby.html +0 -183
  134. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PreprocessingHelper.html +0 -212
  135. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PrintEnabledEnhancer.html +0 -212
  136. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PrintEnabledEruby.html +0 -120
  137. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PrintOutEnhancer.html +0 -244
  138. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PrintOutEruby.html +0 -120
  139. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/PrintOutSimplifiedEruby.html +0 -121
  140. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/RubyEvaluator.html +0 -227
  141. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/RubyGenerator.html +0 -327
  142. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/SchemeGenerator.html +0 -382
  143. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/SimplifiedEruby.html +0 -120
  144. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/SimplifyEnhancer.html +0 -191
  145. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StdoutEnhancer.html +0 -173
  146. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StdoutEruby.html +0 -120
  147. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StdoutSimplifiedEruby.html +0 -121
  148. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StringBufferEnhancer.html +0 -174
  149. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StringBufferEruby.html +0 -120
  150. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/StringIOEruby.html +0 -120
  151. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/TinyEruby.html +0 -298
  152. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/XmlEruby.html +0 -130
  153. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis/XmlHelper.html +0 -255
  154. data/gems/gems/erubis-2.6.5/doc-api/classes/Erubis.html +0 -353
  155. data/gems/gems/erubis-2.6.5/doc-api/created.rid +0 -1
  156. data/gems/gems/erubis-2.6.5/doc-api/files/README_txt.html +0 -247
  157. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/context_rb.html +0 -107
  158. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/converter_rb.html +0 -114
  159. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/ec_rb.html +0 -115
  160. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/ejava_rb.html +0 -115
  161. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/ejavascript_rb.html +0 -115
  162. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/enhanced_rb.html +0 -115
  163. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/eperl_rb.html +0 -115
  164. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/ephp_rb.html +0 -115
  165. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/eruby_rb.html +0 -115
  166. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/escheme_rb.html +0 -115
  167. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine/optimized_rb.html +0 -114
  168. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/engine_rb.html +0 -117
  169. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/enhancer_rb.html +0 -107
  170. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/error_rb.html +0 -107
  171. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/evaluator_rb.html +0 -115
  172. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/generator_rb.html +0 -114
  173. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/helper_rb.html +0 -107
  174. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/helpers/rails_form_helper_rb.html +0 -107
  175. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/helpers/rails_helper_rb.html +0 -116
  176. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/local-setting_rb.html +0 -107
  177. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/main_rb.html +0 -127
  178. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/preprocessing_rb.html +0 -114
  179. data/gems/gems/erubis-2.6.5/doc-api/files/erubis/tiny_rb.html +0 -107
  180. data/gems/gems/erubis-2.6.5/doc-api/files/erubis_rb.html +0 -118
  181. data/gems/gems/erubis-2.6.5/doc-api/fr_class_index.html +0 -122
  182. data/gems/gems/erubis-2.6.5/doc-api/fr_file_index.html +0 -51
  183. data/gems/gems/erubis-2.6.5/doc-api/fr_method_index.html +0 -251
  184. data/gems/gems/erubis-2.6.5/doc-api/index.html +0 -24
  185. data/gems/gems/erubis-2.6.5/doc-api/rdoc-style.css +0 -208
  186. data/gems/gems/erubis-2.6.5/examples/basic/Makefile +0 -53
  187. data/gems/gems/erubis-2.6.5/examples/basic/example.ec +0 -42
  188. data/gems/gems/erubis-2.6.5/examples/basic/example.ejava +0 -45
  189. data/gems/gems/erubis-2.6.5/examples/basic/example.ejs +0 -16
  190. data/gems/gems/erubis-2.6.5/examples/basic/example.eperl +0 -16
  191. data/gems/gems/erubis-2.6.5/examples/basic/example.ephp +0 -17
  192. data/gems/gems/erubis-2.6.5/examples/basic/example.eruby +0 -15
  193. data/gems/gems/erubis-2.6.5/examples/basic/example.escheme +0 -26
  194. data/gems/gems/erubis-2.6.5/examples/pi/Makefile +0 -54
  195. data/gems/gems/erubis-2.6.5/examples/pi/example.ec +0 -42
  196. data/gems/gems/erubis-2.6.5/examples/pi/example.ejava +0 -45
  197. data/gems/gems/erubis-2.6.5/examples/pi/example.ejs +0 -16
  198. data/gems/gems/erubis-2.6.5/examples/pi/example.eperl +0 -16
  199. data/gems/gems/erubis-2.6.5/examples/pi/example.ephp +0 -17
  200. data/gems/gems/erubis-2.6.5/examples/pi/example.eruby +0 -15
  201. data/gems/gems/erubis-2.6.5/examples/pi/example.escheme +0 -26
  202. data/gems/gems/erubis-2.6.5/lib/erubis/context.rb +0 -83
  203. data/gems/gems/erubis-2.6.5/lib/erubis/converter.rb +0 -357
  204. data/gems/gems/erubis-2.6.5/lib/erubis/engine/ec.rb +0 -117
  205. data/gems/gems/erubis-2.6.5/lib/erubis/engine/ejava.rb +0 -110
  206. data/gems/gems/erubis-2.6.5/lib/erubis/engine/ejavascript.rb +0 -119
  207. data/gems/gems/erubis-2.6.5/lib/erubis/engine/enhanced.rb +0 -121
  208. data/gems/gems/erubis-2.6.5/lib/erubis/engine/eperl.rb +0 -95
  209. data/gems/gems/erubis-2.6.5/lib/erubis/engine/ephp.rb +0 -99
  210. data/gems/gems/erubis-2.6.5/lib/erubis/engine/eruby.rb +0 -124
  211. data/gems/gems/erubis-2.6.5/lib/erubis/engine/escheme.rb +0 -114
  212. data/gems/gems/erubis-2.6.5/lib/erubis/engine/optimized.rb +0 -127
  213. data/gems/gems/erubis-2.6.5/lib/erubis/engine.rb +0 -120
  214. data/gems/gems/erubis-2.6.5/lib/erubis/enhancer.rb +0 -680
  215. data/gems/gems/erubis-2.6.5/lib/erubis/error.rb +0 -23
  216. data/gems/gems/erubis-2.6.5/lib/erubis/evaluator.rb +0 -88
  217. data/gems/gems/erubis-2.6.5/lib/erubis/generator.rb +0 -85
  218. data/gems/gems/erubis-2.6.5/lib/erubis/helper.rb +0 -47
  219. data/gems/gems/erubis-2.6.5/lib/erubis/helpers/rails_form_helper.rb +0 -197
  220. data/gems/gems/erubis-2.6.5/lib/erubis/helpers/rails_helper.rb +0 -353
  221. data/gems/gems/erubis-2.6.5/lib/erubis/local-setting.rb +0 -9
  222. data/gems/gems/erubis-2.6.5/lib/erubis/main.rb +0 -489
  223. data/gems/gems/erubis-2.6.5/lib/erubis/preprocessing.rb +0 -58
  224. data/gems/gems/erubis-2.6.5/lib/erubis/tiny.rb +0 -144
  225. data/gems/gems/erubis-2.6.5/lib/erubis.rb +0 -72
  226. data/gems/gems/erubis-2.6.5/setup.rb +0 -1331
  227. data/gems/gems/erubis-2.6.5/test/assert-text-equal.rb +0 -44
  228. data/gems/gems/erubis-2.6.5/test/data/users-guide/Example.ejava +0 -55
  229. data/gems/gems/erubis-2.6.5/test/data/users-guide/array_example.result +0 -9
  230. data/gems/gems/erubis-2.6.5/test/data/users-guide/arraybuffer_example.result +0 -9
  231. data/gems/gems/erubis-2.6.5/test/data/users-guide/bipattern-example.rhtml +0 -4
  232. data/gems/gems/erubis-2.6.5/test/data/users-guide/bipattern_example.result +0 -6
  233. data/gems/gems/erubis-2.6.5/test/data/users-guide/context.rb +0 -6
  234. data/gems/gems/erubis-2.6.5/test/data/users-guide/context.yaml +0 -8
  235. data/gems/gems/erubis-2.6.5/test/data/users-guide/def_method.rb +0 -14
  236. data/gems/gems/erubis-2.6.5/test/data/users-guide/def_method.result +0 -3
  237. data/gems/gems/erubis-2.6.5/test/data/users-guide/escape_example.result +0 -9
  238. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.ec +0 -27
  239. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.ejs +0 -20
  240. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.eperl +0 -18
  241. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.ephp +0 -18
  242. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.eruby +0 -6
  243. data/gems/gems/erubis-2.6.5/test/data/users-guide/example.escheme +0 -28
  244. data/gems/gems/erubis-2.6.5/test/data/users-guide/example1.eruby +0 -6
  245. data/gems/gems/erubis-2.6.5/test/data/users-guide/example1.rb +0 -17
  246. data/gems/gems/erubis-2.6.5/test/data/users-guide/example1.result +0 -16
  247. data/gems/gems/erubis-2.6.5/test/data/users-guide/example10.rb +0 -4
  248. data/gems/gems/erubis-2.6.5/test/data/users-guide/example10.result +0 -17
  249. data/gems/gems/erubis-2.6.5/test/data/users-guide/example10.xhtml +0 -14
  250. data/gems/gems/erubis-2.6.5/test/data/users-guide/example10_x.result +0 -17
  251. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11.php +0 -20
  252. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11.result +0 -23
  253. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11.rhtml +0 -21
  254. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11_C.result +0 -10
  255. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11_N.result +0 -16
  256. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11_U.result +0 -16
  257. data/gems/gems/erubis-2.6.5/test/data/users-guide/example11_php.result +0 -15
  258. data/gems/gems/erubis-2.6.5/test/data/users-guide/example1_x.result +0 -9
  259. data/gems/gems/erubis-2.6.5/test/data/users-guide/example2.eruby +0 -7
  260. data/gems/gems/erubis-2.6.5/test/data/users-guide/example2.rb +0 -10
  261. data/gems/gems/erubis-2.6.5/test/data/users-guide/example2.result +0 -27
  262. data/gems/gems/erubis-2.6.5/test/data/users-guide/example2_trim.result +0 -10
  263. data/gems/gems/erubis-2.6.5/test/data/users-guide/example2_x.result +0 -10
  264. data/gems/gems/erubis-2.6.5/test/data/users-guide/example3.eruby +0 -6
  265. data/gems/gems/erubis-2.6.5/test/data/users-guide/example3.rb +0 -10
  266. data/gems/gems/erubis-2.6.5/test/data/users-guide/example31.result +0 -22
  267. data/gems/gems/erubis-2.6.5/test/data/users-guide/example32.result +0 -4
  268. data/gems/gems/erubis-2.6.5/test/data/users-guide/example3_e.result +0 -8
  269. data/gems/gems/erubis-2.6.5/test/data/users-guide/example4.eruby +0 -3
  270. data/gems/gems/erubis-2.6.5/test/data/users-guide/example4.rb +0 -11
  271. data/gems/gems/erubis-2.6.5/test/data/users-guide/example4.result +0 -10
  272. data/gems/gems/erubis-2.6.5/test/data/users-guide/example4_x.result +0 -5
  273. data/gems/gems/erubis-2.6.5/test/data/users-guide/example5.eruby +0 -6
  274. data/gems/gems/erubis-2.6.5/test/data/users-guide/example5.rb +0 -16
  275. data/gems/gems/erubis-2.6.5/test/data/users-guide/example5.result +0 -7
  276. data/gems/gems/erubis-2.6.5/test/data/users-guide/example6.rb +0 -12
  277. data/gems/gems/erubis-2.6.5/test/data/users-guide/example6.result +0 -7
  278. data/gems/gems/erubis-2.6.5/test/data/users-guide/example7.eruby +0 -8
  279. data/gems/gems/erubis-2.6.5/test/data/users-guide/example71.result +0 -13
  280. data/gems/gems/erubis-2.6.5/test/data/users-guide/example72.result +0 -13
  281. data/gems/gems/erubis-2.6.5/test/data/users-guide/example8.eruby +0 -6
  282. data/gems/gems/erubis-2.6.5/test/data/users-guide/example8_ruby.result +0 -7
  283. data/gems/gems/erubis-2.6.5/test/data/users-guide/example8_yaml.result +0 -7
  284. data/gems/gems/erubis-2.6.5/test/data/users-guide/example9.eruby +0 -3
  285. data/gems/gems/erubis-2.6.5/test/data/users-guide/example9.rb +0 -8
  286. data/gems/gems/erubis-2.6.5/test/data/users-guide/example9.result +0 -9
  287. data/gems/gems/erubis-2.6.5/test/data/users-guide/example91.result +0 -5
  288. data/gems/gems/erubis-2.6.5/test/data/users-guide/example92.result +0 -4
  289. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_c.result +0 -29
  290. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_java.result +0 -56
  291. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_js.result +0 -22
  292. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_perl.result +0 -20
  293. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_php.result +0 -19
  294. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_scheme.result +0 -30
  295. data/gems/gems/erubis-2.6.5/test/data/users-guide/example_scheme_display.result +0 -29
  296. data/gems/gems/erubis-2.6.5/test/data/users-guide/fasteruby.rb +0 -11
  297. data/gems/gems/erubis-2.6.5/test/data/users-guide/fasteruby.result +0 -38
  298. data/gems/gems/erubis-2.6.5/test/data/users-guide/fasteruby.rhtml +0 -15
  299. data/gems/gems/erubis-2.6.5/test/data/users-guide/headerfooter-example.eruby +0 -9
  300. data/gems/gems/erubis-2.6.5/test/data/users-guide/headerfooter-example2.rb +0 -8
  301. data/gems/gems/erubis-2.6.5/test/data/users-guide/headerfooter-example2.rhtml +0 -10
  302. data/gems/gems/erubis-2.6.5/test/data/users-guide/headerfooter_example.result +0 -11
  303. data/gems/gems/erubis-2.6.5/test/data/users-guide/headerfooter_example2.result +0 -13
  304. data/gems/gems/erubis-2.6.5/test/data/users-guide/interpolation_example.result +0 -9
  305. data/gems/gems/erubis-2.6.5/test/data/users-guide/main_program1.rb +0 -8
  306. data/gems/gems/erubis-2.6.5/test/data/users-guide/main_program1.result +0 -6
  307. data/gems/gems/erubis-2.6.5/test/data/users-guide/main_program2.rb +0 -8
  308. data/gems/gems/erubis-2.6.5/test/data/users-guide/main_program2.result +0 -6
  309. data/gems/gems/erubis-2.6.5/test/data/users-guide/nocode-example.eruby +0 -14
  310. data/gems/gems/erubis-2.6.5/test/data/users-guide/nocode-php.result +0 -20
  311. data/gems/gems/erubis-2.6.5/test/data/users-guide/nocode_example.result +0 -15
  312. data/gems/gems/erubis-2.6.5/test/data/users-guide/normal-eruby-test.eruby +0 -9
  313. data/gems/gems/erubis-2.6.5/test/data/users-guide/normal_eruby_test.result +0 -11
  314. data/gems/gems/erubis-2.6.5/test/data/users-guide/notext-example.eruby +0 -14
  315. data/gems/gems/erubis-2.6.5/test/data/users-guide/notext-example.php +0 -19
  316. data/gems/gems/erubis-2.6.5/test/data/users-guide/notext-php.result +0 -20
  317. data/gems/gems/erubis-2.6.5/test/data/users-guide/notext_example.result +0 -16
  318. data/gems/gems/erubis-2.6.5/test/data/users-guide/percentline-example.rhtml +0 -4
  319. data/gems/gems/erubis-2.6.5/test/data/users-guide/percentline_example.result +0 -7
  320. data/gems/gems/erubis-2.6.5/test/data/users-guide/printenable_example.result +0 -4
  321. data/gems/gems/erubis-2.6.5/test/data/users-guide/printenabled-example.eruby +0 -3
  322. data/gems/gems/erubis-2.6.5/test/data/users-guide/printenabled-example.rb +0 -8
  323. data/gems/gems/erubis-2.6.5/test/data/users-guide/printstatement_example.result +0 -8
  324. data/gems/gems/erubis-2.6.5/test/data/users-guide/simplify_example.result +0 -9
  325. data/gems/gems/erubis-2.6.5/test/data/users-guide/stderr.log +0 -3
  326. data/gems/gems/erubis-2.6.5/test/data/users-guide/stdout_exmple.result +0 -9
  327. data/gems/gems/erubis-2.6.5/test/data/users-guide/stringbuffer_example.result +0 -9
  328. data/gems/gems/erubis-2.6.5/test/data/users-guide/tail_260.result +0 -4
  329. data/gems/gems/erubis-2.6.5/test/data/users-guide/tailnewline.rhtml +0 -3
  330. data/gems/gems/erubis-2.6.5/test/data/users-guide/template1.rhtml +0 -4
  331. data/gems/gems/erubis-2.6.5/test/data/users-guide/template2.rhtml +0 -4
  332. data/gems/gems/erubis-2.6.5/test/test-engines.rb +0 -369
  333. data/gems/gems/erubis-2.6.5/test/test-enhancers.rb +0 -570
  334. data/gems/gems/erubis-2.6.5/test/test-erubis.rb +0 -883
  335. data/gems/gems/erubis-2.6.5/test/test-main.rb +0 -721
  336. data/gems/gems/erubis-2.6.5/test/test-users-guide.rb +0 -57
  337. data/gems/gems/erubis-2.6.5/test/test.rb +0 -29
  338. data/gems/gems/erubis-2.6.5/test/testutil.rb +0 -96
  339. data/gems/gems/haml-2.2.16/CONTRIBUTING +0 -4
  340. data/gems/gems/haml-2.2.16/MIT-LICENSE +0 -20
  341. data/gems/gems/haml-2.2.16/README.md +0 -357
  342. data/gems/gems/haml-2.2.16/REVISION +0 -1
  343. data/gems/gems/haml-2.2.16/Rakefile +0 -392
  344. data/gems/gems/haml-2.2.16/VERSION +0 -1
  345. data/gems/gems/haml-2.2.16/VERSION_NAME +0 -1
  346. data/gems/gems/haml-2.2.16/bin/css2sass +0 -7
  347. data/gems/gems/haml-2.2.16/bin/haml +0 -9
  348. data/gems/gems/haml-2.2.16/bin/html2haml +0 -7
  349. data/gems/gems/haml-2.2.16/bin/sass +0 -8
  350. data/gems/gems/haml-2.2.16/extra/haml-mode.el +0 -662
  351. data/gems/gems/haml-2.2.16/extra/sass-mode.el +0 -206
  352. data/gems/gems/haml-2.2.16/extra/update_watch.rb +0 -13
  353. data/gems/gems/haml-2.2.16/init.rb +0 -16
  354. data/gems/gems/haml-2.2.16/lib/haml/buffer.rb +0 -302
  355. data/gems/gems/haml-2.2.16/lib/haml/engine.rb +0 -299
  356. data/gems/gems/haml-2.2.16/lib/haml/error.rb +0 -22
  357. data/gems/gems/haml-2.2.16/lib/haml/exec.rb +0 -459
  358. data/gems/gems/haml-2.2.16/lib/haml/filters.rb +0 -341
  359. data/gems/gems/haml-2.2.16/lib/haml/helpers/action_view_extensions.rb +0 -55
  360. data/gems/gems/haml-2.2.16/lib/haml/helpers/action_view_mods.rb +0 -177
  361. data/gems/gems/haml-2.2.16/lib/haml/helpers/xss_mods.rb +0 -95
  362. data/gems/gems/haml-2.2.16/lib/haml/helpers.rb +0 -563
  363. data/gems/gems/haml-2.2.16/lib/haml/html.rb +0 -259
  364. data/gems/gems/haml-2.2.16/lib/haml/precompiler.rb +0 -1043
  365. data/gems/gems/haml-2.2.16/lib/haml/shared.rb +0 -78
  366. data/gems/gems/haml-2.2.16/lib/haml/template/patch.rb +0 -58
  367. data/gems/gems/haml-2.2.16/lib/haml/template/plugin.rb +0 -75
  368. data/gems/gems/haml-2.2.16/lib/haml/template.rb +0 -85
  369. data/gems/gems/haml-2.2.16/lib/haml/util.rb +0 -289
  370. data/gems/gems/haml-2.2.16/lib/haml/version.rb +0 -64
  371. data/gems/gems/haml-2.2.16/lib/haml.rb +0 -40
  372. data/gems/gems/haml-2.2.16/lib/sass/css.rb +0 -404
  373. data/gems/gems/haml-2.2.16/lib/sass/engine.rb +0 -475
  374. data/gems/gems/haml-2.2.16/lib/sass/environment.rb +0 -79
  375. data/gems/gems/haml-2.2.16/lib/sass/error.rb +0 -57
  376. data/gems/gems/haml-2.2.16/lib/sass/files.rb +0 -140
  377. data/gems/gems/haml-2.2.16/lib/sass/plugin/merb.rb +0 -49
  378. data/gems/gems/haml-2.2.16/lib/sass/plugin/rack.rb +0 -65
  379. data/gems/gems/haml-2.2.16/lib/sass/plugin/rails.rb +0 -24
  380. data/gems/gems/haml-2.2.16/lib/sass/plugin.rb +0 -225
  381. data/gems/gems/haml-2.2.16/lib/sass/repl.rb +0 -58
  382. data/gems/gems/haml-2.2.16/lib/sass/script/bool.rb +0 -17
  383. data/gems/gems/haml-2.2.16/lib/sass/script/color.rb +0 -220
  384. data/gems/gems/haml-2.2.16/lib/sass/script/funcall.rb +0 -50
  385. data/gems/gems/haml-2.2.16/lib/sass/script/functions.rb +0 -252
  386. data/gems/gems/haml-2.2.16/lib/sass/script/lexer.rb +0 -191
  387. data/gems/gems/haml-2.2.16/lib/sass/script/literal.rb +0 -177
  388. data/gems/gems/haml-2.2.16/lib/sass/script/node.rb +0 -14
  389. data/gems/gems/haml-2.2.16/lib/sass/script/number.rb +0 -381
  390. data/gems/gems/haml-2.2.16/lib/sass/script/operation.rb +0 -45
  391. data/gems/gems/haml-2.2.16/lib/sass/script/parser.rb +0 -222
  392. data/gems/gems/haml-2.2.16/lib/sass/script/string.rb +0 -12
  393. data/gems/gems/haml-2.2.16/lib/sass/script/unary_operation.rb +0 -34
  394. data/gems/gems/haml-2.2.16/lib/sass/script/variable.rb +0 -31
  395. data/gems/gems/haml-2.2.16/lib/sass/script.rb +0 -59
  396. data/gems/gems/haml-2.2.16/lib/sass/tree/comment_node.rb +0 -84
  397. data/gems/gems/haml-2.2.16/lib/sass/tree/debug_node.rb +0 -30
  398. data/gems/gems/haml-2.2.16/lib/sass/tree/directive_node.rb +0 -68
  399. data/gems/gems/haml-2.2.16/lib/sass/tree/for_node.rb +0 -48
  400. data/gems/gems/haml-2.2.16/lib/sass/tree/if_node.rb +0 -54
  401. data/gems/gems/haml-2.2.16/lib/sass/tree/import_node.rb +0 -65
  402. data/gems/gems/haml-2.2.16/lib/sass/tree/mixin_def_node.rb +0 -29
  403. data/gems/gems/haml-2.2.16/lib/sass/tree/mixin_node.rb +0 -48
  404. data/gems/gems/haml-2.2.16/lib/sass/tree/node.rb +0 -251
  405. data/gems/gems/haml-2.2.16/lib/sass/tree/prop_node.rb +0 -121
  406. data/gems/gems/haml-2.2.16/lib/sass/tree/rule_node.rb +0 -223
  407. data/gems/gems/haml-2.2.16/lib/sass/tree/variable_node.rb +0 -34
  408. data/gems/gems/haml-2.2.16/lib/sass/tree/while_node.rb +0 -31
  409. data/gems/gems/haml-2.2.16/lib/sass.rb +0 -24
  410. data/gems/gems/haml-2.2.16/rails/init.rb +0 -1
  411. data/gems/gems/haml-2.2.16/test/benchmark.rb +0 -99
  412. data/gems/gems/haml-2.2.16/test/haml/engine_test.rb +0 -1247
  413. data/gems/gems/haml-2.2.16/test/haml/helper_test.rb +0 -282
  414. data/gems/gems/haml-2.2.16/test/haml/html2haml_test.rb +0 -139
  415. data/gems/gems/haml-2.2.16/test/haml/markaby/standard.mab +0 -52
  416. data/gems/gems/haml-2.2.16/test/haml/mocks/article.rb +0 -6
  417. data/gems/gems/haml-2.2.16/test/haml/results/content_for_layout.xhtml +0 -12
  418. data/gems/gems/haml-2.2.16/test/haml/results/eval_suppressed.xhtml +0 -9
  419. data/gems/gems/haml-2.2.16/test/haml/results/filters.xhtml +0 -62
  420. data/gems/gems/haml-2.2.16/test/haml/results/helpers.xhtml +0 -93
  421. data/gems/gems/haml-2.2.16/test/haml/results/helpful.xhtml +0 -10
  422. data/gems/gems/haml-2.2.16/test/haml/results/just_stuff.xhtml +0 -68
  423. data/gems/gems/haml-2.2.16/test/haml/results/list.xhtml +0 -12
  424. data/gems/gems/haml-2.2.16/test/haml/results/nuke_inner_whitespace.xhtml +0 -40
  425. data/gems/gems/haml-2.2.16/test/haml/results/nuke_outer_whitespace.xhtml +0 -148
  426. data/gems/gems/haml-2.2.16/test/haml/results/original_engine.xhtml +0 -20
  427. data/gems/gems/haml-2.2.16/test/haml/results/partial_layout.xhtml +0 -5
  428. data/gems/gems/haml-2.2.16/test/haml/results/partials.xhtml +0 -21
  429. data/gems/gems/haml-2.2.16/test/haml/results/render_layout.xhtml +0 -3
  430. data/gems/gems/haml-2.2.16/test/haml/results/silent_script.xhtml +0 -74
  431. data/gems/gems/haml-2.2.16/test/haml/results/standard.xhtml +0 -162
  432. data/gems/gems/haml-2.2.16/test/haml/results/tag_parsing.xhtml +0 -23
  433. data/gems/gems/haml-2.2.16/test/haml/results/very_basic.xhtml +0 -5
  434. data/gems/gems/haml-2.2.16/test/haml/results/whitespace_handling.xhtml +0 -89
  435. data/gems/gems/haml-2.2.16/test/haml/rhtml/_av_partial_1.rhtml +0 -12
  436. data/gems/gems/haml-2.2.16/test/haml/rhtml/_av_partial_2.rhtml +0 -8
  437. data/gems/gems/haml-2.2.16/test/haml/rhtml/action_view.rhtml +0 -62
  438. data/gems/gems/haml-2.2.16/test/haml/rhtml/standard.rhtml +0 -54
  439. data/gems/gems/haml-2.2.16/test/haml/spec/README.md +0 -97
  440. data/gems/gems/haml-2.2.16/test/haml/spec/lua_haml_spec.lua +0 -30
  441. data/gems/gems/haml-2.2.16/test/haml/spec/ruby_haml_test.rb +0 -19
  442. data/gems/gems/haml-2.2.16/test/haml/spec/tests.json +0 -488
  443. data/gems/gems/haml-2.2.16/test/haml/template_test.rb +0 -296
  444. data/gems/gems/haml-2.2.16/test/haml/templates/_av_partial_1.haml +0 -9
  445. data/gems/gems/haml-2.2.16/test/haml/templates/_av_partial_1_ugly.haml +0 -9
  446. data/gems/gems/haml-2.2.16/test/haml/templates/_av_partial_2.haml +0 -5
  447. data/gems/gems/haml-2.2.16/test/haml/templates/_av_partial_2_ugly.haml +0 -5
  448. data/gems/gems/haml-2.2.16/test/haml/templates/_layout.erb +0 -3
  449. data/gems/gems/haml-2.2.16/test/haml/templates/_layout_for_partial.haml +0 -3
  450. data/gems/gems/haml-2.2.16/test/haml/templates/_partial.haml +0 -8
  451. data/gems/gems/haml-2.2.16/test/haml/templates/_text_area.haml +0 -3
  452. data/gems/gems/haml-2.2.16/test/haml/templates/action_view.haml +0 -47
  453. data/gems/gems/haml-2.2.16/test/haml/templates/action_view_ugly.haml +0 -47
  454. data/gems/gems/haml-2.2.16/test/haml/templates/breakage.haml +0 -8
  455. data/gems/gems/haml-2.2.16/test/haml/templates/content_for_layout.haml +0 -8
  456. data/gems/gems/haml-2.2.16/test/haml/templates/eval_suppressed.haml +0 -11
  457. data/gems/gems/haml-2.2.16/test/haml/templates/filters.haml +0 -66
  458. data/gems/gems/haml-2.2.16/test/haml/templates/helpers.haml +0 -95
  459. data/gems/gems/haml-2.2.16/test/haml/templates/helpful.haml +0 -11
  460. data/gems/gems/haml-2.2.16/test/haml/templates/just_stuff.haml +0 -83
  461. data/gems/gems/haml-2.2.16/test/haml/templates/list.haml +0 -12
  462. data/gems/gems/haml-2.2.16/test/haml/templates/nuke_inner_whitespace.haml +0 -32
  463. data/gems/gems/haml-2.2.16/test/haml/templates/nuke_outer_whitespace.haml +0 -144
  464. data/gems/gems/haml-2.2.16/test/haml/templates/original_engine.haml +0 -17
  465. data/gems/gems/haml-2.2.16/test/haml/templates/partial_layout.haml +0 -3
  466. data/gems/gems/haml-2.2.16/test/haml/templates/partialize.haml +0 -1
  467. data/gems/gems/haml-2.2.16/test/haml/templates/partials.haml +0 -12
  468. data/gems/gems/haml-2.2.16/test/haml/templates/render_layout.haml +0 -2
  469. data/gems/gems/haml-2.2.16/test/haml/templates/silent_script.haml +0 -40
  470. data/gems/gems/haml-2.2.16/test/haml/templates/standard.haml +0 -42
  471. data/gems/gems/haml-2.2.16/test/haml/templates/standard_ugly.haml +0 -42
  472. data/gems/gems/haml-2.2.16/test/haml/templates/tag_parsing.haml +0 -21
  473. data/gems/gems/haml-2.2.16/test/haml/templates/very_basic.haml +0 -4
  474. data/gems/gems/haml-2.2.16/test/haml/templates/whitespace_handling.haml +0 -87
  475. data/gems/gems/haml-2.2.16/test/haml/util_test.rb +0 -107
  476. data/gems/gems/haml-2.2.16/test/linked_rails.rb +0 -21
  477. data/gems/gems/haml-2.2.16/test/sass/css2sass_test.rb +0 -251
  478. data/gems/gems/haml-2.2.16/test/sass/engine_test.rb +0 -914
  479. data/gems/gems/haml-2.2.16/test/sass/functions_test.rb +0 -173
  480. data/gems/gems/haml-2.2.16/test/sass/more_results/more1.css +0 -9
  481. data/gems/gems/haml-2.2.16/test/sass/more_results/more1_with_line_comments.css +0 -26
  482. data/gems/gems/haml-2.2.16/test/sass/more_results/more_import.css +0 -29
  483. data/gems/gems/haml-2.2.16/test/sass/more_templates/_more_partial.sass +0 -2
  484. data/gems/gems/haml-2.2.16/test/sass/more_templates/more1.sass +0 -23
  485. data/gems/gems/haml-2.2.16/test/sass/more_templates/more_import.sass +0 -11
  486. data/gems/gems/haml-2.2.16/test/sass/plugin_test.rb +0 -222
  487. data/gems/gems/haml-2.2.16/test/sass/results/alt.css +0 -4
  488. data/gems/gems/haml-2.2.16/test/sass/results/basic.css +0 -9
  489. data/gems/gems/haml-2.2.16/test/sass/results/compact.css +0 -5
  490. data/gems/gems/haml-2.2.16/test/sass/results/complex.css +0 -87
  491. data/gems/gems/haml-2.2.16/test/sass/results/compressed.css +0 -1
  492. data/gems/gems/haml-2.2.16/test/sass/results/expanded.css +0 -19
  493. data/gems/gems/haml-2.2.16/test/sass/results/import.css +0 -29
  494. data/gems/gems/haml-2.2.16/test/sass/results/line_numbers.css +0 -49
  495. data/gems/gems/haml-2.2.16/test/sass/results/mixins.css +0 -95
  496. data/gems/gems/haml-2.2.16/test/sass/results/multiline.css +0 -24
  497. data/gems/gems/haml-2.2.16/test/sass/results/nested.css +0 -22
  498. data/gems/gems/haml-2.2.16/test/sass/results/parent_ref.css +0 -13
  499. data/gems/gems/haml-2.2.16/test/sass/results/script.css +0 -16
  500. data/gems/gems/haml-2.2.16/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
  501. data/gems/gems/haml-2.2.16/test/sass/results/subdir/subdir.css +0 -3
  502. data/gems/gems/haml-2.2.16/test/sass/results/units.css +0 -11
  503. data/gems/gems/haml-2.2.16/test/sass/script_test.rb +0 -267
  504. data/gems/gems/haml-2.2.16/test/sass/templates/_partial.sass +0 -2
  505. data/gems/gems/haml-2.2.16/test/sass/templates/alt.sass +0 -16
  506. data/gems/gems/haml-2.2.16/test/sass/templates/basic.sass +0 -23
  507. data/gems/gems/haml-2.2.16/test/sass/templates/bork.sass +0 -2
  508. data/gems/gems/haml-2.2.16/test/sass/templates/bork2.sass +0 -2
  509. data/gems/gems/haml-2.2.16/test/sass/templates/compact.sass +0 -17
  510. data/gems/gems/haml-2.2.16/test/sass/templates/complex.sass +0 -307
  511. data/gems/gems/haml-2.2.16/test/sass/templates/compressed.sass +0 -15
  512. data/gems/gems/haml-2.2.16/test/sass/templates/expanded.sass +0 -17
  513. data/gems/gems/haml-2.2.16/test/sass/templates/import.sass +0 -11
  514. data/gems/gems/haml-2.2.16/test/sass/templates/importee.sass +0 -19
  515. data/gems/gems/haml-2.2.16/test/sass/templates/line_numbers.sass +0 -13
  516. data/gems/gems/haml-2.2.16/test/sass/templates/mixins.sass +0 -76
  517. data/gems/gems/haml-2.2.16/test/sass/templates/multiline.sass +0 -20
  518. data/gems/gems/haml-2.2.16/test/sass/templates/nested.sass +0 -25
  519. data/gems/gems/haml-2.2.16/test/sass/templates/parent_ref.sass +0 -25
  520. data/gems/gems/haml-2.2.16/test/sass/templates/script.sass +0 -101
  521. data/gems/gems/haml-2.2.16/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
  522. data/gems/gems/haml-2.2.16/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
  523. data/gems/gems/haml-2.2.16/test/sass/templates/subdir/subdir.sass +0 -6
  524. data/gems/gems/haml-2.2.16/test/sass/templates/units.sass +0 -11
  525. data/gems/gems/haml-2.2.16/test/test_helper.rb +0 -35
  526. data/gems/gems/rspec-1.2.9/History.rdoc +0 -1496
  527. data/gems/gems/rspec-1.2.9/License.txt +0 -22
  528. data/gems/gems/rspec-1.2.9/Manifest.txt +0 -377
  529. data/gems/gems/rspec-1.2.9/README.rdoc +0 -55
  530. data/gems/gems/rspec-1.2.9/Rakefile +0 -145
  531. data/gems/gems/rspec-1.2.9/Ruby1.9.rdoc +0 -31
  532. data/gems/gems/rspec-1.2.9/TODO.txt +0 -17
  533. data/gems/gems/rspec-1.2.9/Upgrade.rdoc +0 -199
  534. data/gems/gems/rspec-1.2.9/bin/autospec +0 -4
  535. data/gems/gems/rspec-1.2.9/bin/spec +0 -5
  536. data/gems/gems/rspec-1.2.9/cucumber.yml +0 -5
  537. data/gems/gems/rspec-1.2.9/examples/failing/README.txt +0 -11
  538. data/gems/gems/rspec-1.2.9/examples/failing/diffing_spec.rb +0 -36
  539. data/gems/gems/rspec-1.2.9/examples/failing/failing_implicit_docstrings_example.rb +0 -17
  540. data/gems/gems/rspec-1.2.9/examples/failing/failure_in_after.rb +0 -10
  541. data/gems/gems/rspec-1.2.9/examples/failing/failure_in_before.rb +0 -10
  542. data/gems/gems/rspec-1.2.9/examples/failing/mocking_example.rb +0 -38
  543. data/gems/gems/rspec-1.2.9/examples/failing/mocking_with_flexmock.rb +0 -26
  544. data/gems/gems/rspec-1.2.9/examples/failing/mocking_with_mocha.rb +0 -25
  545. data/gems/gems/rspec-1.2.9/examples/failing/mocking_with_rr.rb +0 -27
  546. data/gems/gems/rspec-1.2.9/examples/failing/partial_mock_example.rb +0 -18
  547. data/gems/gems/rspec-1.2.9/examples/failing/pending_example.rb +0 -7
  548. data/gems/gems/rspec-1.2.9/examples/failing/predicate_example.rb +0 -32
  549. data/gems/gems/rspec-1.2.9/examples/failing/raising_example.rb +0 -47
  550. data/gems/gems/rspec-1.2.9/examples/failing/syntax_error_example.rb +0 -7
  551. data/gems/gems/rspec-1.2.9/examples/failing/team_spec.rb +0 -41
  552. data/gems/gems/rspec-1.2.9/examples/failing/timeout_behaviour.rb +0 -5
  553. data/gems/gems/rspec-1.2.9/examples/passing/custom_formatter.rb +0 -11
  554. data/gems/gems/rspec-1.2.9/examples/passing/custom_matchers.rb +0 -54
  555. data/gems/gems/rspec-1.2.9/examples/passing/dynamic_spec.rb +0 -7
  556. data/gems/gems/rspec-1.2.9/examples/passing/file_accessor.rb +0 -18
  557. data/gems/gems/rspec-1.2.9/examples/passing/file_accessor_spec.rb +0 -37
  558. data/gems/gems/rspec-1.2.9/examples/passing/filtered_formatter.rb +0 -17
  559. data/gems/gems/rspec-1.2.9/examples/passing/filtered_formatter_example.rb +0 -31
  560. data/gems/gems/rspec-1.2.9/examples/passing/greeter_spec.rb +0 -30
  561. data/gems/gems/rspec-1.2.9/examples/passing/helper_method_example.rb +0 -12
  562. data/gems/gems/rspec-1.2.9/examples/passing/implicit_docstrings_example.rb +0 -16
  563. data/gems/gems/rspec-1.2.9/examples/passing/io_processor.rb +0 -8
  564. data/gems/gems/rspec-1.2.9/examples/passing/io_processor_spec.rb +0 -20
  565. data/gems/gems/rspec-1.2.9/examples/passing/mocking_example.rb +0 -25
  566. data/gems/gems/rspec-1.2.9/examples/passing/multi_threaded_example_group_runner.rb +0 -26
  567. data/gems/gems/rspec-1.2.9/examples/passing/nested_classes_example.rb +0 -35
  568. data/gems/gems/rspec-1.2.9/examples/passing/options_example.rb +0 -29
  569. data/gems/gems/rspec-1.2.9/examples/passing/options_formatter.rb +0 -20
  570. data/gems/gems/rspec-1.2.9/examples/passing/partial_mock_example.rb +0 -27
  571. data/gems/gems/rspec-1.2.9/examples/passing/pending_example.rb +0 -18
  572. data/gems/gems/rspec-1.2.9/examples/passing/predicate_example.rb +0 -25
  573. data/gems/gems/rspec-1.2.9/examples/passing/shared_example_group_example.rb +0 -79
  574. data/gems/gems/rspec-1.2.9/examples/passing/shared_stack_examples.rb +0 -36
  575. data/gems/gems/rspec-1.2.9/examples/passing/simple_matcher_example.rb +0 -29
  576. data/gems/gems/rspec-1.2.9/examples/passing/stack.rb +0 -36
  577. data/gems/gems/rspec-1.2.9/examples/passing/stack_spec.rb +0 -63
  578. data/gems/gems/rspec-1.2.9/examples/passing/stack_spec_with_nested_example_groups.rb +0 -66
  579. data/gems/gems/rspec-1.2.9/examples/passing/stubbing_example.rb +0 -67
  580. data/gems/gems/rspec-1.2.9/examples/passing/yielding_example.rb +0 -31
  581. data/gems/gems/rspec-1.2.9/examples/ruby1.9.compatibility/access_to_constants_spec.rb +0 -85
  582. data/gems/gems/rspec-1.2.9/features/before_and_after_blocks/before_and_after_blocks.feature +0 -167
  583. data/gems/gems/rspec-1.2.9/features/command_line/line_number_option.feature +0 -56
  584. data/gems/gems/rspec-1.2.9/features/command_line/line_number_option_with_example_with_no_name.feature +0 -22
  585. data/gems/gems/rspec-1.2.9/features/example_groups/define_example_attribute.feature +0 -41
  586. data/gems/gems/rspec-1.2.9/features/example_groups/example_group_with_should_methods.feature +0 -29
  587. data/gems/gems/rspec-1.2.9/features/example_groups/implicit_docstrings.feature +0 -59
  588. data/gems/gems/rspec-1.2.9/features/example_groups/nested_groups.feature +0 -32
  589. data/gems/gems/rspec-1.2.9/features/expectations/customized_message.feature +0 -54
  590. data/gems/gems/rspec-1.2.9/features/expectations/expect_change.feature +0 -65
  591. data/gems/gems/rspec-1.2.9/features/expectations/expect_error.feature +0 -44
  592. data/gems/gems/rspec-1.2.9/features/extensions/custom_example_group.feature +0 -19
  593. data/gems/gems/rspec-1.2.9/features/formatters/custom_formatter.feature +0 -30
  594. data/gems/gems/rspec-1.2.9/features/interop/examples_and_tests_together.feature +0 -84
  595. data/gems/gems/rspec-1.2.9/features/interop/rspec_output.feature +0 -25
  596. data/gems/gems/rspec-1.2.9/features/interop/test_but_not_test_unit.feature +0 -26
  597. data/gems/gems/rspec-1.2.9/features/interop/test_case_with_should_methods.feature +0 -46
  598. data/gems/gems/rspec-1.2.9/features/load_paths/add_lib_to_load_path.feature +0 -20
  599. data/gems/gems/rspec-1.2.9/features/load_paths/add_spec_to_load_path.feature +0 -20
  600. data/gems/gems/rspec-1.2.9/features/matchers/define_diffable_matcher.feature +0 -26
  601. data/gems/gems/rspec-1.2.9/features/matchers/define_matcher.feature +0 -179
  602. data/gems/gems/rspec-1.2.9/features/matchers/define_matcher_outside_rspec.feature +0 -38
  603. data/gems/gems/rspec-1.2.9/features/matchers/define_matcher_with_fluent_interface.feature +0 -27
  604. data/gems/gems/rspec-1.2.9/features/matchers/define_wrapped_matcher.feature +0 -29
  605. data/gems/gems/rspec-1.2.9/features/mock_framework_integration/use_flexmock.feature +0 -27
  606. data/gems/gems/rspec-1.2.9/features/mock_framework_integration/use_mocha.feature +0 -27
  607. data/gems/gems/rspec-1.2.9/features/mock_framework_integration/use_rr.feature +0 -27
  608. data/gems/gems/rspec-1.2.9/features/mocks/mix_stubs_and_mocks.feature +0 -22
  609. data/gems/gems/rspec-1.2.9/features/mocks/stub_implementation.feature +0 -26
  610. data/gems/gems/rspec-1.2.9/features/pending/pending_examples.feature +0 -81
  611. data/gems/gems/rspec-1.2.9/features/runner/specify_line_number.feature +0 -32
  612. data/gems/gems/rspec-1.2.9/features/spec_helper/spec_helper.feature +0 -25
  613. data/gems/gems/rspec-1.2.9/features/step_definitions/running_rspec_steps.rb +0 -43
  614. data/gems/gems/rspec-1.2.9/features/subject/explicit_subject.feature +0 -31
  615. data/gems/gems/rspec-1.2.9/features/subject/implicit_subject.feature +0 -43
  616. data/gems/gems/rspec-1.2.9/features/support/env.rb +0 -82
  617. data/gems/gems/rspec-1.2.9/features/support/matchers/smart_match.rb +0 -12
  618. data/gems/gems/rspec-1.2.9/init.rb +0 -9
  619. data/gems/gems/rspec-1.2.9/lib/autotest/discover.rb +0 -3
  620. data/gems/gems/rspec-1.2.9/lib/autotest/rspec.rb +0 -47
  621. data/gems/gems/rspec-1.2.9/lib/spec/adapters/mock_frameworks/flexmock.rb +0 -24
  622. data/gems/gems/rspec-1.2.9/lib/spec/adapters/mock_frameworks/mocha.rb +0 -25
  623. data/gems/gems/rspec-1.2.9/lib/spec/adapters/mock_frameworks/rr.rb +0 -22
  624. data/gems/gems/rspec-1.2.9/lib/spec/adapters/mock_frameworks/rspec.rb +0 -21
  625. data/gems/gems/rspec-1.2.9/lib/spec/autorun.rb +0 -3
  626. data/gems/gems/rspec-1.2.9/lib/spec/deprecation.rb +0 -40
  627. data/gems/gems/rspec-1.2.9/lib/spec/dsl/main.rb +0 -92
  628. data/gems/gems/rspec-1.2.9/lib/spec/dsl.rb +0 -1
  629. data/gems/gems/rspec-1.2.9/lib/spec/example/args_and_options.rb +0 -27
  630. data/gems/gems/rspec-1.2.9/lib/spec/example/before_and_after_hooks.rb +0 -93
  631. data/gems/gems/rspec-1.2.9/lib/spec/example/errors.rb +0 -25
  632. data/gems/gems/rspec-1.2.9/lib/spec/example/example_group.rb +0 -10
  633. data/gems/gems/rspec-1.2.9/lib/spec/example/example_group_factory.rb +0 -82
  634. data/gems/gems/rspec-1.2.9/lib/spec/example/example_group_hierarchy.rb +0 -53
  635. data/gems/gems/rspec-1.2.9/lib/spec/example/example_group_methods.rb +0 -282
  636. data/gems/gems/rspec-1.2.9/lib/spec/example/example_group_proxy.rb +0 -61
  637. data/gems/gems/rspec-1.2.9/lib/spec/example/example_matcher.rb +0 -43
  638. data/gems/gems/rspec-1.2.9/lib/spec/example/example_methods.rb +0 -148
  639. data/gems/gems/rspec-1.2.9/lib/spec/example/example_proxy.rb +0 -41
  640. data/gems/gems/rspec-1.2.9/lib/spec/example/module_reopening_fix.rb +0 -43
  641. data/gems/gems/rspec-1.2.9/lib/spec/example/pending.rb +0 -18
  642. data/gems/gems/rspec-1.2.9/lib/spec/example/predicate_matchers.rb +0 -46
  643. data/gems/gems/rspec-1.2.9/lib/spec/example/shared_example_group.rb +0 -59
  644. data/gems/gems/rspec-1.2.9/lib/spec/example/subject.rb +0 -108
  645. data/gems/gems/rspec-1.2.9/lib/spec/example.rb +0 -164
  646. data/gems/gems/rspec-1.2.9/lib/spec/expectations/errors.rb +0 -12
  647. data/gems/gems/rspec-1.2.9/lib/spec/expectations/extensions/kernel.rb +0 -52
  648. data/gems/gems/rspec-1.2.9/lib/spec/expectations/extensions.rb +0 -1
  649. data/gems/gems/rspec-1.2.9/lib/spec/expectations/fail_with.rb +0 -45
  650. data/gems/gems/rspec-1.2.9/lib/spec/expectations/handler.rb +0 -50
  651. data/gems/gems/rspec-1.2.9/lib/spec/expectations.rb +0 -35
  652. data/gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/autorunner.rb +0 -6
  653. data/gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/testcase.rb +0 -56
  654. data/gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/testresult.rb +0 -6
  655. data/gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/testsuite_adapter.rb +0 -34
  656. data/gems/gems/rspec-1.2.9/lib/spec/interop/test/unit/ui/console/testrunner.rb +0 -61
  657. data/gems/gems/rspec-1.2.9/lib/spec/interop/test.rb +0 -44
  658. data/gems/gems/rspec-1.2.9/lib/spec/matchers/be.rb +0 -210
  659. data/gems/gems/rspec-1.2.9/lib/spec/matchers/be_close.rb +0 -32
  660. data/gems/gems/rspec-1.2.9/lib/spec/matchers/be_instance_of.rb +0 -26
  661. data/gems/gems/rspec-1.2.9/lib/spec/matchers/be_kind_of.rb +0 -26
  662. data/gems/gems/rspec-1.2.9/lib/spec/matchers/change.rb +0 -151
  663. data/gems/gems/rspec-1.2.9/lib/spec/matchers/compatibility.rb +0 -14
  664. data/gems/gems/rspec-1.2.9/lib/spec/matchers/dsl.rb +0 -20
  665. data/gems/gems/rspec-1.2.9/lib/spec/matchers/eql.rb +0 -42
  666. data/gems/gems/rspec-1.2.9/lib/spec/matchers/equal.rb +0 -53
  667. data/gems/gems/rspec-1.2.9/lib/spec/matchers/errors.rb +0 -5
  668. data/gems/gems/rspec-1.2.9/lib/spec/matchers/exist.rb +0 -16
  669. data/gems/gems/rspec-1.2.9/lib/spec/matchers/extensions/instance_exec.rb +0 -31
  670. data/gems/gems/rspec-1.2.9/lib/spec/matchers/generated_descriptions.rb +0 -36
  671. data/gems/gems/rspec-1.2.9/lib/spec/matchers/has.rb +0 -35
  672. data/gems/gems/rspec-1.2.9/lib/spec/matchers/have.rb +0 -151
  673. data/gems/gems/rspec-1.2.9/lib/spec/matchers/include.rb +0 -44
  674. data/gems/gems/rspec-1.2.9/lib/spec/matchers/match.rb +0 -21
  675. data/gems/gems/rspec-1.2.9/lib/spec/matchers/match_array.rb +0 -71
  676. data/gems/gems/rspec-1.2.9/lib/spec/matchers/matcher.rb +0 -87
  677. data/gems/gems/rspec-1.2.9/lib/spec/matchers/method_missing.rb +0 -9
  678. data/gems/gems/rspec-1.2.9/lib/spec/matchers/operator_matcher.rb +0 -78
  679. data/gems/gems/rspec-1.2.9/lib/spec/matchers/pretty.rb +0 -37
  680. data/gems/gems/rspec-1.2.9/lib/spec/matchers/raise_error.rb +0 -129
  681. data/gems/gems/rspec-1.2.9/lib/spec/matchers/respond_to.rb +0 -71
  682. data/gems/gems/rspec-1.2.9/lib/spec/matchers/satisfy.rb +0 -47
  683. data/gems/gems/rspec-1.2.9/lib/spec/matchers/simple_matcher.rb +0 -133
  684. data/gems/gems/rspec-1.2.9/lib/spec/matchers/throw_symbol.rb +0 -104
  685. data/gems/gems/rspec-1.2.9/lib/spec/matchers/wrap_expectation.rb +0 -55
  686. data/gems/gems/rspec-1.2.9/lib/spec/matchers.rb +0 -195
  687. data/gems/gems/rspec-1.2.9/lib/spec/mocks/argument_expectation.rb +0 -51
  688. data/gems/gems/rspec-1.2.9/lib/spec/mocks/argument_matchers.rb +0 -237
  689. data/gems/gems/rspec-1.2.9/lib/spec/mocks/error_generator.rb +0 -92
  690. data/gems/gems/rspec-1.2.9/lib/spec/mocks/errors.rb +0 -10
  691. data/gems/gems/rspec-1.2.9/lib/spec/mocks/example_methods.rb +0 -69
  692. data/gems/gems/rspec-1.2.9/lib/spec/mocks/extensions/object.rb +0 -3
  693. data/gems/gems/rspec-1.2.9/lib/spec/mocks/extensions.rb +0 -1
  694. data/gems/gems/rspec-1.2.9/lib/spec/mocks/framework.rb +0 -15
  695. data/gems/gems/rspec-1.2.9/lib/spec/mocks/message_expectation.rb +0 -329
  696. data/gems/gems/rspec-1.2.9/lib/spec/mocks/methods.rb +0 -89
  697. data/gems/gems/rspec-1.2.9/lib/spec/mocks/mock.rb +0 -71
  698. data/gems/gems/rspec-1.2.9/lib/spec/mocks/order_group.rb +0 -29
  699. data/gems/gems/rspec-1.2.9/lib/spec/mocks/proxy.rb +0 -245
  700. data/gems/gems/rspec-1.2.9/lib/spec/mocks/space.rb +0 -28
  701. data/gems/gems/rspec-1.2.9/lib/spec/mocks.rb +0 -200
  702. data/gems/gems/rspec-1.2.9/lib/spec/rake/spectask.rb +0 -230
  703. data/gems/gems/rspec-1.2.9/lib/spec/rake/verify_rcov.rb +0 -52
  704. data/gems/gems/rspec-1.2.9/lib/spec/ruby.rb +0 -9
  705. data/gems/gems/rspec-1.2.9/lib/spec/runner/backtrace_tweaker.rb +0 -77
  706. data/gems/gems/rspec-1.2.9/lib/spec/runner/class_and_arguments_parser.rb +0 -14
  707. data/gems/gems/rspec-1.2.9/lib/spec/runner/command_line.rb +0 -15
  708. data/gems/gems/rspec-1.2.9/lib/spec/runner/configuration.rb +0 -194
  709. data/gems/gems/rspec-1.2.9/lib/spec/runner/differs/default.rb +0 -93
  710. data/gems/gems/rspec-1.2.9/lib/spec/runner/differs/load-diff-lcs.rb +0 -12
  711. data/gems/gems/rspec-1.2.9/lib/spec/runner/drb_command_line.rb +0 -26
  712. data/gems/gems/rspec-1.2.9/lib/spec/runner/example_group_runner.rb +0 -59
  713. data/gems/gems/rspec-1.2.9/lib/spec/runner/extensions/kernel.rb +0 -9
  714. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/base_formatter.rb +0 -139
  715. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/base_text_formatter.rb +0 -142
  716. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/failing_example_groups_formatter.rb +0 -25
  717. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/failing_examples_formatter.rb +0 -20
  718. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/html_formatter.rb +0 -338
  719. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/nested_text_formatter.rb +0 -47
  720. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/no_op_method_missing.rb +0 -21
  721. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/profile_formatter.rb +0 -47
  722. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/progress_bar_formatter.rb +0 -33
  723. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/silent_formatter.rb +0 -10
  724. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/snippet_extractor.rb +0 -52
  725. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/specdoc_formatter.rb +0 -33
  726. data/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/text_mate_formatter.rb +0 -16
  727. data/gems/gems/rspec-1.2.9/lib/spec/runner/heckle_runner.rb +0 -72
  728. data/gems/gems/rspec-1.2.9/lib/spec/runner/heckle_runner_unsupported.rb +0 -10
  729. data/gems/gems/rspec-1.2.9/lib/spec/runner/line_number_query.rb +0 -78
  730. data/gems/gems/rspec-1.2.9/lib/spec/runner/option_parser.rb +0 -223
  731. data/gems/gems/rspec-1.2.9/lib/spec/runner/options.rb +0 -400
  732. data/gems/gems/rspec-1.2.9/lib/spec/runner/reporter.rb +0 -171
  733. data/gems/gems/rspec-1.2.9/lib/spec/runner.rb +0 -66
  734. data/gems/gems/rspec-1.2.9/lib/spec/stubs/cucumber.rb +0 -5
  735. data/gems/gems/rspec-1.2.9/lib/spec/test/unit.rb +0 -10
  736. data/gems/gems/rspec-1.2.9/lib/spec/version.rb +0 -14
  737. data/gems/gems/rspec-1.2.9/lib/spec.rb +0 -8
  738. data/gems/gems/rspec-1.2.9/resources/helpers/cmdline.rb +0 -8
  739. data/gems/gems/rspec-1.2.9/resources/rake/examples.rake +0 -7
  740. data/gems/gems/rspec-1.2.9/resources/rake/examples_with_rcov.rake +0 -9
  741. data/gems/gems/rspec-1.2.9/resources/rake/failing_examples_with_html.rake +0 -9
  742. data/gems/gems/rspec-1.2.9/resources/rake/verify_rcov.rake +0 -7
  743. data/gems/gems/rspec-1.2.9/spec/README.jruby +0 -15
  744. data/gems/gems/rspec-1.2.9/spec/autotest/autotest_helper.rb +0 -8
  745. data/gems/gems/rspec-1.2.9/spec/autotest/autotest_matchers.rb +0 -38
  746. data/gems/gems/rspec-1.2.9/spec/autotest/discover_spec.rb +0 -8
  747. data/gems/gems/rspec-1.2.9/spec/autotest/failed_results_re_spec.rb +0 -31
  748. data/gems/gems/rspec-1.2.9/spec/autotest/rspec_spec.rb +0 -111
  749. data/gems/gems/rspec-1.2.9/spec/ruby_forker.rb +0 -13
  750. data/gems/gems/rspec-1.2.9/spec/spec/dsl/main_spec.rb +0 -95
  751. data/gems/gems/rspec-1.2.9/spec/spec/example/example_group_class_definition_spec.rb +0 -51
  752. data/gems/gems/rspec-1.2.9/spec/spec/example/example_group_factory_spec.rb +0 -180
  753. data/gems/gems/rspec-1.2.9/spec/spec/example/example_group_methods_spec.rb +0 -758
  754. data/gems/gems/rspec-1.2.9/spec/spec/example/example_group_proxy_spec.rb +0 -107
  755. data/gems/gems/rspec-1.2.9/spec/spec/example/example_group_spec.rb +0 -643
  756. data/gems/gems/rspec-1.2.9/spec/spec/example/example_matcher_spec.rb +0 -86
  757. data/gems/gems/rspec-1.2.9/spec/spec/example/example_methods_spec.rb +0 -162
  758. data/gems/gems/rspec-1.2.9/spec/spec/example/example_proxy_spec.rb +0 -57
  759. data/gems/gems/rspec-1.2.9/spec/spec/example/helper_method_spec.rb +0 -24
  760. data/gems/gems/rspec-1.2.9/spec/spec/example/nested_example_group_spec.rb +0 -71
  761. data/gems/gems/rspec-1.2.9/spec/spec/example/pending_module_spec.rb +0 -58
  762. data/gems/gems/rspec-1.2.9/spec/spec/example/predicate_matcher_spec.rb +0 -41
  763. data/gems/gems/rspec-1.2.9/spec/spec/example/shared_example_group_spec.rb +0 -257
  764. data/gems/gems/rspec-1.2.9/spec/spec/example/subclassing_example_group_spec.rb +0 -25
  765. data/gems/gems/rspec-1.2.9/spec/spec/example/subject_spec.rb +0 -103
  766. data/gems/gems/rspec-1.2.9/spec/spec/expectations/differs/default_spec.rb +0 -194
  767. data/gems/gems/rspec-1.2.9/spec/spec/expectations/extensions/kernel_spec.rb +0 -45
  768. data/gems/gems/rspec-1.2.9/spec/spec/expectations/fail_with_spec.rb +0 -96
  769. data/gems/gems/rspec-1.2.9/spec/spec/expectations/handler_spec.rb +0 -206
  770. data/gems/gems/rspec-1.2.9/spec/spec/expectations/wrap_expectation_spec.rb +0 -30
  771. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/spec_that_fails.rb +0 -10
  772. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/spec_that_passes.rb +0 -10
  773. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/spec_with_errors.rb +0 -10
  774. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +0 -13
  775. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +0 -10
  776. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +0 -10
  777. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +0 -10
  778. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/test_case_with_various_names.rb +0 -22
  779. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +0 -38
  780. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/spec_spec.rb +0 -48
  781. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/test_unit_spec_helper.rb +0 -18
  782. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/testcase_spec.rb +0 -50
  783. data/gems/gems/rspec-1.2.9/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +0 -9
  784. data/gems/gems/rspec-1.2.9/spec/spec/matchers/be_close_spec.rb +0 -50
  785. data/gems/gems/rspec-1.2.9/spec/spec/matchers/be_instance_of_spec.rb +0 -36
  786. data/gems/gems/rspec-1.2.9/spec/spec/matchers/be_kind_of_spec.rb +0 -33
  787. data/gems/gems/rspec-1.2.9/spec/spec/matchers/be_spec.rb +0 -311
  788. data/gems/gems/rspec-1.2.9/spec/spec/matchers/change_spec.rb +0 -349
  789. data/gems/gems/rspec-1.2.9/spec/spec/matchers/compatibility_spec.rb +0 -28
  790. data/gems/gems/rspec-1.2.9/spec/spec/matchers/description_generation_spec.rb +0 -160
  791. data/gems/gems/rspec-1.2.9/spec/spec/matchers/dsl_spec.rb +0 -34
  792. data/gems/gems/rspec-1.2.9/spec/spec/matchers/eql_spec.rb +0 -33
  793. data/gems/gems/rspec-1.2.9/spec/spec/matchers/equal_spec.rb +0 -57
  794. data/gems/gems/rspec-1.2.9/spec/spec/matchers/exist_spec.rb +0 -65
  795. data/gems/gems/rspec-1.2.9/spec/spec/matchers/has_spec.rb +0 -81
  796. data/gems/gems/rspec-1.2.9/spec/spec/matchers/have_spec.rb +0 -396
  797. data/gems/gems/rspec-1.2.9/spec/spec/matchers/include_spec.rb +0 -88
  798. data/gems/gems/rspec-1.2.9/spec/spec/matchers/match_array_spec.rb +0 -108
  799. data/gems/gems/rspec-1.2.9/spec/spec/matchers/match_spec.rb +0 -57
  800. data/gems/gems/rspec-1.2.9/spec/spec/matchers/matcher_methods_spec.rb +0 -63
  801. data/gems/gems/rspec-1.2.9/spec/spec/matchers/matcher_spec.rb +0 -228
  802. data/gems/gems/rspec-1.2.9/spec/spec/matchers/matchers_spec.rb +0 -2
  803. data/gems/gems/rspec-1.2.9/spec/spec/matchers/operator_matcher_spec.rb +0 -191
  804. data/gems/gems/rspec-1.2.9/spec/spec/matchers/raise_error_spec.rb +0 -333
  805. data/gems/gems/rspec-1.2.9/spec/spec/matchers/respond_to_spec.rb +0 -116
  806. data/gems/gems/rspec-1.2.9/spec/spec/matchers/satisfy_spec.rb +0 -36
  807. data/gems/gems/rspec-1.2.9/spec/spec/matchers/simple_matcher_spec.rb +0 -93
  808. data/gems/gems/rspec-1.2.9/spec/spec/matchers/throw_symbol_spec.rb +0 -96
  809. data/gems/gems/rspec-1.2.9/spec/spec/mocks/any_number_of_times_spec.rb +0 -36
  810. data/gems/gems/rspec-1.2.9/spec/spec/mocks/argument_expectation_spec.rb +0 -23
  811. data/gems/gems/rspec-1.2.9/spec/spec/mocks/argument_matchers_spec.rb +0 -19
  812. data/gems/gems/rspec-1.2.9/spec/spec/mocks/at_least_spec.rb +0 -97
  813. data/gems/gems/rspec-1.2.9/spec/spec/mocks/at_most_spec.rb +0 -93
  814. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_10260_spec.rb +0 -8
  815. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_10263_spec.rb +0 -27
  816. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_11545_spec.rb +0 -32
  817. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_15719_spec.rb +0 -30
  818. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_496_spec.rb +0 -19
  819. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_600_spec.rb +0 -22
  820. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_7611_spec.rb +0 -19
  821. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_7805_spec.rb +0 -22
  822. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_8165_spec.rb +0 -31
  823. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_8302_spec.rb +0 -26
  824. data/gems/gems/rspec-1.2.9/spec/spec/mocks/bug_report_830_spec.rb +0 -21
  825. data/gems/gems/rspec-1.2.9/spec/spec/mocks/double_spec.rb +0 -12
  826. data/gems/gems/rspec-1.2.9/spec/spec/mocks/failing_argument_matchers_spec.rb +0 -95
  827. data/gems/gems/rspec-1.2.9/spec/spec/mocks/hash_including_matcher_spec.rb +0 -90
  828. data/gems/gems/rspec-1.2.9/spec/spec/mocks/hash_not_including_matcher_spec.rb +0 -67
  829. data/gems/gems/rspec-1.2.9/spec/spec/mocks/mock_ordering_spec.rb +0 -94
  830. data/gems/gems/rspec-1.2.9/spec/spec/mocks/mock_space_spec.rb +0 -54
  831. data/gems/gems/rspec-1.2.9/spec/spec/mocks/mock_spec.rb +0 -594
  832. data/gems/gems/rspec-1.2.9/spec/spec/mocks/multiple_return_value_spec.rb +0 -113
  833. data/gems/gems/rspec-1.2.9/spec/spec/mocks/nil_expectation_warning_spec.rb +0 -53
  834. data/gems/gems/rspec-1.2.9/spec/spec/mocks/null_object_mock_spec.rb +0 -54
  835. data/gems/gems/rspec-1.2.9/spec/spec/mocks/once_counts_spec.rb +0 -53
  836. data/gems/gems/rspec-1.2.9/spec/spec/mocks/options_hash_spec.rb +0 -35
  837. data/gems/gems/rspec-1.2.9/spec/spec/mocks/partial_mock_spec.rb +0 -164
  838. data/gems/gems/rspec-1.2.9/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +0 -66
  839. data/gems/gems/rspec-1.2.9/spec/spec/mocks/passing_argument_matchers_spec.rb +0 -145
  840. data/gems/gems/rspec-1.2.9/spec/spec/mocks/precise_counts_spec.rb +0 -52
  841. data/gems/gems/rspec-1.2.9/spec/spec/mocks/record_messages_spec.rb +0 -26
  842. data/gems/gems/rspec-1.2.9/spec/spec/mocks/stub_chain_spec.rb +0 -42
  843. data/gems/gems/rspec-1.2.9/spec/spec/mocks/stub_implementation_spec.rb +0 -31
  844. data/gems/gems/rspec-1.2.9/spec/spec/mocks/stub_spec.rb +0 -203
  845. data/gems/gems/rspec-1.2.9/spec/spec/mocks/stubbed_message_expectations_spec.rb +0 -26
  846. data/gems/gems/rspec-1.2.9/spec/spec/mocks/twice_counts_spec.rb +0 -67
  847. data/gems/gems/rspec-1.2.9/spec/spec/mocks/unstub_spec.rb +0 -127
  848. data/gems/gems/rspec-1.2.9/spec/spec/package/bin_spec_spec.rb +0 -16
  849. data/gems/gems/rspec-1.2.9/spec/spec/rake/spectask_spec.rb +0 -150
  850. data/gems/gems/rspec-1.2.9/spec/spec/runner/class_and_argument_parser_spec.rb +0 -23
  851. data/gems/gems/rspec-1.2.9/spec/spec/runner/command_line_spec.rb +0 -141
  852. data/gems/gems/rspec-1.2.9/spec/spec/runner/configuration_spec.rb +0 -320
  853. data/gems/gems/rspec-1.2.9/spec/spec/runner/drb_command_line_spec.rb +0 -107
  854. data/gems/gems/rspec-1.2.9/spec/spec/runner/example_group_runner_spec.rb +0 -26
  855. data/gems/gems/rspec-1.2.9/spec/spec/runner/examples.txt +0 -2
  856. data/gems/gems/rspec-1.2.9/spec/spec/runner/failed.txt +0 -3
  857. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/base_formatter_spec.rb +0 -30
  858. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/base_text_formatter_spec.rb +0 -113
  859. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +0 -45
  860. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +0 -33
  861. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +0 -377
  862. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/html_formatted-1.8.6.html +0 -377
  863. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/html_formatted-1.8.7.html +0 -377
  864. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/html_formatted-1.9.1.html +0 -377
  865. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/html_formatter_spec.rb +0 -118
  866. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/nested_text_formatter_spec.rb +0 -305
  867. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/profile_formatter_spec.rb +0 -70
  868. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +0 -149
  869. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/snippet_extractor_spec.rb +0 -18
  870. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/specdoc_formatter_spec.rb +0 -159
  871. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/text_mate_formatted-1.8.6-jruby.html +0 -371
  872. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +0 -371
  873. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +0 -371
  874. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +0 -371
  875. data/gems/gems/rspec-1.2.9/spec/spec/runner/formatter/text_mate_formatter_spec.rb +0 -106
  876. data/gems/gems/rspec-1.2.9/spec/spec/runner/heckle_runner_spec.rb +0 -78
  877. data/gems/gems/rspec-1.2.9/spec/spec/runner/heckler_spec.rb +0 -20
  878. data/gems/gems/rspec-1.2.9/spec/spec/runner/line_number_query/line_number_query_fixture.rb +0 -70
  879. data/gems/gems/rspec-1.2.9/spec/spec/runner/line_number_query_spec.rb +0 -129
  880. data/gems/gems/rspec-1.2.9/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +0 -51
  881. data/gems/gems/rspec-1.2.9/spec/spec/runner/option_parser_spec.rb +0 -545
  882. data/gems/gems/rspec-1.2.9/spec/spec/runner/options_spec.rb +0 -547
  883. data/gems/gems/rspec-1.2.9/spec/spec/runner/output_one_time_fixture.rb +0 -7
  884. data/gems/gems/rspec-1.2.9/spec/spec/runner/output_one_time_fixture_runner.rb +0 -7
  885. data/gems/gems/rspec-1.2.9/spec/spec/runner/output_one_time_spec.rb +0 -15
  886. data/gems/gems/rspec-1.2.9/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +0 -105
  887. data/gems/gems/rspec-1.2.9/spec/spec/runner/reporter_spec.rb +0 -244
  888. data/gems/gems/rspec-1.2.9/spec/spec/runner/resources/a_spec.rb +0 -1
  889. data/gems/gems/rspec-1.2.9/spec/spec/runner/resources/custom_example_group_runner.rb +0 -14
  890. data/gems/gems/rspec-1.2.9/spec/spec/runner/resources/utf8_encoded.rb +0 -8
  891. data/gems/gems/rspec-1.2.9/spec/spec/runner/spec.opts +0 -2
  892. data/gems/gems/rspec-1.2.9/spec/spec/runner/spec_drb.opts +0 -2
  893. data/gems/gems/rspec-1.2.9/spec/spec/runner/spec_spaced.opts +0 -2
  894. data/gems/gems/rspec-1.2.9/spec/spec/runner_spec.rb +0 -13
  895. data/gems/gems/rspec-1.2.9/spec/spec.opts +0 -6
  896. data/gems/gems/rspec-1.2.9/spec/spec_helper.rb +0 -112
  897. data/gems/gems/rspec-1.2.9/spec/support/macros.rb +0 -29
  898. data/gems/gems/rspec-1.2.9/spec/support/spec_classes.rb +0 -133
  899. data/gems/specifications/abstract-1.0.0.gemspec +0 -29
  900. data/gems/specifications/erubis-2.6.5.gemspec +0 -34
  901. data/gems/specifications/haml-2.2.16.gemspec +0 -45
  902. data/gems/specifications/rspec-1.2.9.gemspec +0 -58
  903. data/lib/simple-templater/version.rb +0 -7
  904. data/script/autospec +0 -3
  905. data/script/css2sass +0 -3
  906. data/script/erubis +0 -3
  907. data/script/haml +0 -3
  908. data/script/html2haml +0 -3
  909. data/script/sass +0 -3
  910. data/stubs/project/content/Rakefile +0 -39
  911. data/tasks/benchmark.rake +0 -11
  912. data/tasks/gem.rake +0 -23
  913. data/tasks/hooks.rake +0 -12
  914. data/tasks/release.rake +0 -68
  915. data/tasks/spec.rake +0 -27
  916. data/tasks/submodules.rake +0 -33
  917. data/tasks/yardoc.rake +0 -9
@@ -1,3330 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ###
4
- ### $Release: 2.6.5 $
5
- ### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
6
- ###
7
-
8
- #--begin of require 'erubis/main'
9
- ###
10
- ### $Release: 2.6.5 $
11
- ### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
12
- ###
13
-
14
- require 'yaml'
15
- #--begin of require 'erubis'
16
- ##
17
- ## $Release: 2.6.5 $
18
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
19
- ##
20
-
21
- ##
22
- ## an implementation of eRuby
23
- ##
24
- ## ex.
25
- ## input = <<'END'
26
- ## <ul>
27
- ## <% for item in @list %>
28
- ## <li><%= item %>
29
- ## <%== item %></li>
30
- ## <% end %>
31
- ## </ul>
32
- ## END
33
- ## list = ['<aaa>', 'b&b', '"ccc"']
34
- ## eruby = Erubis::Eruby.new(input)
35
- ## puts "--- code ---"
36
- ## puts eruby.src
37
- ## puts "--- result ---"
38
- ## context = Erubis::Context.new() # or new(:list=>list)
39
- ## context[:list] = list
40
- ## puts eruby.evaluate(context)
41
- ##
42
- ## result:
43
- ## --- source ---
44
- ## _buf = ''; _buf << '<ul>
45
- ## '; for item in @list
46
- ## _buf << ' <li>'; _buf << ( item ).to_s; _buf << '
47
- ## '; _buf << ' '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</li>
48
- ## '; end
49
- ## _buf << '</ul>
50
- ## ';
51
- ## _buf.to_s
52
- ## --- result ---
53
- ## <ul>
54
- ## <li><aaa>
55
- ## &lt;aaa&gt;</li>
56
- ## <li>b&b
57
- ## b&amp;b</li>
58
- ## <li>"ccc"
59
- ## &quot;ccc&quot;</li>
60
- ## </ul>
61
- ##
62
-
63
-
64
- module Erubis
65
- VERSION = ('$Release: 2.6.5 $' =~ /([.\d]+)/) && $1
66
- end
67
-
68
- #--begin of require 'erubis/engine'
69
- ##
70
- ## $Release: 2.6.5 $
71
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
72
- ##
73
-
74
-
75
- #--begin of require 'erubis/generator'
76
- ##
77
- ## $Release: 2.6.5 $
78
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
79
- ##
80
-
81
- #--begin of require 'abstract'
82
- ##
83
- ## $Rev: 1 $
84
- ## $Release: 0.1.0 $
85
- ## copyright(c) 2006 kuwata-lab.com all rights reserved.
86
- ##
87
- ##
88
- ## helper to define abstract method in Ruby.
89
- ##
90
- ##
91
- ## example1. (shorter notation)
92
- ##
93
- ## require 'abstract'
94
- ## class Foo
95
- ## abstract_method 'arg1, arg2=""', :method1, :method2, :method3
96
- ## end
97
- ##
98
- ##
99
- ## example2. (RDoc friendly notation)
100
- ##
101
- ## require 'abstract'
102
- ## class Bar
103
- ## # ... method1 description ...
104
- ## def method1(arg1, arg2="")
105
- ## not_implemented
106
- ## end
107
- ##
108
- ## # ... method2 description ...
109
- ## def method2(arg1, arg2="")
110
- ## not_implemented
111
- ## end
112
- ## end
113
- ##
114
-
115
-
116
- ##
117
- class Module
118
-
119
- ##
120
- ## define abstract methods
121
- ##
122
- def abstract_method args_str, *method_names
123
- method_names.each do |name|
124
- module_eval <<-END
125
- def #{name}(#{args_str})
126
- mesg = "class \#{self.class.name} must implement abstract method `#{self.name}##{name}()'."
127
- #mesg = "\#{self.class.name}##{name}() is not implemented."
128
- err = NotImplementedError.new mesg
129
- err.set_backtrace caller()
130
- raise err
131
- end
132
- END
133
- end
134
- end
135
-
136
- end
137
-
138
-
139
- ##
140
- module Kernel
141
-
142
- ##
143
- ## raise NotImplementedError
144
- ##
145
- def not_implemented #:doc:
146
- backtrace = caller()
147
- method_name = (backtrace.shift =~ /`(\w+)'$/) && $1
148
- mesg = "class #{self.class.name} must implement abstract method '#{method_name}()'."
149
- #mesg = "#{self.class.name}##{method_name}() is not implemented."
150
- err = NotImplementedError.new mesg
151
- err.set_backtrace backtrace
152
- raise err
153
- end
154
- private :not_implemented
155
-
156
- end
157
- #--end of require 'abstract'
158
-
159
- module Erubis
160
-
161
-
162
- ##
163
- ## code generator, called by Converter module
164
- ##
165
- module Generator
166
-
167
- def self.supported_properties() # :nodoc:
168
- return [
169
- [:escapefunc, nil, "escape function name"],
170
- ]
171
- end
172
-
173
- attr_accessor :escapefunc
174
-
175
- def init_generator(properties={})
176
- @escapefunc = properties[:escapefunc]
177
- end
178
-
179
-
180
- ## (abstract) escape text string
181
- ##
182
- ## ex.
183
- ## def escape_text(text)
184
- ## return text.dump
185
- ## # or return "'" + text.gsub(/['\\]/, '\\\\\&') + "'"
186
- ## end
187
- def escape_text(text)
188
- not_implemented
189
- end
190
-
191
- ## return escaped expression code (ex. 'h(...)' or 'htmlspecialchars(...)')
192
- def escaped_expr(code)
193
- code.strip!
194
- return "#{@escapefunc}(#{code})"
195
- end
196
-
197
- ## (abstract) add @preamble to src
198
- def add_preamble(src)
199
- not_implemented
200
- end
201
-
202
- ## (abstract) add text string to src
203
- def add_text(src, text)
204
- not_implemented
205
- end
206
-
207
- ## (abstract) add statement code to src
208
- def add_stmt(src, code)
209
- not_implemented
210
- end
211
-
212
- ## (abstract) add expression literal code to src. this is called by add_expr().
213
- def add_expr_literal(src, code)
214
- not_implemented
215
- end
216
-
217
- ## (abstract) add escaped expression code to src. this is called by add_expr().
218
- def add_expr_escaped(src, code)
219
- not_implemented
220
- end
221
-
222
- ## (abstract) add expression code to src for debug. this is called by add_expr().
223
- def add_expr_debug(src, code)
224
- not_implemented
225
- end
226
-
227
- ## (abstract) add @postamble to src
228
- def add_postamble(src)
229
- not_implemented
230
- end
231
-
232
-
233
- end
234
-
235
-
236
- end
237
- #--end of require 'erubis/generator'
238
- #--begin of require 'erubis/converter'
239
- ##
240
- ## $Release: 2.6.5 $
241
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
242
- ##
243
-
244
- #--already included require 'abstract'
245
-
246
- module Erubis
247
-
248
-
249
- ##
250
- ## convert
251
- ##
252
- module Converter
253
-
254
- attr_accessor :preamble, :postamble, :escape
255
-
256
- def self.supported_properties # :nodoc:
257
- return [
258
- [:preamble, nil, "preamble (no preamble when false)"],
259
- [:postamble, nil, "postamble (no postamble when false)"],
260
- [:escape, nil, "escape expression or not in default"],
261
- ]
262
- end
263
-
264
- def init_converter(properties={})
265
- @preamble = properties[:preamble]
266
- @postamble = properties[:postamble]
267
- @escape = properties[:escape]
268
- end
269
-
270
- ## convert input string into target language
271
- def convert(input)
272
- codebuf = "" # or []
273
- @preamble.nil? ? add_preamble(codebuf) : (@preamble && (codebuf << @preamble))
274
- convert_input(codebuf, input)
275
- @postamble.nil? ? add_postamble(codebuf) : (@postamble && (codebuf << @postamble))
276
- @_proc = nil # clear cached proc object
277
- return codebuf # or codebuf.join()
278
- end
279
-
280
- protected
281
-
282
- ##
283
- ## detect spaces at beginning of line
284
- ##
285
- def detect_spaces_at_bol(text, is_bol)
286
- lspace = nil
287
- if text.empty?
288
- lspace = "" if is_bol
289
- elsif text[-1] == ?\n
290
- lspace = ""
291
- else
292
- rindex = text.rindex(?\n)
293
- if rindex
294
- s = text[rindex+1..-1]
295
- if s =~ /\A[ \t]*\z/
296
- lspace = s
297
- #text = text[0..rindex]
298
- text[rindex+1..-1] = ''
299
- end
300
- else
301
- if is_bol && text =~ /\A[ \t]*\z/
302
- #lspace = text
303
- #text = nil
304
- lspace = text.dup
305
- text[0..-1] = ''
306
- end
307
- end
308
- end
309
- return lspace
310
- end
311
-
312
- ##
313
- ## (abstract) convert input to code
314
- ##
315
- def convert_input(codebuf, input)
316
- not_implemented
317
- end
318
-
319
- end
320
-
321
-
322
- module Basic
323
- end
324
-
325
-
326
- ##
327
- ## basic converter which supports '<% ... %>' notation.
328
- ##
329
- module Basic::Converter
330
- include Erubis::Converter
331
-
332
- def self.supported_properties # :nodoc:
333
- return [
334
- [:pattern, '<% %>', "embed pattern"],
335
- [:trim, true, "trim spaces around <% ... %>"],
336
- ]
337
- end
338
-
339
- attr_accessor :pattern, :trim
340
-
341
- def init_converter(properties={})
342
- super(properties)
343
- @pattern = properties[:pattern]
344
- @trim = properties[:trim] != false
345
- end
346
-
347
- protected
348
-
349
- ## return regexp of pattern to parse eRuby script
350
- def pattern_regexp(pattern)
351
- @prefix, @postfix = pattern.split() # '<% %>' => '<%', '%>'
352
- #return /(.*?)(^[ \t]*)?#{@prefix}(=+|\#)?(.*?)-?#{@postfix}([ \t]*\r?\n)?/m
353
- #return /(^[ \t]*)?#{@prefix}(=+|\#)?(.*?)-?#{@postfix}([ \t]*\r?\n)?/m
354
- return /#{@prefix}(=+|-|\#|%)?(.*?)([-=])?#{@postfix}([ \t]*\r?\n)?/m
355
- end
356
- module_function :pattern_regexp
357
-
358
- #DEFAULT_REGEXP = /(.*?)(^[ \t]*)?<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
359
- #DEFAULT_REGEXP = /(^[ \t]*)?<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
360
- #DEFAULT_REGEXP = /<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
361
- DEFAULT_REGEXP = pattern_regexp('<% %>')
362
-
363
- public
364
-
365
- def convert_input(src, input)
366
- pat = @pattern
367
- regexp = pat.nil? || pat == '<% %>' ? DEFAULT_REGEXP : pattern_regexp(pat)
368
- pos = 0
369
- is_bol = true # is beginning of line
370
- input.scan(regexp) do |indicator, code, tailch, rspace|
371
- match = Regexp.last_match()
372
- len = match.begin(0) - pos
373
- text = input[pos, len]
374
- pos = match.end(0)
375
- ch = indicator ? indicator[0] : nil
376
- lspace = ch == ?= ? nil : detect_spaces_at_bol(text, is_bol)
377
- is_bol = rspace ? true : false
378
- add_text(src, text) if text && !text.empty?
379
- ## * when '<%= %>', do nothing
380
- ## * when '<% %>' or '<%# %>', delete spaces iff only spaces are around '<% %>'
381
- if ch == ?= # <%= %>
382
- rspace = nil if tailch && !tailch.empty?
383
- add_text(src, lspace) if lspace
384
- add_expr(src, code, indicator)
385
- add_text(src, rspace) if rspace
386
- elsif ch == ?\# # <%# %>
387
- n = code.count("\n") + (rspace ? 1 : 0)
388
- if @trim && lspace && rspace
389
- add_stmt(src, "\n" * n)
390
- else
391
- add_text(src, lspace) if lspace
392
- add_stmt(src, "\n" * n)
393
- add_text(src, rspace) if rspace
394
- end
395
- elsif ch == ?% # <%% %>
396
- s = "#{lspace}#{@prefix||='<%'}#{code}#{tailch}#{@postfix||='%>'}#{rspace}"
397
- add_text(src, s)
398
- else # <% %>
399
- if @trim && lspace && rspace
400
- add_stmt(src, "#{lspace}#{code}#{rspace}")
401
- else
402
- add_text(src, lspace) if lspace
403
- add_stmt(src, code)
404
- add_text(src, rspace) if rspace
405
- end
406
- end
407
- end
408
- #rest = $' || input # ruby1.8
409
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
410
- add_text(src, rest)
411
- end
412
-
413
- ## add expression code to src
414
- def add_expr(src, code, indicator)
415
- case indicator
416
- when '='
417
- @escape ? add_expr_escaped(src, code) : add_expr_literal(src, code)
418
- when '=='
419
- @escape ? add_expr_literal(src, code) : add_expr_escaped(src, code)
420
- when '==='
421
- add_expr_debug(src, code)
422
- end
423
- end
424
-
425
- end
426
-
427
-
428
- module PI
429
- end
430
-
431
- ##
432
- ## Processing Instructions (PI) converter for XML.
433
- ## this class converts '<?rb ... ?>' and '${...}' notation.
434
- ##
435
- module PI::Converter
436
- include Erubis::Converter
437
-
438
- def self.desc # :nodoc:
439
- "use processing instructions (PI) instead of '<% %>'"
440
- end
441
-
442
- def self.supported_properties # :nodoc:
443
- return [
444
- [:trim, true, "trim spaces around <% ... %>"],
445
- [:pi, 'rb', "PI (Processing Instrunctions) name"],
446
- [:embchar, '@', "char for embedded expression pattern('@{...}@')"],
447
- [:pattern, '<% %>', "embed pattern"],
448
- ]
449
- end
450
-
451
- attr_accessor :pi, :prefix
452
-
453
- def init_converter(properties={})
454
- super(properties)
455
- @trim = properties.fetch(:trim, true)
456
- @pi = properties[:pi] if properties[:pi]
457
- @embchar = properties[:embchar] || '@'
458
- @pattern = properties[:pattern]
459
- @pattern = '<% %>' if @pattern.nil? #|| @pattern == true
460
- end
461
-
462
- def convert(input)
463
- code = super(input)
464
- return @header || @footer ? "#{@header}#{code}#{@footer}" : code
465
- end
466
-
467
- protected
468
-
469
- def convert_input(codebuf, input)
470
- unless @regexp
471
- @pi ||= 'e'
472
- ch = Regexp.escape(@embchar)
473
- if @pattern
474
- left, right = @pattern.split(' ')
475
- @regexp = /<\?#{@pi}(?:-(\w+))?(\s.*?)\?>([ \t]*\r?\n)?|#{ch}(!*)?\{(.*?)\}#{ch}|#{left}(=+)(.*?)#{right}/m
476
- else
477
- @regexp = /<\?#{@pi}(?:-(\w+))?(\s.*?)\?>([ \t]*\r?\n)?|#{ch}(!*)?\{(.*?)\}#{ch}/m
478
- end
479
- end
480
- #
481
- is_bol = true
482
- pos = 0
483
- input.scan(@regexp) do |pi_arg, stmt, rspace,
484
- indicator1, expr1, indicator2, expr2|
485
- match = Regexp.last_match
486
- len = match.begin(0) - pos
487
- text = input[pos, len]
488
- pos = match.end(0)
489
- lspace = stmt ? detect_spaces_at_bol(text, is_bol) : nil
490
- is_bol = stmt && rspace ? true : false
491
- add_text(codebuf, text) # unless text.empty?
492
- #
493
- if stmt
494
- if @trim && lspace && rspace
495
- add_pi_stmt(codebuf, "#{lspace}#{stmt}#{rspace}", pi_arg)
496
- else
497
- add_text(codebuf, lspace) if lspace
498
- add_pi_stmt(codebuf, stmt, pi_arg)
499
- add_text(codebuf, rspace) if rspace
500
- end
501
- else
502
- add_pi_expr(codebuf, expr1 || expr2, indicator1 || indicator2)
503
- end
504
- end
505
- #rest = $' || input # ruby1.8
506
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
507
- add_text(codebuf, rest)
508
- end
509
-
510
- #--
511
- #def convert_input(codebuf, input)
512
- # parse_stmts(codebuf, input)
513
- # #parse_stmts2(codebuf, input)
514
- #end
515
- #
516
- #def parse_stmts(codebuf, input)
517
- # #regexp = pattern_regexp(@pattern)
518
- # @pi ||= 'e'
519
- # @stmt_pattern ||= /<\?#{@pi}(?:-(\w+))?(\s.*?)\?>([ \t]*\r?\n)?/m
520
- # is_bol = true
521
- # pos = 0
522
- # input.scan(@stmt_pattern) do |pi_arg, code, rspace|
523
- # match = Regexp.last_match
524
- # len = match.begin(0) - pos
525
- # text = input[pos, len]
526
- # pos = match.end(0)
527
- # lspace = detect_spaces_at_bol(text, is_bol)
528
- # is_bol = rspace ? true : false
529
- # parse_exprs(codebuf, text) # unless text.empty?
530
- # if @trim && lspace && rspace
531
- # add_pi_stmt(codebuf, "#{lspace}#{code}#{rspace}", pi_arg)
532
- # else
533
- # add_text(codebuf, lspace)
534
- # add_pi_stmt(codebuf, code, pi_arg)
535
- # add_text(codebuf, rspace)
536
- # end
537
- # end
538
- # rest = $' || input
539
- # parse_exprs(codebuf, rest)
540
- #end
541
- #
542
- #def parse_exprs(codebuf, input)
543
- # unless @expr_pattern
544
- # ch = Regexp.escape(@embchar)
545
- # if @pattern
546
- # left, right = @pattern.split(' ')
547
- # @expr_pattern = /#{ch}(!*)?\{(.*?)\}#{ch}|#{left}(=+)(.*?)#{right}/
548
- # else
549
- # @expr_pattern = /#{ch}(!*)?\{(.*?)\}#{ch}/
550
- # end
551
- # end
552
- # pos = 0
553
- # input.scan(@expr_pattern) do |indicator1, code1, indicator2, code2|
554
- # indicator = indicator1 || indicator2
555
- # code = code1 || code2
556
- # match = Regexp.last_match
557
- # len = match.begin(0) - pos
558
- # text = input[pos, len]
559
- # pos = match.end(0)
560
- # add_text(codebuf, text) # unless text.empty?
561
- # add_pi_expr(codebuf, code, indicator)
562
- # end
563
- # rest = $' || input
564
- # add_text(codebuf, rest)
565
- #end
566
- #++
567
-
568
- def add_pi_stmt(codebuf, code, pi_arg) # :nodoc:
569
- case pi_arg
570
- when nil ; add_stmt(codebuf, code)
571
- when 'header' ; @header = code
572
- when 'footer' ; @footer = code
573
- when 'comment'; add_stmt(codebuf, "\n" * code.count("\n"))
574
- when 'value' ; add_expr_literal(codebuf, code)
575
- else ; add_stmt(codebuf, code)
576
- end
577
- end
578
-
579
- def add_pi_expr(codebuf, code, indicator) # :nodoc:
580
- case indicator
581
- when nil, '', '==' # @{...}@ or <%== ... %>
582
- @escape == false ? add_expr_literal(codebuf, code) : add_expr_escaped(codebuf, code)
583
- when '!', '=' # @!{...}@ or <%= ... %>
584
- @escape == false ? add_expr_escaped(codebuf, code) : add_expr_literal(codebuf, code)
585
- when '!!', '===' # @!!{...}@ or <%=== ... %>
586
- add_expr_debug(codebuf, code)
587
- else
588
- # ignore
589
- end
590
- end
591
-
592
- end
593
-
594
-
595
- end
596
- #--end of require 'erubis/converter'
597
- #--begin of require 'erubis/evaluator'
598
- ##
599
- ## $Release: 2.6.5 $
600
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
601
- ##
602
-
603
- #--begin of require 'erubis/error'
604
- ##
605
- ## $Release: 2.6.5 $
606
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
607
- ##
608
-
609
- module Erubis
610
-
611
-
612
- ##
613
- ## base error class
614
- ##
615
- class ErubisError < StandardError
616
- end
617
-
618
-
619
- ##
620
- ## raised when method or function is not supported
621
- ##
622
- class NotSupportedError < ErubisError
623
- end
624
-
625
-
626
- end
627
- #--end of require 'erubis/error'
628
- #--begin of require 'erubis/context'
629
- ##
630
- ## $Release: 2.6.5 $
631
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
632
- ##
633
-
634
-
635
- module Erubis
636
-
637
-
638
- ##
639
- ## context object for Engine#evaluate
640
- ##
641
- ## ex.
642
- ## template = <<'END'
643
- ## Hello <%= @user %>!
644
- ## <% for item in @list %>
645
- ## - <%= item %>
646
- ## <% end %>
647
- ## END
648
- ##
649
- ## context = Erubis::Context.new(:user=>'World', :list=>['a','b','c'])
650
- ## # or
651
- ## # context = Erubis::Context.new
652
- ## # context[:user] = 'World'
653
- ## # context[:list] = ['a', 'b', 'c']
654
- ##
655
- ## eruby = Erubis::Eruby.new(template)
656
- ## print eruby.evaluate(context)
657
- ##
658
- class Context
659
- include Enumerable
660
-
661
- def initialize(hash=nil)
662
- hash.each do |name, value|
663
- self[name] = value
664
- end if hash
665
- end
666
-
667
- def [](key)
668
- return instance_variable_get("@#{key}")
669
- end
670
-
671
- def []=(key, value)
672
- return instance_variable_set("@#{key}", value)
673
- end
674
-
675
- def keys
676
- return instance_variables.collect { |name| name[1..-1] }
677
- end
678
-
679
- def each
680
- instance_variables.each do |name|
681
- key = name[1..-1]
682
- value = instance_variable_get(name)
683
- yield(key, value)
684
- end
685
- end
686
-
687
- def to_hash
688
- hash = {}
689
- self.keys.each { |key| hash[key] = self[key] }
690
- return hash
691
- end
692
-
693
- def update(context_or_hash)
694
- arg = context_or_hash
695
- if arg.is_a?(Hash)
696
- arg.each do |key, val|
697
- self[key] = val
698
- end
699
- else
700
- arg.instance_variables.each do |varname|
701
- key = varname[1..-1]
702
- val = arg.instance_variable_get(varname)
703
- self[key] = val
704
- end
705
- end
706
- end
707
-
708
- end
709
-
710
-
711
- end
712
- #--end of require 'erubis/context'
713
-
714
-
715
- module Erubis
716
-
717
- EMPTY_BINDING = binding()
718
-
719
-
720
- ##
721
- ## evaluate code
722
- ##
723
- module Evaluator
724
-
725
- def self.supported_properties # :nodoc:
726
- return []
727
- end
728
-
729
- attr_accessor :src, :filename
730
-
731
- def init_evaluator(properties)
732
- @filename = properties[:filename]
733
- end
734
-
735
- def result(*args)
736
- raise NotSupportedError.new("evaluation of code except Ruby is not supported.")
737
- end
738
-
739
- def evaluate(*args)
740
- raise NotSupportedError.new("evaluation of code except Ruby is not supported.")
741
- end
742
-
743
- end
744
-
745
-
746
- ##
747
- ## evaluator for Ruby
748
- ##
749
- module RubyEvaluator
750
- include Evaluator
751
-
752
- def self.supported_properties # :nodoc:
753
- list = Evaluator.supported_properties
754
- return list
755
- end
756
-
757
- ## eval(@src) with binding object
758
- def result(_binding_or_hash=TOPLEVEL_BINDING)
759
- _arg = _binding_or_hash
760
- if _arg.is_a?(Hash)
761
- _b = binding()
762
- eval _arg.collect{|k,v| "#{k} = _arg[#{k.inspect}]; "}.join, _b
763
- elsif _arg.is_a?(Binding)
764
- _b = _arg
765
- elsif _arg.nil?
766
- _b = binding()
767
- else
768
- raise ArgumentError.new("#{self.class.name}#result(): argument should be Binding or Hash but passed #{_arg.class.name} object.")
769
- end
770
- return eval(@src, _b, (@filename || '(erubis'))
771
- end
772
-
773
- ## invoke context.instance_eval(@src)
774
- def evaluate(_context=Context.new)
775
- _context = Context.new(_context) if _context.is_a?(Hash)
776
- #return _context.instance_eval(@src, @filename || '(erubis)')
777
- #@_proc ||= eval("proc { #{@src} }", Erubis::EMPTY_BINDING, @filename || '(erubis)')
778
- @_proc ||= eval("proc { #{@src} }", binding(), @filename || '(erubis)')
779
- return _context.instance_eval(&@_proc)
780
- end
781
-
782
- ## if object is an Class or Module then define instance method to it,
783
- ## else define singleton method to it.
784
- def def_method(object, method_name, filename=nil)
785
- m = object.is_a?(Module) ? :module_eval : :instance_eval
786
- object.__send__(m, "def #{method_name}; #{@src}; end", filename || @filename || '(erubis)')
787
- end
788
-
789
-
790
- end
791
-
792
-
793
- end
794
- #--end of require 'erubis/evaluator'
795
- #--already included require 'erubis/context'
796
-
797
-
798
- module Erubis
799
-
800
-
801
- ##
802
- ## (abstract) abstract engine class.
803
- ## subclass must include evaluator and converter module.
804
- ##
805
- class Engine
806
- #include Evaluator
807
- #include Converter
808
- #include Generator
809
-
810
- def initialize(input=nil, properties={})
811
- #@input = input
812
- init_generator(properties)
813
- init_converter(properties)
814
- init_evaluator(properties)
815
- @src = convert(input) if input
816
- end
817
-
818
-
819
- ##
820
- ## convert input string and set it to @src
821
- ##
822
- def convert!(input)
823
- @src = convert(input)
824
- end
825
-
826
-
827
- ##
828
- ## load file, write cache file, and return engine object.
829
- ## this method create code cache file automatically.
830
- ## cachefile name can be specified with properties[:cachename],
831
- ## or filname + 'cache' is used as default.
832
- ##
833
- def self.load_file(filename, properties={})
834
- cachename = properties[:cachename] || (filename + '.cache')
835
- properties[:filename] = filename
836
- if test(?f, cachename) && File.mtime(filename) <= File.mtime(cachename)
837
- engine = self.new(nil, properties)
838
- engine.src = File.read(cachename)
839
- else
840
- input = File.open(filename, 'rb') {|f| f.read }
841
- engine = self.new(input, properties)
842
- File.open(cachename, 'wb') do |f|
843
- f.flock(File::LOCK_EX)
844
- f.write(engine.src)
845
- f.flush()
846
- end
847
- end
848
- engine.src.untaint # ok?
849
- return engine
850
- end
851
-
852
-
853
- ##
854
- ## helper method to convert and evaluate input text with context object.
855
- ## context may be Binding, Hash, or Object.
856
- ##
857
- def process(input, context=nil, filename=nil)
858
- code = convert(input)
859
- filename ||= '(erubis)'
860
- if context.is_a?(Binding)
861
- return eval(code, context, filename)
862
- else
863
- context = Context.new(context) if context.is_a?(Hash)
864
- return context.instance_eval(code, filename)
865
- end
866
- end
867
-
868
-
869
- ##
870
- ## helper method evaluate Proc object with contect object.
871
- ## context may be Binding, Hash, or Object.
872
- ##
873
- def process_proc(proc_obj, context=nil, filename=nil)
874
- if context.is_a?(Binding)
875
- filename ||= '(erubis)'
876
- return eval(proc_obj, context, filename)
877
- else
878
- context = Context.new(context) if context.is_a?(Hash)
879
- return context.instance_eval(&proc_obj)
880
- end
881
- end
882
-
883
-
884
- end # end of class Engine
885
-
886
-
887
- ##
888
- ## (abstract) base engine class for Eruby, Eperl, Ejava, and so on.
889
- ## subclass must include generator.
890
- ##
891
- class Basic::Engine < Engine
892
- include Evaluator
893
- include Basic::Converter
894
- include Generator
895
- end
896
-
897
-
898
- class PI::Engine < Engine
899
- include Evaluator
900
- include PI::Converter
901
- include Generator
902
- end
903
-
904
-
905
- end
906
- #--end of require 'erubis/engine'
907
- #require 'erubis/generator'
908
- #require 'erubis/converter'
909
- #require 'erubis/evaluator'
910
- #require 'erubis/error'
911
- #require 'erubis/context'
912
- #--begin of require 'erubis/helper'
913
- ##
914
- ## $Release: 2.6.5 $
915
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
916
- ##
917
-
918
-
919
- module Erubis
920
-
921
- ##
922
- ## helper for xml
923
- ##
924
- module XmlHelper
925
-
926
- module_function
927
-
928
- ESCAPE_TABLE = {
929
- '&' => '&amp;',
930
- '<' => '&lt;',
931
- '>' => '&gt;',
932
- '"' => '&quot;',
933
- "'" => '&#039;',
934
- }
935
-
936
- def escape_xml(value)
937
- value.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] } # or /[&<>"']/
938
- #value.to_s.gsub(/[&<>"]/) { ESCAPE_TABLE[$&] }
939
- end
940
-
941
- def escape_xml2(value)
942
- return value.to_s.gsub(/\&/,'&amp;').gsub(/</,'&lt;').gsub(/>/,'&gt;').gsub(/"/,'&quot;')
943
- end
944
-
945
- alias h escape_xml
946
- alias html_escape escape_xml
947
-
948
- def url_encode(str)
949
- return str.gsub(/[^-_.a-zA-Z0-9]+/) { |s|
950
- s.unpack('C*').collect { |i| "%%%02X" % i }.join
951
- }
952
- end
953
-
954
- alias u url_encode
955
-
956
- end
957
-
958
-
959
- end
960
- #--end of require 'erubis/helper'
961
- #--begin of require 'erubis/enhancer'
962
- ##
963
- ## $Release: 2.6.5 $
964
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
965
- ##
966
-
967
-
968
- module Erubis
969
-
970
-
971
- ##
972
- ## switch '<%= ... %>' to escaped and '<%== ... %>' to unescaped
973
- ##
974
- ## ex.
975
- ## class XmlEruby < Eruby
976
- ## include EscapeEnhancer
977
- ## end
978
- ##
979
- ## this is language-indenedent.
980
- ##
981
- module EscapeEnhancer
982
-
983
- def self.desc # :nodoc:
984
- "switch '<%= %>' to escaped and '<%== %>' to unescaped"
985
- end
986
-
987
- #--
988
- #def self.included(klass)
989
- # klass.class_eval <<-END
990
- # alias _add_expr_literal add_expr_literal
991
- # alias _add_expr_escaped add_expr_escaped
992
- # alias add_expr_literal _add_expr_escaped
993
- # alias add_expr_escaped _add_expr_literal
994
- # END
995
- #end
996
- #++
997
-
998
- def add_expr(src, code, indicator)
999
- case indicator
1000
- when '='
1001
- @escape ? add_expr_literal(src, code) : add_expr_escaped(src, code)
1002
- when '=='
1003
- @escape ? add_expr_escaped(src, code) : add_expr_literal(src, code)
1004
- when '==='
1005
- add_expr_debug(src, code)
1006
- end
1007
- end
1008
-
1009
- end
1010
-
1011
-
1012
- #--
1013
- ## (obsolete)
1014
- #module FastEnhancer
1015
- #end
1016
- #++
1017
-
1018
-
1019
- ##
1020
- ## use $stdout instead of string
1021
- ##
1022
- ## this is only for Eruby.
1023
- ##
1024
- module StdoutEnhancer
1025
-
1026
- def self.desc # :nodoc:
1027
- "use $stdout instead of array buffer or string buffer"
1028
- end
1029
-
1030
- def add_preamble(src)
1031
- src << "_buf = $stdout;"
1032
- end
1033
-
1034
- def add_postamble(src)
1035
- src << "\n''\n"
1036
- end
1037
-
1038
- end
1039
-
1040
-
1041
- ##
1042
- ## use print statement instead of '_buf << ...'
1043
- ##
1044
- ## this is only for Eruby.
1045
- ##
1046
- module PrintOutEnhancer
1047
-
1048
- def self.desc # :nodoc:
1049
- "use print statement instead of '_buf << ...'"
1050
- end
1051
-
1052
- def add_preamble(src)
1053
- end
1054
-
1055
- def add_text(src, text)
1056
- src << " print '" << escape_text(text) << "';" unless text.empty?
1057
- end
1058
-
1059
- def add_expr_literal(src, code)
1060
- src << ' print((' << code << ').to_s);'
1061
- end
1062
-
1063
- def add_expr_escaped(src, code)
1064
- src << ' print ' << escaped_expr(code) << ';'
1065
- end
1066
-
1067
- def add_postamble(src)
1068
- src << "\n" unless src[-1] == ?\n
1069
- end
1070
-
1071
- end
1072
-
1073
-
1074
- ##
1075
- ## enable print function
1076
- ##
1077
- ## Notice: use Eruby#evaluate() and don't use Eruby#result()
1078
- ## to be enable print function.
1079
- ##
1080
- ## this is only for Eruby.
1081
- ##
1082
- module PrintEnabledEnhancer
1083
-
1084
- def self.desc # :nodoc:
1085
- "enable to use print function in '<% %>'"
1086
- end
1087
-
1088
- def add_preamble(src)
1089
- src << "@_buf = "
1090
- super
1091
- end
1092
-
1093
- def print(*args)
1094
- args.each do |arg|
1095
- @_buf << arg.to_s
1096
- end
1097
- end
1098
-
1099
- def evaluate(context=nil)
1100
- _src = @src
1101
- if context.is_a?(Hash)
1102
- context.each do |key, val| instance_variable_set("@#{key}", val) end
1103
- elsif context
1104
- context.instance_variables.each do |name|
1105
- instance_variable_set(name, context.instance_variable_get(name))
1106
- end
1107
- end
1108
- return instance_eval(_src, (@filename || '(erubis)'))
1109
- end
1110
-
1111
- end
1112
-
1113
-
1114
- ##
1115
- ## return array instead of string
1116
- ##
1117
- ## this is only for Eruby.
1118
- ##
1119
- module ArrayEnhancer
1120
-
1121
- def self.desc # :nodoc:
1122
- "return array instead of string"
1123
- end
1124
-
1125
- def add_preamble(src)
1126
- src << "_buf = [];"
1127
- end
1128
-
1129
- def add_postamble(src)
1130
- src << "\n" unless src[-1] == ?\n
1131
- src << "_buf\n"
1132
- end
1133
-
1134
- end
1135
-
1136
-
1137
- ##
1138
- ## use an Array object as buffer (included in Eruby by default)
1139
- ##
1140
- ## this is only for Eruby.
1141
- ##
1142
- module ArrayBufferEnhancer
1143
-
1144
- def self.desc # :nodoc:
1145
- "use an Array object for buffering (included in Eruby class)"
1146
- end
1147
-
1148
- def add_preamble(src)
1149
- src << "_buf = [];"
1150
- end
1151
-
1152
- def add_postamble(src)
1153
- src << "\n" unless src[-1] == ?\n
1154
- src << "_buf.join\n"
1155
- end
1156
-
1157
- end
1158
-
1159
-
1160
- ##
1161
- ## use String class for buffering
1162
- ##
1163
- ## this is only for Eruby.
1164
- ##
1165
- module StringBufferEnhancer
1166
-
1167
- def self.desc # :nodoc:
1168
- "use a String object for buffering"
1169
- end
1170
-
1171
- def add_preamble(src)
1172
- src << "_buf = '';"
1173
- end
1174
-
1175
- def add_postamble(src)
1176
- src << "\n" unless src[-1] == ?\n
1177
- src << "_buf.to_s\n"
1178
- end
1179
-
1180
- end
1181
-
1182
-
1183
- ##
1184
- ## use StringIO class for buffering
1185
- ##
1186
- ## this is only for Eruby.
1187
- ##
1188
- module StringIOEnhancer # :nodoc:
1189
-
1190
- def self.desc # :nodoc:
1191
- "use a StringIO object for buffering"
1192
- end
1193
-
1194
- def add_preamble(src)
1195
- src << "_buf = StringIO.new;"
1196
- end
1197
-
1198
- def add_postamble(src)
1199
- src << "\n" unless src[-1] == ?\n
1200
- src << "_buf.string\n"
1201
- end
1202
-
1203
- end
1204
-
1205
-
1206
- ##
1207
- ## set buffer variable name to '_erbout' as well as '_buf'
1208
- ##
1209
- ## this is only for Eruby.
1210
- ##
1211
- module ErboutEnhancer
1212
-
1213
- def self.desc # :nodoc:
1214
- "set '_erbout = _buf = \"\";' to be compatible with ERB."
1215
- end
1216
-
1217
- def add_preamble(src)
1218
- src << "_erbout = _buf = '';"
1219
- end
1220
-
1221
- def add_postamble(src)
1222
- src << "\n" unless src[-1] == ?\n
1223
- src << "_buf.to_s\n"
1224
- end
1225
-
1226
- end
1227
-
1228
-
1229
- ##
1230
- ## remove text and leave code, especially useful when debugging.
1231
- ##
1232
- ## ex.
1233
- ## $ erubis -s -E NoText file.eruby | more
1234
- ##
1235
- ## this is language independent.
1236
- ##
1237
- module NoTextEnhancer
1238
-
1239
- def self.desc # :nodoc:
1240
- "remove text and leave code (useful when debugging)"
1241
- end
1242
-
1243
- def add_text(src, text)
1244
- src << ("\n" * text.count("\n"))
1245
- if text[-1] != ?\n
1246
- text =~ /^(.*?)\z/
1247
- src << (' ' * $1.length)
1248
- end
1249
- end
1250
-
1251
- end
1252
-
1253
-
1254
- ##
1255
- ## remove code and leave text, especially useful when validating HTML tags.
1256
- ##
1257
- ## ex.
1258
- ## $ erubis -s -E NoCode file.eruby | tidy -errors
1259
- ##
1260
- ## this is language independent.
1261
- ##
1262
- module NoCodeEnhancer
1263
-
1264
- def self.desc # :nodoc:
1265
- "remove code and leave text (useful when validating HTML)"
1266
- end
1267
-
1268
- def add_preamble(src)
1269
- end
1270
-
1271
- def add_postamble(src)
1272
- end
1273
-
1274
- def add_text(src, text)
1275
- src << text
1276
- end
1277
-
1278
- def add_expr(src, code, indicator)
1279
- src << "\n" * code.count("\n")
1280
- end
1281
-
1282
- def add_stmt(src, code)
1283
- src << "\n" * code.count("\n")
1284
- end
1285
-
1286
- end
1287
-
1288
-
1289
- ##
1290
- ## get convert faster, but spaces around '<%...%>' are not trimmed.
1291
- ##
1292
- ## this is language-independent.
1293
- ##
1294
- module SimplifyEnhancer
1295
-
1296
- def self.desc # :nodoc:
1297
- "get convert faster but leave spaces around '<% %>'"
1298
- end
1299
-
1300
- #DEFAULT_REGEXP = /(^[ \t]*)?<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
1301
- SIMPLE_REGEXP = /<%(=+|\#)?(.*?)-?%>/m
1302
-
1303
- def convert(input)
1304
- src = ""
1305
- add_preamble(src)
1306
- #regexp = pattern_regexp(@pattern)
1307
- pos = 0
1308
- input.scan(SIMPLE_REGEXP) do |indicator, code|
1309
- match = Regexp.last_match
1310
- index = match.begin(0)
1311
- text = input[pos, index - pos]
1312
- pos = match.end(0)
1313
- add_text(src, text)
1314
- if !indicator # <% %>
1315
- add_stmt(src, code)
1316
- elsif indicator[0] == ?\# # <%# %>
1317
- n = code.count("\n")
1318
- add_stmt(src, "\n" * n)
1319
- else # <%= %>
1320
- add_expr(src, code, indicator)
1321
- end
1322
- end
1323
- #rest = $' || input # ruby1.8
1324
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
1325
- add_text(src, rest)
1326
- add_postamble(src)
1327
- return src
1328
- end
1329
-
1330
- end
1331
-
1332
-
1333
- ##
1334
- ## enable to use other embedded expression pattern (default is '\[= =\]').
1335
- ##
1336
- ## notice! this is an experimental. spec may change in the future.
1337
- ##
1338
- ## ex.
1339
- ## input = <<END
1340
- ## <% for item in list %>
1341
- ## <%= item %> : <%== item %>
1342
- ## [= item =] : [== item =]
1343
- ## <% end %>
1344
- ## END
1345
- ##
1346
- ## class BiPatternEruby
1347
- ## include BiPatternEnhancer
1348
- ## end
1349
- ## eruby = BiPatternEruby.new(input, :bipattern=>'\[= =\]')
1350
- ## list = ['<a>', 'b&b', '"c"']
1351
- ## print eruby.result(binding())
1352
- ##
1353
- ## ## output
1354
- ## <a> : &lt;a&gt;
1355
- ## <a> : &lt;a&gt;
1356
- ## b&b : b&amp;b
1357
- ## b&b : b&amp;b
1358
- ## "c" : &quot;c&quot;
1359
- ## "c" : &quot;c&quot;
1360
- ##
1361
- ## this is language independent.
1362
- ##
1363
- module BiPatternEnhancer
1364
-
1365
- def self.desc # :nodoc:
1366
- "another embedded expression pattern (default '\[= =\]')."
1367
- end
1368
-
1369
- def initialize(input, properties={})
1370
- self.bipattern = properties[:bipattern] # or '\$\{ \}'
1371
- super
1372
- end
1373
-
1374
- ## when pat is nil then '\[= =\]' is used
1375
- def bipattern=(pat) # :nodoc:
1376
- @bipattern = pat || '\[= =\]'
1377
- pre, post = @bipattern.split()
1378
- @bipattern_regexp = /(.*?)#{pre}(=*)(.*?)#{post}/m
1379
- end
1380
-
1381
- def add_text(src, text)
1382
- return unless text
1383
- m = nil
1384
- text.scan(@bipattern_regexp) do |txt, indicator, code|
1385
- m = Regexp.last_match
1386
- super(src, txt)
1387
- add_expr(src, code, '=' + indicator)
1388
- end
1389
- #rest = $' || text # ruby1.8
1390
- rest = m ? text[m.end(0)..-1] : text # ruby1.9
1391
- super(src, rest)
1392
- end
1393
-
1394
- end
1395
-
1396
-
1397
- ##
1398
- ## regards lines starting with '%' as program code
1399
- ##
1400
- ## this is for compatibility to eruby and ERB.
1401
- ##
1402
- ## this is language-independent.
1403
- ##
1404
- module PercentLineEnhancer
1405
-
1406
- def self.desc # :nodoc:
1407
- "regard lines starting with '%' as program code"
1408
- end
1409
-
1410
- def add_text(src, text)
1411
- pos = 0
1412
- text2 = ''
1413
- text.scan(/^\%(.*?\r?\n)/) do
1414
- line = $1
1415
- match = Regexp.last_match
1416
- len = match.begin(0) - pos
1417
- str = text[pos, len]
1418
- pos = match.end(0)
1419
- if text2.empty?
1420
- text2 = str
1421
- else
1422
- text2 << str
1423
- end
1424
- if line[0] == ?%
1425
- text2 << line
1426
- else
1427
- super(src, text2)
1428
- text2 = ''
1429
- add_stmt(src, line)
1430
- end
1431
- end
1432
- #rest = pos == 0 ? text : $' # ruby1.8
1433
- rest = pos == 0 ? text : text[pos..-1] # ruby1.9
1434
- unless text2.empty?
1435
- text2 << rest if rest
1436
- rest = text2
1437
- end
1438
- super(src, rest)
1439
- end
1440
-
1441
- end
1442
-
1443
-
1444
- ##
1445
- ## [experimental] allow header and footer in eRuby script
1446
- ##
1447
- ## ex.
1448
- ## ====================
1449
- ## ## without header and footer
1450
- ## $ cat ex1.eruby
1451
- ## <% def list_items(list) %>
1452
- ## <% for item in list %>
1453
- ## <li><%= item %></li>
1454
- ## <% end %>
1455
- ## <% end %>
1456
- ##
1457
- ## $ erubis -s ex1.eruby
1458
- ## _buf = []; def list_items(list)
1459
- ## ; for item in list
1460
- ## ; _buf << '<li>'; _buf << ( item ).to_s; _buf << '</li>
1461
- ## '; end
1462
- ## ; end
1463
- ## ;
1464
- ## _buf.join
1465
- ##
1466
- ## ## with header and footer
1467
- ## $ cat ex2.eruby
1468
- ## <!--#header:
1469
- ## def list_items(list)
1470
- ## #-->
1471
- ## <% for item in list %>
1472
- ## <li><%= item %></li>
1473
- ## <% end %>
1474
- ## <!--#footer:
1475
- ## end
1476
- ## #-->
1477
- ##
1478
- ## $ erubis -s -c HeaderFooterEruby ex4.eruby
1479
- ##
1480
- ## def list_items(list)
1481
- ## _buf = []; _buf << '
1482
- ## '; for item in list
1483
- ## ; _buf << '<li>'; _buf << ( item ).to_s; _buf << '</li>
1484
- ## '; end
1485
- ## ; _buf << '
1486
- ## ';
1487
- ## _buf.join
1488
- ## end
1489
- ##
1490
- ## ====================
1491
- ##
1492
- ## this is language-independent.
1493
- ##
1494
- module HeaderFooterEnhancer
1495
-
1496
- def self.desc # :nodoc:
1497
- "allow header/footer in document (ex. '<!--#header: #-->')"
1498
- end
1499
-
1500
- HEADER_FOOTER_PATTERN = /(.*?)(^[ \t]*)?<!--\#(\w+):(.*?)\#-->([ \t]*\r?\n)?/m
1501
-
1502
- def add_text(src, text)
1503
- m = nil
1504
- text.scan(HEADER_FOOTER_PATTERN) do |txt, lspace, word, content, rspace|
1505
- m = Regexp.last_match
1506
- flag_trim = @trim && lspace && rspace
1507
- super(src, txt)
1508
- content = "#{lspace}#{content}#{rspace}" if flag_trim
1509
- super(src, lspace) if !flag_trim && lspace
1510
- instance_variable_set("@#{word}", content)
1511
- super(src, rspace) if !flag_trim && rspace
1512
- end
1513
- #rest = $' || text # ruby1.8
1514
- rest = m ? text[m.end(0)..-1] : text # ruby1.9
1515
- super(src, rest)
1516
- end
1517
-
1518
- attr_accessor :header, :footer
1519
-
1520
- def convert(input)
1521
- source = super
1522
- return @src = "#{@header}#{source}#{@footer}"
1523
- end
1524
-
1525
- end
1526
-
1527
-
1528
- ##
1529
- ## delete indentation of HTML.
1530
- ##
1531
- ## this is language-independent.
1532
- ##
1533
- module DeleteIndentEnhancer
1534
-
1535
- def self.desc # :nodoc:
1536
- "delete indentation of HTML."
1537
- end
1538
-
1539
- def convert_input(src, input)
1540
- input = input.gsub(/^[ \t]+</, '<')
1541
- super(src, input)
1542
- end
1543
-
1544
- end
1545
-
1546
-
1547
- ##
1548
- ## convert "<h1><%=title%></h1>" into "_buf << %Q`<h1>#{title}</h1>`"
1549
- ##
1550
- ## this is only for Eruby.
1551
- ##
1552
- module InterpolationEnhancer
1553
-
1554
- def self.desc # :nodoc:
1555
- "convert '<p><%=text%></p>' into '_buf << %Q`<p>\#{text}</p>`'"
1556
- end
1557
-
1558
- def convert_input(src, input)
1559
- pat = @pattern
1560
- regexp = pat.nil? || pat == '<% %>' ? Basic::Converter::DEFAULT_REGEXP : pattern_regexp(pat)
1561
- pos = 0
1562
- is_bol = true # is beginning of line
1563
- str = ''
1564
- input.scan(regexp) do |indicator, code, tailch, rspace|
1565
- match = Regexp.last_match()
1566
- len = match.begin(0) - pos
1567
- text = input[pos, len]
1568
- pos = match.end(0)
1569
- ch = indicator ? indicator[0] : nil
1570
- lspace = ch == ?= ? nil : detect_spaces_at_bol(text, is_bol)
1571
- is_bol = rspace ? true : false
1572
- _add_text_to_str(str, text)
1573
- ## * when '<%= %>', do nothing
1574
- ## * when '<% %>' or '<%# %>', delete spaces iff only spaces are around '<% %>'
1575
- if ch == ?= # <%= %>
1576
- rspace = nil if tailch && !tailch.empty?
1577
- str << lspace if lspace
1578
- add_expr(str, code, indicator)
1579
- str << rspace if rspace
1580
- elsif ch == ?\# # <%# %>
1581
- n = code.count("\n") + (rspace ? 1 : 0)
1582
- if @trim && lspace && rspace
1583
- add_text(src, str)
1584
- str = ''
1585
- add_stmt(src, "\n" * n)
1586
- else
1587
- str << lspace if lspace
1588
- add_text(src, str)
1589
- str = ''
1590
- add_stmt(src, "\n" * n)
1591
- str << rspace if rspace
1592
- end
1593
- else # <% %>
1594
- if @trim && lspace && rspace
1595
- add_text(src, str)
1596
- str = ''
1597
- add_stmt(src, "#{lspace}#{code}#{rspace}")
1598
- else
1599
- str << lspace if lspace
1600
- add_text(src, str)
1601
- str = ''
1602
- add_stmt(src, code)
1603
- str << rspace if rspace
1604
- end
1605
- end
1606
- end
1607
- #rest = $' || input # ruby1.8
1608
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
1609
- _add_text_to_str(str, rest)
1610
- add_text(src, str)
1611
- end
1612
-
1613
- def add_text(src, text)
1614
- return if !text || text.empty?
1615
- #src << " _buf << %Q`" << text << "`;"
1616
- if text[-1] == ?\n
1617
- text[-1] = "\\n"
1618
- src << " _buf << %Q`" << text << "`\n"
1619
- else
1620
- src << " _buf << %Q`" << text << "`;"
1621
- end
1622
- end
1623
-
1624
- def _add_text_to_str(str, text)
1625
- return if !text || text.empty?
1626
- text.gsub!(/['\#\\]/, '\\\\\&')
1627
- str << text
1628
- end
1629
-
1630
- def add_expr_escaped(str, code)
1631
- str << "\#{#{escaped_expr(code)}}"
1632
- end
1633
-
1634
- def add_expr_literal(str, code)
1635
- str << "\#{#{code}}"
1636
- end
1637
-
1638
- end
1639
-
1640
-
1641
- end
1642
- #--end of require 'erubis/enhancer'
1643
- #require 'erubis/tiny'
1644
- #--begin of require 'erubis/engine/eruby'
1645
- ##
1646
- ## $Release: 2.6.5 $
1647
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
1648
- ##
1649
-
1650
- #--already included require 'erubis/engine'
1651
- #--already included require 'erubis/enhancer'
1652
-
1653
-
1654
- module Erubis
1655
-
1656
-
1657
- ##
1658
- ## code generator for Ruby
1659
- ##
1660
- module RubyGenerator
1661
- include Generator
1662
- #include ArrayBufferEnhancer
1663
- include StringBufferEnhancer
1664
-
1665
- def init_generator(properties={})
1666
- super
1667
- @escapefunc ||= "Erubis::XmlHelper.escape_xml"
1668
- end
1669
-
1670
- def self.supported_properties() # :nodoc:
1671
- return []
1672
- end
1673
-
1674
- def escape_text(text)
1675
- text.gsub(/['\\]/, '\\\\\&') # "'" => "\\'", '\\' => '\\\\'
1676
- end
1677
-
1678
- def escaped_expr(code)
1679
- return "#{@escapefunc}(#{code})"
1680
- end
1681
-
1682
- #--
1683
- #def add_preamble(src)
1684
- # src << "_buf = [];"
1685
- #end
1686
- #++
1687
-
1688
- def add_text(src, text)
1689
- src << " _buf << '" << escape_text(text) << "';" unless text.empty?
1690
- end
1691
-
1692
- def add_stmt(src, code)
1693
- #src << code << ';'
1694
- src << code
1695
- src << ';' unless code[-1] == ?\n
1696
- end
1697
-
1698
- def add_expr_literal(src, code)
1699
- src << ' _buf << (' << code << ').to_s;'
1700
- end
1701
-
1702
- def add_expr_escaped(src, code)
1703
- src << ' _buf << ' << escaped_expr(code) << ';'
1704
- end
1705
-
1706
- def add_expr_debug(src, code)
1707
- code.strip!
1708
- s = (code.dump =~ /\A"(.*)"\z/) && $1
1709
- src << ' $stderr.puts("*** debug: ' << s << '=#{(' << code << ').inspect}");'
1710
- end
1711
-
1712
- #--
1713
- #def add_postamble(src)
1714
- # src << "\n_buf.join\n"
1715
- #end
1716
- #++
1717
-
1718
- end
1719
-
1720
-
1721
- ##
1722
- ## engine for Ruby
1723
- ##
1724
- class Eruby < Basic::Engine
1725
- include RubyEvaluator
1726
- include RubyGenerator
1727
- end
1728
-
1729
-
1730
- ##
1731
- ## fast engine for Ruby
1732
- ##
1733
- class FastEruby < Eruby
1734
- include InterpolationEnhancer
1735
- end
1736
-
1737
-
1738
- ##
1739
- ## swtich '<%= %>' to escaped and '<%== %>' to not escaped
1740
- ##
1741
- class EscapedEruby < Eruby
1742
- include EscapeEnhancer
1743
- end
1744
-
1745
-
1746
- ##
1747
- ## sanitize expression (<%= ... %>) by default
1748
- ##
1749
- ## this is equivalent to EscapedEruby and is prepared only for compatibility.
1750
- ##
1751
- class XmlEruby < Eruby
1752
- include EscapeEnhancer
1753
- end
1754
-
1755
-
1756
- class PI::Eruby < PI::Engine
1757
- include RubyEvaluator
1758
- include RubyGenerator
1759
-
1760
- def init_converter(properties={})
1761
- @pi = 'rb'
1762
- super(properties)
1763
- end
1764
-
1765
- end
1766
-
1767
-
1768
- end
1769
- #--end of require 'erubis/engine/eruby'
1770
- #require 'erubis/engine/enhanced' # enhanced eruby engines
1771
- #require 'erubis/engine/optimized' # generates optimized ruby code
1772
- #require 'erubis/engine/ephp'
1773
- #require 'erubis/engine/ec'
1774
- #require 'erubis/engine/ejava'
1775
- #require 'erubis/engine/escheme'
1776
- #require 'erubis/engine/eperl'
1777
- #require 'erubis/engine/ejavascript'
1778
-
1779
- #--begin of require 'erubis/local-setting'
1780
- ##
1781
- ## $Release: 2.6.5 $
1782
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
1783
- ##
1784
-
1785
- ##
1786
- ## you can add site-local settings here.
1787
- ## this files is required by erubis.rb
1788
- ##
1789
- #--end of require 'erubis/local-setting'
1790
- #--end of require 'erubis'
1791
- #--begin of require 'erubis/tiny'
1792
- ##
1793
- ## $Release: 2.6.5 $
1794
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
1795
- ##
1796
-
1797
- module Erubis
1798
-
1799
- ##
1800
- ## tiny and the simplest implementation of eRuby
1801
- ##
1802
- ## ex.
1803
- ## eruby = TinyEruby.new(File.read('example.rhtml'))
1804
- ## print eruby.src # print ruby code
1805
- ## print eruby.result(binding()) # eval ruby code with Binding object
1806
- ## print eruby.evalute(context) # eval ruby code with context object
1807
- ##
1808
- class TinyEruby
1809
-
1810
- def initialize(input=nil)
1811
- @src = convert(input) if input
1812
- end
1813
- attr_reader :src
1814
-
1815
- EMBEDDED_PATTERN = /<%(=+|\#)?(.*?)-?%>/m
1816
-
1817
- def convert(input)
1818
- src = "_buf = '';" # preamble
1819
- pos = 0
1820
- input.scan(EMBEDDED_PATTERN) do |indicator, code|
1821
- m = Regexp.last_match
1822
- text = input[pos...m.begin(0)]
1823
- pos = m.end(0)
1824
- #src << " _buf << '" << escape_text(text) << "';"
1825
- text.gsub!(/['\\]/, '\\\\\&')
1826
- src << " _buf << '" << text << "';" unless text.empty?
1827
- if !indicator # <% %>
1828
- src << code << ";"
1829
- elsif indicator == '#' # <%# %>
1830
- src << ("\n" * code.count("\n"))
1831
- else # <%= %>
1832
- src << " _buf << (" << code << ").to_s;"
1833
- end
1834
- end
1835
- #rest = $' || input # ruby1.8
1836
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
1837
- #src << " _buf << '" << escape_text(rest) << "';"
1838
- rest.gsub!(/['\\]/, '\\\\\&')
1839
- src << " _buf << '" << rest << "';" unless rest.empty?
1840
- src << "\n_buf.to_s\n" # postamble
1841
- return src
1842
- end
1843
-
1844
- #def escape_text(text)
1845
- # return text.gsub!(/['\\]/, '\\\\\&') || text
1846
- #end
1847
-
1848
- def result(_binding=TOPLEVEL_BINDING)
1849
- eval @src, _binding
1850
- end
1851
-
1852
- def evaluate(_context=Object.new)
1853
- if _context.is_a?(Hash)
1854
- _obj = Object.new
1855
- _context.each do |k, v| _obj.instance_variable_set("@#{k}", v) end
1856
- _context = _obj
1857
- end
1858
- _context.instance_eval @src
1859
- end
1860
-
1861
- end
1862
-
1863
-
1864
-
1865
- module PI
1866
- end
1867
-
1868
- class PI::TinyEruby
1869
-
1870
- def initialize(input=nil, options={})
1871
- @escape = options[:escape] || 'Erubis::XmlHelper.escape_xml'
1872
- @src = convert(input) if input
1873
- end
1874
-
1875
- attr_reader :src
1876
-
1877
- EMBEDDED_PATTERN = /(^[ \t]*)?<\?rb(\s.*?)\?>([ \t]*\r?\n)?|@(!+)?\{(.*?)\}@/m
1878
-
1879
- def convert(input)
1880
- src = "_buf = '';" # preamble
1881
- pos = 0
1882
- input.scan(EMBEDDED_PATTERN) do |lspace, stmt, rspace, indicator, expr|
1883
- match = Regexp.last_match
1884
- len = match.begin(0) - pos
1885
- text = input[pos, len]
1886
- pos = match.end(0)
1887
- #src << " _buf << '" << escape_text(text) << "';"
1888
- text.gsub!(/['\\]/, '\\\\\&')
1889
- src << " _buf << '" << text << "';" unless text.empty?
1890
- if stmt # <?rb ... ?>
1891
- if lspace && rspace
1892
- src << "#{lspace}#{stmt}#{rspace}"
1893
- else
1894
- src << " _buf << '" << lspace << "';" if lspace
1895
- src << stmt << ";"
1896
- src << " _buf << '" << rspace << "';" if rspace
1897
- end
1898
- else # ${...}, $!{...}
1899
- if !indicator
1900
- src << " _buf << " << @escape << "(" << expr << ");"
1901
- elsif indicator == '!'
1902
- src << " _buf << (" << expr << ").to_s;"
1903
- end
1904
- end
1905
- end
1906
- #rest = $' || input # ruby1.8
1907
- rest = pos == 0 ? input : input[pos..-1] # ruby1.9
1908
- #src << " _buf << '" << escape_text(rest) << "';"
1909
- rest.gsub!(/['\\]/, '\\\\\&')
1910
- src << " _buf << '" << rest << "';" unless rest.empty?
1911
- src << "\n_buf.to_s\n" # postamble
1912
- return src
1913
- end
1914
-
1915
- #def escape_text(text)
1916
- # return text.gsub!(/['\\]/, '\\\\\&') || text
1917
- #end
1918
-
1919
- def result(_binding=TOPLEVEL_BINDING)
1920
- eval @src, _binding
1921
- end
1922
-
1923
- def evaluate(_context=Object.new)
1924
- if _context.is_a?(Hash)
1925
- _obj = Object.new
1926
- _context.each do |k, v| _obj.instance_variable_set("@#{k}", v) end
1927
- _context = _obj
1928
- end
1929
- _context.instance_eval @src
1930
- end
1931
-
1932
- end
1933
-
1934
-
1935
- end
1936
- #--end of require 'erubis/tiny'
1937
- #--begin of require 'erubis/engine/enhanced'
1938
- ##
1939
- ## $Release: 2.6.5 $
1940
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
1941
- ##
1942
-
1943
- #--already included require 'erubis/enhancer'
1944
- #--already included require 'erubis/engine/eruby'
1945
-
1946
-
1947
- module Erubis
1948
-
1949
-
1950
- #--
1951
- ## moved to engine/ruby.rb
1952
- #class EscapedEruby < Eruby
1953
- # include EscapeEnhancer
1954
- #end
1955
- #++
1956
-
1957
-
1958
- #--
1959
- ### (obsolete)
1960
- #class FastEruby < Eruby
1961
- # include FastEnhancer
1962
- #end
1963
- #++
1964
-
1965
-
1966
- class StdoutEruby < Eruby
1967
- include StdoutEnhancer
1968
- end
1969
-
1970
-
1971
- class PrintOutEruby < Eruby
1972
- include PrintOutEnhancer
1973
- end
1974
-
1975
-
1976
- class PrintEnabledEruby < Eruby
1977
- include PrintEnabledEnhancer
1978
- end
1979
-
1980
-
1981
- class ArrayEruby < Eruby
1982
- include ArrayEnhancer
1983
- end
1984
-
1985
-
1986
- class ArrayBufferEruby < Eruby
1987
- include ArrayBufferEnhancer
1988
- end
1989
-
1990
-
1991
- class StringBufferEruby < Eruby
1992
- include StringBufferEnhancer
1993
- end
1994
-
1995
-
1996
- class StringIOEruby < Eruby
1997
- include StringIOEnhancer
1998
- end
1999
-
2000
-
2001
- class ErboutEruby < Eruby
2002
- include ErboutEnhancer
2003
- end
2004
-
2005
-
2006
- class NoTextEruby < Eruby
2007
- include NoTextEnhancer
2008
- end
2009
-
2010
-
2011
- class NoCodeEruby < Eruby
2012
- include NoCodeEnhancer
2013
- end
2014
-
2015
-
2016
- class SimplifiedEruby < Eruby
2017
- include SimplifyEnhancer
2018
- end
2019
-
2020
-
2021
- class StdoutSimplifiedEruby < Eruby
2022
- include StdoutEnhancer
2023
- include SimplifyEnhancer
2024
- end
2025
-
2026
-
2027
- class PrintOutSimplifiedEruby < Eruby
2028
- include PrintOutEnhancer
2029
- include SimplifyEnhancer
2030
- end
2031
-
2032
-
2033
- class BiPatternEruby < Eruby
2034
- include BiPatternEnhancer
2035
- end
2036
-
2037
-
2038
- class PercentLineEruby < Eruby
2039
- include PercentLineEnhancer
2040
- end
2041
-
2042
-
2043
- class HeaderFooterEruby < Eruby
2044
- include HeaderFooterEnhancer
2045
- end
2046
-
2047
-
2048
- class DeleteIndentEruby < Eruby
2049
- include DeleteIndentEnhancer
2050
- end
2051
-
2052
-
2053
- class InterpolationEruby < Eruby
2054
- include InterpolationEnhancer
2055
- end
2056
-
2057
-
2058
- end
2059
- #--end of require 'erubis/engine/enhanced'
2060
- #--begin of require 'erubis/engine/optimized'
2061
- ##
2062
- ## $Release: 2.6.5 $
2063
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2064
- ##
2065
-
2066
-
2067
- #--already included require 'erubis/engine/eruby'
2068
-
2069
-
2070
- module Erubis
2071
-
2072
-
2073
- module OptimizedGenerator
2074
- include Generator
2075
-
2076
- def self.supported_properties() # :nodoc:
2077
- return []
2078
- end
2079
-
2080
- def init_generator(properties={})
2081
- super
2082
- @escapefunc ||= "Erubis::XmlHelper.escape_xml"
2083
- @initialized = false
2084
- @prev_is_expr = false
2085
- end
2086
-
2087
- protected
2088
-
2089
- def escape_text(text)
2090
- text.gsub(/['\\]/, '\\\\\&') # "'" => "\\'", '\\' => '\\\\'
2091
- end
2092
-
2093
- def escaped_expr(code)
2094
- @escapefunc ||= 'Erubis::XmlHelper.escape_xml'
2095
- return "#{@escapefunc}(#{code})"
2096
- end
2097
-
2098
- def switch_to_expr(src)
2099
- return if @prev_is_expr
2100
- @prev_is_expr = true
2101
- src << ' _buf'
2102
- end
2103
-
2104
- def switch_to_stmt(src)
2105
- return unless @prev_is_expr
2106
- @prev_is_expr = false
2107
- src << ';'
2108
- end
2109
-
2110
- def add_preamble(src)
2111
- #@initialized = false
2112
- #@prev_is_expr = false
2113
- end
2114
-
2115
- def add_text(src, text)
2116
- return if text.empty?
2117
- if @initialized
2118
- switch_to_expr(src)
2119
- src << " << '" << escape_text(text) << "'"
2120
- else
2121
- src << "_buf = '" << escape_text(text) << "';"
2122
- @initialized = true
2123
- end
2124
- end
2125
-
2126
- def add_stmt(src, code)
2127
- switch_to_stmt(src) if @initialized
2128
- #super
2129
- src << code
2130
- src << ';' unless code[-1] == ?\n
2131
- end
2132
-
2133
- def add_expr_literal(src, code)
2134
- unless @initialized; src << "_buf = ''"; @initialized = true; end
2135
- switch_to_expr(src)
2136
- src << " << (" << code << ").to_s"
2137
- end
2138
-
2139
- def add_expr_escaped(src, code)
2140
- unless @initialized; src << "_buf = ''"; @initialized = true; end
2141
- switch_to_expr(src)
2142
- src << " << " << escaped_expr(code)
2143
- end
2144
-
2145
- def add_expr_debug(src, code)
2146
- code.strip!
2147
- s = (code.dump =~ /\A"(.*)"\z/) && $1
2148
- src << ' $stderr.puts("*** debug: ' << s << '=#{(' << code << ').inspect}");'
2149
- end
2150
-
2151
- def add_postamble(src)
2152
- #super if @initialized
2153
- src << "\n_buf\n" if @initialized
2154
- end
2155
-
2156
- end # end of class OptimizedEruby
2157
-
2158
-
2159
- ##
2160
- ## Eruby class which generates optimized ruby code
2161
- ##
2162
- class OptimizedEruby < Basic::Engine # Eruby
2163
- include RubyEvaluator
2164
- include OptimizedGenerator
2165
-
2166
- def init_converter(properties={})
2167
- @pi = 'rb'
2168
- super(properties)
2169
- end
2170
-
2171
- end
2172
-
2173
-
2174
- ##
2175
- ## XmlEruby class which generates optimized ruby code
2176
- ##
2177
- class OptimizedXmlEruby < OptimizedEruby
2178
- include EscapeEnhancer
2179
-
2180
- def add_expr_debug(src, code)
2181
- switch_to_stmt(src) if indicator == '===' && !@initialized
2182
- super
2183
- end
2184
-
2185
- end # end of class OptimizedXmlEruby
2186
-
2187
- end
2188
- #--end of require 'erubis/engine/optimized'
2189
- #--already included require 'erubis/engine/eruby'
2190
- #--begin of require 'erubis/engine/ephp'
2191
- ##
2192
- ## $Release: 2.6.5 $
2193
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2194
- ##
2195
-
2196
- #--already included require 'erubis/engine'
2197
- #--already included require 'erubis/enhancer'
2198
-
2199
-
2200
- module Erubis
2201
-
2202
-
2203
- module PhpGenerator
2204
- include Generator
2205
-
2206
- def self.supported_properties() # :nodoc:
2207
- return []
2208
- end
2209
-
2210
- def init_generator(properties={})
2211
- super
2212
- @escapefunc ||= 'htmlspecialchars'
2213
- end
2214
-
2215
- def add_preamble(src)
2216
- # empty
2217
- end
2218
-
2219
- def escape_text(text)
2220
- return text.gsub!(/<\?xml\b/, '<<?php ?>?xml') || text
2221
- end
2222
-
2223
- def add_text(src, text)
2224
- src << escape_text(text)
2225
- end
2226
-
2227
- def add_expr_literal(src, code)
2228
- code.strip!
2229
- src << "<?php echo #{code}; ?>"
2230
- end
2231
-
2232
- def add_expr_escaped(src, code)
2233
- add_expr_literal(src, escaped_expr(code))
2234
- end
2235
-
2236
- def add_expr_debug(src, code)
2237
- code.strip!
2238
- s = code.gsub(/\'/, "\\'")
2239
- src << "<?php error_log('*** debug: #{s}='.(#{code}), 0); ?>"
2240
- end
2241
-
2242
- def add_stmt(src, code)
2243
- src << "<?php"
2244
- src << " " if code[0] != ?\ #
2245
- if code[-1] == ?\n
2246
- code.chomp!
2247
- src << code << "?>\n"
2248
- else
2249
- src << code << "?>"
2250
- end
2251
- end
2252
-
2253
- def add_postamble(src)
2254
- # empty
2255
- end
2256
-
2257
- end
2258
-
2259
-
2260
- ##
2261
- ## engine for PHP
2262
- ##
2263
- class Ephp < Basic::Engine
2264
- include PhpGenerator
2265
- end
2266
-
2267
-
2268
- class EscapedEphp < Ephp
2269
- include EscapeEnhancer
2270
- end
2271
-
2272
-
2273
- #class XmlEphp < Ephp
2274
- # include EscapeEnhancer
2275
- #end
2276
-
2277
-
2278
- class PI::Ephp < PI::Engine
2279
- include PhpGenerator
2280
-
2281
- def init_converter(properties={})
2282
- @pi = 'php'
2283
- super(properties)
2284
- end
2285
-
2286
- end
2287
-
2288
-
2289
- end
2290
- #--end of require 'erubis/engine/ephp'
2291
- #--begin of require 'erubis/engine/ec'
2292
- ##
2293
- ## $Release: 2.6.5 $
2294
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2295
- ##
2296
-
2297
- #--already included require 'erubis/engine'
2298
- #--already included require 'erubis/enhancer'
2299
-
2300
-
2301
- module Erubis
2302
-
2303
-
2304
- module CGenerator
2305
- include Generator
2306
-
2307
- def self.supported_properties() # :nodoc:
2308
- return [
2309
- [:indent, '', "indent spaces (ex. ' ')"],
2310
- [:out, 'stdout', "output file pointer name"],
2311
- ]
2312
- end
2313
-
2314
- def init_generator(properties={})
2315
- super
2316
- @escapefunc ||= "escape"
2317
- @indent = properties[:indent] || ''
2318
- @out = properties[:out] || 'stdout'
2319
- end
2320
-
2321
- def add_preamble(src)
2322
- src << "#line 1 \"#{self.filename}\"\n" if self.filename
2323
- end
2324
-
2325
- def escape_text(text)
2326
- @@table_ ||= { "\r"=>"\\r", "\n"=>"\\n", "\t"=>"\\t", '"'=>'\\"', "\\"=>"\\\\" }
2327
- text.gsub!(/[\r\n\t"\\]/) { |m| @@table_[m] }
2328
- return text
2329
- end
2330
-
2331
- def escaped_expr(code)
2332
- return "#{@escapefunc}(#{code.strip}, #{@out})"
2333
- end
2334
-
2335
- def add_text(src, text)
2336
- return if text.empty?
2337
- src << (src.empty? || src[-1] == ?\n ? @indent : ' ')
2338
- src << "fputs("
2339
- i = 0
2340
- text.each_line do |line|
2341
- src << "\n" << @indent << ' ' if i > 0
2342
- i += 1
2343
- src << '"' << escape_text(line) << '"'
2344
- end
2345
- src << ", #{@out});" #<< (text[-1] == ?\n ? "\n" : "")
2346
- src << "\n" if text[-1] == ?\n
2347
- end
2348
-
2349
- def add_stmt(src, code)
2350
- src << code
2351
- end
2352
-
2353
- def add_expr_literal(src, code)
2354
- src << @indent if src.empty? || src[-1] == ?\n
2355
- src << " fprintf(#{@out}, " << code.strip << ');'
2356
- end
2357
-
2358
- def add_expr_escaped(src, code)
2359
- src << @indent if src.empty? || src[-1] == ?\n
2360
- src << ' ' << escaped_expr(code) << ';'
2361
- end
2362
-
2363
- def add_expr_debug(src, code)
2364
- code.strip!
2365
- s = nil
2366
- if code =~ /\A\".*?\"\s*,\s*(.*)/
2367
- s = $1.gsub(/[%"]/, '\\\1') + '='
2368
- end
2369
- src << @indent if src.empty? || src[-1] == ?\n
2370
- src << " fprintf(stderr, \"*** debug: #{s}\" #{code});"
2371
- end
2372
-
2373
- def add_postamble(src)
2374
- # empty
2375
- end
2376
-
2377
- end
2378
-
2379
-
2380
- ##
2381
- ## engine for C
2382
- ##
2383
- class Ec < Basic::Engine
2384
- include CGenerator
2385
- end
2386
-
2387
-
2388
- class EscapedEc < Ec
2389
- include EscapeEnhancer
2390
- end
2391
-
2392
-
2393
- #class XmlEc < Ec
2394
- # include EscapeEnhancer
2395
- #end
2396
-
2397
- class PI::Ec < PI::Engine
2398
- include CGenerator
2399
-
2400
- def init_converter(properties={})
2401
- @pi = 'c'
2402
- super(properties)
2403
- end
2404
-
2405
- end
2406
-
2407
-
2408
- end
2409
- #--end of require 'erubis/engine/ec'
2410
- #--begin of require 'erubis/engine/ejava'
2411
- ##
2412
- ## $Release: 2.6.5 $
2413
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2414
- ##
2415
-
2416
- #--already included require 'erubis/engine'
2417
- #--already included require 'erubis/enhancer'
2418
-
2419
-
2420
- module Erubis
2421
-
2422
-
2423
- module JavaGenerator
2424
- include Generator
2425
-
2426
- def self.supported_properties() # :nodoc:
2427
- return [
2428
- [:indent, '', "indent spaces (ex. ' ')"],
2429
- [:buf, '_buf', "output buffer name"],
2430
- [:bufclass, 'StringBuffer', "output buffer class (ex. 'StringBuilder')"],
2431
- ]
2432
- end
2433
-
2434
- def init_generator(properties={})
2435
- super
2436
- @escapefunc ||= 'escape'
2437
- @indent = properties[:indent] || ''
2438
- @buf = properties[:buf] || '_buf'
2439
- @bufclass = properties[:bufclass] || 'StringBuffer'
2440
- end
2441
-
2442
- def add_preamble(src)
2443
- src << "#{@indent}#{@bufclass} #{@buf} = new #{@bufclass}();"
2444
- end
2445
-
2446
- def escape_text(text)
2447
- @@table_ ||= { "\r"=>"\\r", "\n"=>"\\n", "\t"=>"\\t", '"'=>'\\"', "\\"=>"\\\\" }
2448
- return text.gsub!(/[\r\n\t"\\]/) { |m| @@table_[m] } || text
2449
- end
2450
-
2451
- def add_text(src, text)
2452
- return if text.empty?
2453
- src << (src.empty? || src[-1] == ?\n ? @indent : ' ')
2454
- src << @buf << ".append("
2455
- i = 0
2456
- text.each_line do |line|
2457
- src << "\n" << @indent << ' + ' if i > 0
2458
- i += 1
2459
- src << '"' << escape_text(line) << '"'
2460
- end
2461
- src << ");" << (text[-1] == ?\n ? "\n" : "")
2462
- end
2463
-
2464
- def add_stmt(src, code)
2465
- src << code
2466
- end
2467
-
2468
- def add_expr_literal(src, code)
2469
- src << @indent if src.empty? || src[-1] == ?\n
2470
- code.strip!
2471
- src << " #{@buf}.append(#{code});"
2472
- end
2473
-
2474
- def add_expr_escaped(src, code)
2475
- add_expr_literal(src, escaped_expr(code))
2476
- end
2477
-
2478
- def add_expr_debug(src, code)
2479
- code.strip!
2480
- src << @indent if src.empty? || src[-1] == ?\n
2481
- src << " System.err.println(\"*** debug: #{code}=\"+(#{code}));"
2482
- end
2483
-
2484
- def add_postamble(src)
2485
- src << "\n" if src[-1] == ?;
2486
- src << @indent << "return " << @buf << ".toString();\n"
2487
- #src << @indent << "System.out.print(" << @buf << ".toString());\n"
2488
- end
2489
-
2490
- end
2491
-
2492
-
2493
- ##
2494
- ## engine for Java
2495
- ##
2496
- class Ejava < Basic::Engine
2497
- include JavaGenerator
2498
- end
2499
-
2500
-
2501
- class EscapedEjava < Ejava
2502
- include EscapeEnhancer
2503
- end
2504
-
2505
-
2506
- #class XmlEjava < Ejava
2507
- # include EscapeEnhancer
2508
- #end
2509
-
2510
- class PI::Ejava < PI::Engine
2511
- include JavaGenerator
2512
-
2513
- def init_converter(properties={})
2514
- @pi = 'java'
2515
- super(properties)
2516
- end
2517
-
2518
- end
2519
-
2520
- end
2521
- #--end of require 'erubis/engine/ejava'
2522
- #--begin of require 'erubis/engine/escheme'
2523
- ##
2524
- ## $Release: 2.6.5 $
2525
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2526
- ##
2527
-
2528
- #--already included require 'erubis/engine'
2529
- #--already included require 'erubis/enhancer'
2530
-
2531
-
2532
- module Erubis
2533
-
2534
-
2535
- module SchemeGenerator
2536
- include Generator
2537
-
2538
- def self.supported_properties() # :nodoc:
2539
- return [
2540
- [:func, '_add', "function name (ex. 'display')"],
2541
- ]
2542
- end
2543
-
2544
- def init_generator(properties={})
2545
- super
2546
- @escapefunc ||= 'escape'
2547
- @func = properties[:func] || '_add' # or 'display'
2548
- end
2549
-
2550
- def add_preamble(src)
2551
- return unless @func == '_add'
2552
- src << "(let ((_buf '())) " + \
2553
- "(define (_add x) (set! _buf (cons x _buf))) "
2554
- #src << "(let* ((_buf '())" + \
2555
- # " (_add (lambda (x) (set! _buf (cons x _buf))))) "
2556
- end
2557
-
2558
- def escape_text(text)
2559
- @table_ ||= { '"'=>'\\"', '\\'=>'\\\\' }
2560
- text.gsub!(/["\\]/) { |m| @table_[m] }
2561
- return text
2562
- end
2563
-
2564
- def escaped_expr(code)
2565
- code.strip!
2566
- return "(#{@escapefunc} #{code})"
2567
- end
2568
-
2569
- def add_text(src, text)
2570
- return if text.empty?
2571
- t = escape_text(text)
2572
- if t[-1] == ?\n
2573
- t[-1, 1] = ''
2574
- src << "(#{@func} \"" << t << "\\n\")\n"
2575
- else
2576
- src << "(#{@func} \"" << t << '")'
2577
- end
2578
- end
2579
-
2580
- def add_stmt(src, code)
2581
- src << code
2582
- end
2583
-
2584
- def add_expr_literal(src, code)
2585
- code.strip!
2586
- src << "(#{@func} #{code})"
2587
- end
2588
-
2589
- def add_expr_escaped(src, code)
2590
- add_expr_literal(src, escaped_expr(code))
2591
- end
2592
-
2593
- def add_expr_debug(src, code)
2594
- s = (code.strip! || code).gsub(/\"/, '\\"')
2595
- src << "(display \"*** debug: #{s}=\")(display #{code.strip})(display \"\\n\")"
2596
- end
2597
-
2598
- def add_postamble(src)
2599
- return unless @func == '_add'
2600
- src << "\n" unless src[-1] == ?\n
2601
- src << " (reverse _buf))\n"
2602
- end
2603
-
2604
- end
2605
-
2606
-
2607
- ##
2608
- ## engine for Scheme
2609
- ##
2610
- class Escheme < Basic::Engine
2611
- include SchemeGenerator
2612
- end
2613
-
2614
-
2615
- class EscapedEscheme < Escheme
2616
- include EscapeEnhancer
2617
- end
2618
-
2619
-
2620
- #class XmlEscheme < Escheme
2621
- # include EscapeEnhancer
2622
- #end
2623
-
2624
-
2625
- class PI::Escheme < PI::Engine
2626
- include SchemeGenerator
2627
-
2628
- def init_converter(properties={})
2629
- @pi = 'scheme'
2630
- super(properties)
2631
- end
2632
-
2633
- end
2634
-
2635
-
2636
- end
2637
- #--end of require 'erubis/engine/escheme'
2638
- #--begin of require 'erubis/engine/eperl'
2639
- ##
2640
- ## $Release: 2.6.5 $
2641
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2642
- ##
2643
-
2644
- #--already included require 'erubis/engine'
2645
- #--already included require 'erubis/enhancer'
2646
-
2647
-
2648
- module Erubis
2649
-
2650
-
2651
- module PerlGenerator
2652
- include Generator
2653
-
2654
- def self.supported_properties() # :nodoc:
2655
- return [
2656
- [:func, 'print', "function name"],
2657
- ]
2658
- end
2659
-
2660
- def init_generator(properties={})
2661
- super
2662
- @escapefunc ||= 'encode_entities'
2663
- @func = properties[:func] || 'print'
2664
- end
2665
-
2666
- def add_preamble(src)
2667
- src << "use HTML::Entities; ";
2668
- end
2669
-
2670
- def escape_text(text)
2671
- return text.gsub!(/['\\]/, '\\\\\&') || text
2672
- end
2673
-
2674
- def add_text(src, text)
2675
- src << @func << "('" << escape_text(text) << "'); " unless text.empty?
2676
- end
2677
-
2678
- def add_expr_literal(src, code)
2679
- code.strip!
2680
- src << @func << "(" << code << "); "
2681
- end
2682
-
2683
- def add_expr_escaped(src, code)
2684
- add_expr_literal(src, escaped_expr(code))
2685
- end
2686
-
2687
- def add_expr_debug(src, code)
2688
- code.strip!
2689
- s = code.gsub(/\'/, "\\'")
2690
- src << @func << "('*** debug: #{code}=', #{code}, \"\\n\");"
2691
- end
2692
-
2693
- def add_stmt(src, code)
2694
- src << code
2695
- end
2696
-
2697
- def add_postamble(src)
2698
- src << "\n" unless src[-1] == ?\n
2699
- end
2700
-
2701
- end
2702
-
2703
-
2704
- ##
2705
- ## engine for Perl
2706
- ##
2707
- class Eperl < Basic::Engine
2708
- include PerlGenerator
2709
- end
2710
-
2711
-
2712
- class EscapedEperl < Eperl
2713
- include EscapeEnhancer
2714
- end
2715
-
2716
-
2717
- #class XmlEperl < Eperl
2718
- # include EscapeEnhancer
2719
- #end
2720
-
2721
-
2722
- class PI::Eperl < PI::Engine
2723
- include PerlGenerator
2724
-
2725
- def init_converter(properties={})
2726
- @pi = 'perl'
2727
- super(properties)
2728
- end
2729
-
2730
- end
2731
-
2732
-
2733
- end
2734
- #--end of require 'erubis/engine/eperl'
2735
- #--begin of require 'erubis/engine/ejavascript'
2736
- ##
2737
- ## $Release: 2.6.5 $
2738
- ## copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
2739
- ##
2740
-
2741
- #--already included require 'erubis/engine'
2742
- #--already included require 'erubis/enhancer'
2743
-
2744
-
2745
- module Erubis
2746
-
2747
-
2748
- module JavascriptGenerator
2749
- include Generator
2750
-
2751
- def self.supported_properties() # :nodoc:
2752
- list = []
2753
- #list << [:indent, '', "indent spaces (ex. ' ')"]
2754
- #list << [:buf, '_buf', "output buffer name"]
2755
- list << [:docwrite, true, "use 'document.write()' when true"]
2756
- return list
2757
- end
2758
-
2759
- def init_generator(properties={})
2760
- super
2761
- @escapefunc ||= 'escape'
2762
- @indent = properties[:indent] || ''
2763
- @buf = properties[:out] || '_buf'
2764
- @docwrite = properties[:docwrite] != false # '!= false' will be removed in the next release
2765
- end
2766
-
2767
- def add_preamble(src)
2768
- src << "#{@indent}var #{@buf} = [];"
2769
- end
2770
-
2771
- def escape_text(text)
2772
- @@table_ ||= { "\r"=>"\\r", "\n"=>"\\n\\\n", "\t"=>"\\t", '"'=>'\\"', "\\"=>"\\\\" }
2773
- return text.gsub!(/[\r\n\t"\\]/) { |m| @@table_[m] } || text
2774
- end
2775
-
2776
- def add_indent(src, indent)
2777
- src << (src.empty? || src[-1] == ?\n ? indent : ' ')
2778
- end
2779
-
2780
- def add_text(src, text)
2781
- return if text.empty?
2782
- add_indent(src, @indent)
2783
- src << @buf << '.push("'
2784
- s = escape_text(text)
2785
- if s[-1] == ?\n
2786
- s[-2, 2] = ''
2787
- src << s << "\");\n"
2788
- else
2789
- src << s << "\");"
2790
- end
2791
- end
2792
-
2793
- def add_stmt(src, code)
2794
- src << code
2795
- end
2796
-
2797
- def add_expr_literal(src, code)
2798
- add_indent(src, @indent)
2799
- code.strip!
2800
- src << "#{@buf}.push(#{code});"
2801
- end
2802
-
2803
- def add_expr_escaped(src, code)
2804
- add_expr_literal(src, escaped_expr(code))
2805
- end
2806
-
2807
- def add_expr_debug(src, code)
2808
- add_indent(src, @indent)
2809
- code.strip!
2810
- src << "alert(\"*** debug: #{code}=\"+(#{code}));"
2811
- end
2812
-
2813
- def add_postamble(src)
2814
- src << "\n" if src[-1] == ?;
2815
- if @docwrite
2816
- src << @indent << 'document.write(' << @buf << ".join(\"\"));\n"
2817
- else
2818
- src << @indent << @buf << ".join(\"\");\n"
2819
- end
2820
- end
2821
-
2822
- end
2823
-
2824
-
2825
- ##
2826
- ## engine for JavaScript
2827
- ##
2828
- class Ejavascript < Basic::Engine
2829
- include JavascriptGenerator
2830
- end
2831
-
2832
-
2833
- class EscapedEjavascript < Ejavascript
2834
- include EscapeEnhancer
2835
- end
2836
-
2837
-
2838
- #class XmlEjavascript < Ejavascript
2839
- # include EscapeEnhancer
2840
- #end
2841
-
2842
-
2843
- class PI::Ejavascript < PI::Engine
2844
- include JavascriptGenerator
2845
-
2846
- def init_converter(properties={})
2847
- @pi = 'js'
2848
- super(properties)
2849
- end
2850
-
2851
- end
2852
-
2853
-
2854
- end
2855
- #--end of require 'erubis/engine/ejavascript'
2856
-
2857
-
2858
- module Erubis
2859
-
2860
-
2861
- Ejs = Ejavascript
2862
- EscapedEjs = EscapedEjavascript
2863
-
2864
-
2865
- class CommandOptionError < ErubisError
2866
- end
2867
-
2868
-
2869
- ##
2870
- ## main class of command
2871
- ##
2872
- ## ex.
2873
- ## Main.main(ARGV)
2874
- ##
2875
- class Main
2876
-
2877
- def self.main(argv=ARGV)
2878
- status = 0
2879
- begin
2880
- Main.new.execute(ARGV)
2881
- rescue CommandOptionError => ex
2882
- $stderr.puts ex.message
2883
- status = 1
2884
- end
2885
- exit(status)
2886
- end
2887
-
2888
- def initialize
2889
- @single_options = "hvxztTSbeBXNUC"
2890
- @arg_options = "pcrfKIlaE" #C
2891
- @option_names = {
2892
- 'h' => :help,
2893
- 'v' => :version,
2894
- 'x' => :source,
2895
- 'z' => :syntax,
2896
- 'T' => :unexpand,
2897
- 't' => :untabify, # obsolete
2898
- 'S' => :intern,
2899
- 'b' => :bodyonly,
2900
- 'B' => :binding,
2901
- 'p' => :pattern,
2902
- 'c' => :context,
2903
- #'C' => :class,
2904
- 'e' => :escape,
2905
- 'r' => :requires,
2906
- 'f' => :datafiles,
2907
- 'K' => :kanji,
2908
- 'I' => :includes,
2909
- 'l' => :lang,
2910
- 'a' => :action,
2911
- 'E' => :enhancers,
2912
- 'X' => :notext,
2913
- 'N' => :linenum,
2914
- 'U' => :unique,
2915
- 'C' => :compact,
2916
- }
2917
- assert unless @single_options.length + @arg_options.length == @option_names.length
2918
- (@single_options + @arg_options).each_byte do |ch|
2919
- assert unless @option_names.key?(ch.chr)
2920
- end
2921
- end
2922
-
2923
-
2924
- def execute(argv=ARGV)
2925
- ## parse command-line options
2926
- options, properties = parse_argv(argv, @single_options, @arg_options)
2927
- filenames = argv
2928
- options['h'] = true if properties[:help]
2929
- opts = Object.new
2930
- arr = @option_names.collect {|ch, name| "def #{name}; @#{name}; end\n" }
2931
- opts.instance_eval arr.join
2932
- options.each do |ch, val|
2933
- name = @option_names[ch]
2934
- opts.instance_variable_set("@#{name}", val)
2935
- end
2936
-
2937
- ## help, version, enhancer list
2938
- if opts.help || opts.version
2939
- puts version() if opts.version
2940
- puts usage() if opts.help
2941
- puts show_properties() if opts.help
2942
- puts show_enhancers() if opts.help
2943
- return
2944
- end
2945
-
2946
- ## include path
2947
- opts.includes.split(/,/).each do |path|
2948
- $: << path
2949
- end if opts.includes
2950
-
2951
- ## require library
2952
- opts.requires.split(/,/).each do |library|
2953
- require library
2954
- end if opts.requires
2955
-
2956
- ## action
2957
- action = opts.action
2958
- action ||= 'syntax' if opts.syntax
2959
- action ||= 'convert' if opts.source || opts.notext
2960
-
2961
- ## lang
2962
- lang = opts.lang || 'ruby'
2963
- action ||= 'convert' if opts.lang
2964
-
2965
- ## class name of Eruby
2966
- #classname = opts.class
2967
- classname = nil
2968
- klass = get_classobj(classname, lang, properties[:pi])
2969
-
2970
- ## kanji code
2971
- $KCODE = opts.kanji if opts.kanji
2972
-
2973
- ## read context values from yaml file
2974
- datafiles = opts.datafiles
2975
- context = load_datafiles(datafiles, opts)
2976
-
2977
- ## parse context data
2978
- if opts.context
2979
- context = parse_context_data(opts.context, opts)
2980
- end
2981
-
2982
- ## properties for engine
2983
- properties[:escape] = true if opts.escape && !properties.key?(:escape)
2984
- properties[:pattern] = opts.pattern if opts.pattern
2985
- #properties[:trim] = false if opts.notrim
2986
- properties[:preamble] = properties[:postamble] = false if opts.bodyonly
2987
- properties[:pi] = nil if properties[:pi] == true
2988
-
2989
- ## create engine and extend enhancers
2990
- engine = klass.new(nil, properties)
2991
- enhancers = get_enhancers(opts.enhancers)
2992
- #enhancers.push(Erubis::EscapeEnhancer) if opts.escape
2993
- enhancers.each do |enhancer|
2994
- engine.extend(enhancer)
2995
- engine.bipattern = properties[:bipattern] if enhancer == Erubis::BiPatternEnhancer
2996
- end
2997
-
2998
- ## no-text
2999
- engine.extend(Erubis::NoTextEnhancer) if opts.notext
3000
-
3001
- ## convert and execute
3002
- val = nil
3003
- msg = "Syntax OK\n"
3004
- if filenames && !filenames.empty?
3005
- filenames.each do |filename|
3006
- File.file?(filename) or
3007
- raise CommandOptionError.new("#{filename}: file not found.")
3008
- engine.filename = filename
3009
- engine.convert!(File.read(filename))
3010
- val = do_action(action, engine, context, filename, opts)
3011
- msg = nil if val
3012
- end
3013
- else
3014
- engine.filename = filename = '(stdin)'
3015
- engine.convert!($stdin.read())
3016
- val = do_action(action, engine, context, filename, opts)
3017
- msg = nil if val
3018
- end
3019
- print msg if action == 'syntax' && msg
3020
-
3021
- end
3022
-
3023
- private
3024
-
3025
- def do_action(action, engine, context, filename, opts)
3026
- case action
3027
- when 'convert'
3028
- s = manipulate_src(engine.src, opts)
3029
- when nil, 'exec', 'execute'
3030
- s = opts.binding ? engine.result(context.to_hash) : engine.evaluate(context)
3031
- when 'syntax'
3032
- s = check_syntax(filename, engine.src)
3033
- else
3034
- raise "*** internal error"
3035
- end
3036
- print s if s
3037
- return s
3038
- end
3039
-
3040
- def manipulate_src(source, opts)
3041
- flag_linenum = opts.linenum
3042
- flag_unique = opts.unique
3043
- flag_compact = opts.compact
3044
- if flag_linenum
3045
- n = 0
3046
- source.gsub!(/^/) { n += 1; "%5d: " % n }
3047
- source.gsub!(/^ *\d+:\s+?\n/, '') if flag_compact
3048
- source.gsub!(/(^ *\d+:\s+?\n)+/, "\n") if flag_unique
3049
- else
3050
- source.gsub!(/^\s*?\n/, '') if flag_compact
3051
- source.gsub!(/(^\s*?\n)+/, "\n") if flag_unique
3052
- end
3053
- return source
3054
- end
3055
-
3056
- def usage(command=nil)
3057
- command ||= File.basename($0)
3058
- buf = []
3059
- buf << "erubis - embedded program converter for multi-language"
3060
- buf << "Usage: #{command} [..options..] [file ...]"
3061
- buf << " -h, --help : help"
3062
- buf << " -v : version"
3063
- buf << " -x : show converted code"
3064
- buf << " -X : show converted code, only ruby code and no text part"
3065
- buf << " -N : numbering: add line numbers (for '-x/-X')"
3066
- buf << " -U : unique: compress empty lines to a line (for '-x/-X')"
3067
- buf << " -C : compact: remove empty lines (for '-x/-X')"
3068
- buf << " -b : body only: no preamble nor postamble (for '-x/-X')"
3069
- buf << " -z : syntax checking"
3070
- buf << " -e : escape (equal to '--E Escape')"
3071
- buf << " -p pattern : embedded pattern (default '<% %>')"
3072
- buf << " -l lang : convert but no execute (ruby/php/c/java/scheme/perl/js)"
3073
- buf << " -E e1,e2,... : enhancer names (Escape, PercentLine, BiPattern, ...)"
3074
- buf << " -I path : library include path"
3075
- buf << " -K kanji : kanji code (euc/sjis/utf8) (default none)"
3076
- buf << " -c context : context data string (yaml inline style or ruby code)"
3077
- buf << " -f datafile : context data file ('*.yaml', '*.yml', or '*.rb')"
3078
- #buf << " -t : expand tab characters in YAML file"
3079
- buf << " -T : don't expand tab characters in YAML file"
3080
- buf << " -S : convert mapping key from string to symbol in YAML file"
3081
- buf << " -B : invoke 'result(binding)' instead of 'evaluate(context)'"
3082
- buf << " --pi=name : parse '<?name ... ?>' instead of '<% ... %>'"
3083
- #'
3084
- # -T : don't trim spaces around '<% %>'
3085
- # -c class : class name (XmlEruby/PercentLineEruby/...) (default Eruby)
3086
- # -r library : require library
3087
- # -a : action (convert/execute)
3088
- return buf.join("\n")
3089
- end
3090
-
3091
- def collect_supported_properties(erubis_klass)
3092
- list = []
3093
- erubis_klass.ancestors.each do |klass|
3094
- if klass.respond_to?(:supported_properties)
3095
- list.concat(klass.supported_properties)
3096
- end
3097
- end
3098
- return list
3099
- end
3100
-
3101
- def show_properties
3102
- s = "supported properties:\n"
3103
- basic_props = collect_supported_properties(Erubis::Basic::Engine)
3104
- pi_props = collect_supported_properties(Erubis::PI::Engine)
3105
- list = []
3106
- common_props = basic_props & pi_props
3107
- list << ['(common)', common_props]
3108
- list << ['(basic)', basic_props - common_props]
3109
- list << ['(pi)', pi_props - common_props]
3110
- %w[ruby php c java scheme perl javascript].each do |lang|
3111
- klass = Erubis.const_get("E#{lang}")
3112
- list << [lang, collect_supported_properties(klass) - basic_props]
3113
- end
3114
- list.each do |lang, props|
3115
- s << " * #{lang}\n"
3116
- props.each do |name, default_val, desc|
3117
- s << (" --%-23s : %s\n" % ["#{name}=#{default_val.inspect}", desc])
3118
- end
3119
- end
3120
- s << "\n"
3121
- return s
3122
- end
3123
-
3124
- def show_enhancers
3125
- dict = {}
3126
- ObjectSpace.each_object(Module) do |mod|
3127
- dict[$1] = mod if mod.name =~ /\AErubis::(.*)Enhancer\z/
3128
- end
3129
- s = "enhancers:\n"
3130
- dict.sort_by {|name, mod| name }.each do |name, mod|
3131
- s << (" %-13s : %s\n" % [name, mod.desc])
3132
- end
3133
- return s
3134
- end
3135
-
3136
- def version
3137
- return Erubis::VERSION
3138
- end
3139
-
3140
- def parse_argv(argv, arg_none='', arg_required='', arg_optional='')
3141
- options = {}
3142
- context = {}
3143
- while argv[0] && argv[0][0] == ?-
3144
- optstr = argv.shift
3145
- optstr = optstr[1, optstr.length-1]
3146
- #
3147
- if optstr[0] == ?- # context
3148
- optstr =~ /\A\-([-\w]+)(?:=(.*))?/ or
3149
- raise CommandOptionError.new("-#{optstr}: invalid context value.")
3150
- name, value = $1, $2
3151
- name = name.gsub(/-/, '_').intern
3152
- #value = value.nil? ? true : YAML.load(value) # error, why?
3153
- value = value.nil? ? true : YAML.load("---\n#{value}\n")
3154
- context[name] = value
3155
- #
3156
- else # options
3157
- while optstr && !optstr.empty?
3158
- optchar = optstr[0].chr
3159
- optstr = optstr[1..-1]
3160
- if arg_none.include?(optchar)
3161
- options[optchar] = true
3162
- elsif arg_required.include?(optchar)
3163
- arg = optstr.empty? ? argv.shift : optstr or
3164
- raise CommandOptionError.new("-#{optchar}: #{@option_names[optchar]} required.")
3165
- options[optchar] = arg
3166
- optstr = nil
3167
- elsif arg_optional.include?(optchar)
3168
- arg = optstr.empty? ? true : optstr
3169
- options[optchar] = arg
3170
- optstr = nil
3171
- else
3172
- raise CommandOptionError.new("-#{optchar}: unknown option.")
3173
- end
3174
- end
3175
- end
3176
- #
3177
- end # end of while
3178
-
3179
- return options, context
3180
- end
3181
-
3182
-
3183
- def untabify(str, width=8)
3184
- list = str.split(/\t/)
3185
- last = list.pop
3186
- sb = ''
3187
- list.each do |s|
3188
- column = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length
3189
- n = width - (column % width)
3190
- sb << s << (' ' * n)
3191
- end
3192
- sb << last
3193
- return sb
3194
- end
3195
- #--
3196
- #def untabify(str, width=8)
3197
- # sb = ''
3198
- # str.scan(/(.*?)\t/m) do |s, |
3199
- # len = (n = s.rindex(?\n)) ? s.length - n - 1 : s.length
3200
- # sb << s << (" " * (width - len % width))
3201
- # end
3202
- # return $' ? (sb << $') : str
3203
- #end
3204
- #++
3205
-
3206
-
3207
- def get_classobj(classname, lang, pi)
3208
- classname ||= "E#{lang}"
3209
- base_module = pi ? Erubis::PI : Erubis
3210
- begin
3211
- klass = base_module.const_get(classname)
3212
- rescue NameError
3213
- klass = nil
3214
- end
3215
- unless klass
3216
- if lang
3217
- msg = "-l #{lang}: invalid language name (class #{base_module.name}::#{classname} not found)."
3218
- else
3219
- msg = "-c #{classname}: invalid class name."
3220
- end
3221
- raise CommandOptionError.new(msg)
3222
- end
3223
- return klass
3224
- end
3225
-
3226
- def get_enhancers(enhancer_names)
3227
- return [] unless enhancer_names
3228
- enhancers = []
3229
- shortname = nil
3230
- begin
3231
- enhancer_names.split(/,/).each do |name|
3232
- shortname = name
3233
- enhancers << Erubis.const_get("#{shortname}Enhancer")
3234
- end
3235
- rescue NameError
3236
- raise CommandOptionError.new("#{shortname}: no such Enhancer (try '-h' to show all enhancers).")
3237
- end
3238
- return enhancers
3239
- end
3240
-
3241
- def load_datafiles(filenames, opts)
3242
- context = Erubis::Context.new
3243
- return context unless filenames
3244
- filenames.split(/,/).each do |filename|
3245
- filename.strip!
3246
- test(?f, filename) or raise CommandOptionError.new("#{filename}: file not found.")
3247
- if filename =~ /\.ya?ml$/
3248
- if opts.unexpand
3249
- ydoc = YAML.load_file(filename)
3250
- else
3251
- ydoc = YAML.load(untabify(File.read(filename)))
3252
- end
3253
- ydoc.is_a?(Hash) or raise CommandOptionError.new("#{filename}: root object is not a mapping.")
3254
- intern_hash_keys(ydoc) if opts.intern
3255
- context.update(ydoc)
3256
- elsif filename =~ /\.rb$/
3257
- str = File.read(filename)
3258
- context2 = Erubis::Context.new
3259
- _instance_eval(context2, str)
3260
- context.update(context2)
3261
- else
3262
- CommandOptionError.new("#{filename}: '*.yaml', '*.yml', or '*.rb' required.")
3263
- end
3264
- end
3265
- return context
3266
- end
3267
-
3268
- def _instance_eval(_context, _str)
3269
- _context.instance_eval(_str)
3270
- end
3271
-
3272
- def parse_context_data(context_str, opts)
3273
- if context_str[0] == ?{
3274
- require 'yaml'
3275
- ydoc = YAML.load(context_str)
3276
- unless ydoc.is_a?(Hash)
3277
- raise CommandOptionError.new("-c: root object is not a mapping.")
3278
- end
3279
- intern_hash_keys(ydoc) if opts.intern
3280
- return ydoc
3281
- else
3282
- context = Erubis::Context.new
3283
- context.instance_eval(context_str, '-c')
3284
- return context
3285
- end
3286
- end
3287
-
3288
- def intern_hash_keys(obj, done={})
3289
- return if done.key?(obj.__id__)
3290
- case obj
3291
- when Hash
3292
- done[obj.__id__] = obj
3293
- obj.keys.each do |key|
3294
- obj[key.intern] = obj.delete(key) if key.is_a?(String)
3295
- end
3296
- obj.values.each do |val|
3297
- intern_hash_keys(val, done) if val.is_a?(Hash) || val.is_a?(Array)
3298
- end
3299
- when Array
3300
- done[obj.__id__] = obj
3301
- obj.each do |val|
3302
- intern_hash_keys(val, done) if val.is_a?(Hash) || val.is_a?(Array)
3303
- end
3304
- end
3305
- end
3306
-
3307
- def check_syntax(filename, src)
3308
- require 'open3'
3309
- #command = (ENV['_'] || 'ruby') + ' -wc' # ENV['_'] stores command name
3310
- bin = ENV['_'] && File.basename(ENV['_']) =~ /^ruby/ ? ENV['_'] : 'ruby'
3311
- command = bin + ' -wc'
3312
- stdin, stdout, stderr = Open3.popen3(command)
3313
- stdin.write(src)
3314
- stdin.close
3315
- result = stdout.read()
3316
- stdout.close()
3317
- errmsg = stderr.read()
3318
- stderr.close()
3319
- return nil unless errmsg && !errmsg.empty?
3320
- errmsg =~ /\A-:(\d+): /
3321
- linenum, message = $1, $'
3322
- return "#{filename}:#{linenum}: #{message}"
3323
- end
3324
-
3325
- end
3326
-
3327
- end
3328
- #--end of require 'erubis/main'
3329
-
3330
- Erubis::Main.main(ARGV)