ruby_on_ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (493) hide show
  1. data/.gitignore +18 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +1 -0
  7. data/lib/ruby_on_ruby.rb +5 -0
  8. data/lib/ruby_on_ruby/console.rb +7 -0
  9. data/lib/ruby_on_ruby/context.rb +33 -0
  10. data/lib/ruby_on_ruby/file_loader.rb +31 -0
  11. data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
  12. data/lib/ruby_on_ruby/version.rb +3 -0
  13. data/lib/rubyonruby.rb +1 -0
  14. data/ruby_in_ruby.gemspec +19 -0
  15. data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
  16. data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
  17. data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
  18. data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
  19. data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
  20. data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
  21. data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
  22. data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
  23. data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
  24. data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
  25. data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
  26. data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
  27. data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
  28. data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
  29. data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
  30. data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
  31. data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
  32. data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
  33. data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
  34. data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
  35. data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
  36. data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
  37. data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
  38. data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
  39. data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
  40. data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
  41. data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
  42. data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
  43. data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
  44. data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
  45. data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
  46. data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
  47. data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
  48. data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
  49. data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
  50. data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
  51. data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
  52. data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
  53. data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
  54. data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
  55. data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
  56. data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
  57. data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
  58. data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
  59. data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
  60. data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
  61. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
  62. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
  63. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
  64. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
  65. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
  66. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
  67. data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
  68. data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
  69. data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
  70. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
  71. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
  72. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
  73. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
  74. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
  75. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
  76. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
  77. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
  78. data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
  79. data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
  80. data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
  81. data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
  82. data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
  83. data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
  84. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
  85. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
  86. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
  87. data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
  88. data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
  89. data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
  90. data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
  91. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
  92. data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
  93. data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
  94. data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
  95. data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
  96. data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
  97. data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
  98. data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
  99. data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
  100. data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
  101. data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
  102. data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
  103. data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
  104. data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
  105. data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
  106. data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
  107. data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
  108. data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
  109. data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
  110. data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
  111. data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
  112. data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
  113. data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
  114. data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
  115. data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
  116. data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
  117. data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
  118. data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
  119. data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
  120. data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
  121. data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
  122. data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
  123. data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
  124. data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
  125. data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
  126. data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
  127. data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
  128. data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
  129. data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
  130. data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
  131. data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
  132. data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
  133. data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
  134. data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
  135. data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
  136. data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
  137. data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
  138. data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
  139. data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
  140. data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
  141. data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
  142. data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
  143. data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
  144. data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
  145. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
  146. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
  147. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
  148. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
  149. data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
  150. data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
  151. data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
  152. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
  153. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
  154. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
  155. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
  156. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
  157. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
  158. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
  159. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
  160. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
  161. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
  162. data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
  163. data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
  164. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
  165. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
  166. data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
  167. data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
  168. data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
  169. data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
  170. data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
  171. data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
  172. data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
  173. data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
  174. data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
  175. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
  176. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
  177. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
  178. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
  179. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
  180. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
  181. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
  182. data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
  183. data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
  184. data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
  185. data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
  186. data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
  187. data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
  188. data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
  189. data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
  190. data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
  191. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
  192. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
  193. data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
  194. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
  195. data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
  196. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
  197. data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
  198. data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
  199. data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
  200. data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
  201. data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
  202. data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
  203. data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
  204. data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
  205. data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
  206. data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
  207. data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
  208. data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
  209. data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
  210. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
  211. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
  212. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
  213. data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
  214. data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
  215. data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
  216. data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
  217. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
  218. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
  219. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
  220. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
  221. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
  222. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
  223. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
  224. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
  225. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
  226. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
  227. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
  228. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
  229. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
  230. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
  231. data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
  232. data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
  233. data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
  234. data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
  235. data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
  236. data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
  237. data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
  238. data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
  239. data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
  240. data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
  241. data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
  242. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
  243. data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
  244. data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
  245. data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
  246. data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
  247. data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
  248. data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
  249. data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
  250. data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
  251. data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
  252. data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
  253. data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
  254. data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
  255. data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
  256. data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
  257. data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
  258. data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
  259. data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
  260. data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
  261. data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
  262. data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
  263. data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
  264. data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
  265. data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
  266. data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
  267. data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
  268. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
  269. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
  270. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
  271. data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
  272. data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
  273. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
  274. data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
  275. data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
  276. data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
  277. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
  278. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
  279. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
  280. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
  281. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
  282. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
  283. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
  284. data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
  285. data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
  286. data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
  287. data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
  288. data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
  289. data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
  290. data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
  291. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
  292. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
  293. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
  294. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
  295. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
  296. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
  297. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
  298. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
  299. data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
  300. data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
  301. data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
  302. data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
  303. data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
  304. data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
  305. data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
  306. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
  307. data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
  308. data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
  309. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
  310. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
  311. data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
  312. data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
  313. data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
  314. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
  315. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
  316. data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
  317. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
  318. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
  319. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
  320. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
  321. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
  322. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
  323. data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
  324. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
  325. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
  326. data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
  327. data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
  328. data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
  329. data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
  330. data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
  331. data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
  332. data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
  333. data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
  334. data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
  335. data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
  336. data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
  337. data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
  338. data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
  339. data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
  340. data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
  341. data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
  342. data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
  343. data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
  344. data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
  345. data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
  346. data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
  347. data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
  348. data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
  349. data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
  350. data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
  351. data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
  352. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
  353. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
  354. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
  355. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
  356. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
  357. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
  358. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
  359. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
  360. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
  361. data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
  362. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
  363. data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
  364. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
  365. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
  366. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
  367. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  368. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
  369. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
  370. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
  371. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
  372. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
  373. data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
  374. data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
  375. data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
  376. data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
  377. data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
  378. data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
  379. data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
  380. data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
  381. data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
  382. data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
  383. data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
  384. data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
  385. data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
  386. data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
  387. data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
  388. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
  389. data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
  390. data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
  391. data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
  392. data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
  393. data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
  394. data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
  395. data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
  396. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
  397. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
  398. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
  399. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
  400. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
  401. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
  402. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
  403. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
  404. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
  405. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
  406. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
  407. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
  408. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
  409. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
  410. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
  411. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
  412. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
  413. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
  414. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
  415. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
  416. data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
  417. data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
  418. data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
  419. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
  420. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
  421. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
  422. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
  423. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
  424. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
  425. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
  426. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
  427. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
  428. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
  429. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
  430. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
  431. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
  432. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
  433. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
  434. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
  435. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
  436. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
  437. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
  438. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
  439. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
  440. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
  441. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
  442. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
  443. data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
  444. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
  445. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
  446. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
  447. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
  448. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
  449. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
  450. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
  451. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
  452. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
  453. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
  454. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
  455. data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
  456. data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
  457. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
  458. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
  459. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
  460. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
  461. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
  462. data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
  463. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
  464. data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
  465. data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
  466. data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
  467. data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
  468. data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
  469. data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
  470. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
  471. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
  472. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
  473. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
  474. data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
  475. data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
  476. data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
  477. data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
  478. data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
  479. data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
  480. data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
  481. data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
  482. data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
  483. data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
  484. data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
  485. data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
  486. data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
  487. data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
  488. data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
  489. data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
  490. data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
  491. data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
  492. data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
  493. metadata +554 -0
@@ -0,0 +1,756 @@
1
+ # = net/telnet.rb - Simple Telnet Client Library
2
+ #
3
+ # Author:: Wakou Aoyama <wakou@ruby-lang.org>
4
+ # Documentation:: William Webber and Wakou Aoyama
5
+ #
6
+ # This file holds the class Net::Telnet, which provides client-side
7
+ # telnet functionality.
8
+ #
9
+ # For documentation, see Net::Telnet.
10
+ #
11
+
12
+ require "socket"
13
+ require "delegate"
14
+ require "timeout"
15
+ require "English"
16
+
17
+ module Net
18
+
19
+ #
20
+ # == Net::Telnet
21
+ #
22
+ # Provides telnet client functionality.
23
+ #
24
+ # This class also has, through delegation, all the methods of a
25
+ # socket object (by default, a +TCPSocket+, but can be set by the
26
+ # +Proxy+ option to <tt>new()</tt>). This provides methods such as
27
+ # <tt>close()</tt> to end the session and <tt>sysread()</tt> to read
28
+ # data directly from the host, instead of via the <tt>waitfor()</tt>
29
+ # mechanism. Note that if you do use <tt>sysread()</tt> directly
30
+ # when in telnet mode, you should probably pass the output through
31
+ # <tt>preprocess()</tt> to extract telnet command sequences.
32
+ #
33
+ # == Overview
34
+ #
35
+ # The telnet protocol allows a client to login remotely to a user
36
+ # account on a server and execute commands via a shell. The equivalent
37
+ # is done by creating a Net::Telnet class with the +Host+ option
38
+ # set to your host, calling #login() with your user and password,
39
+ # issuing one or more #cmd() calls, and then calling #close()
40
+ # to end the session. The #waitfor(), #print(), #puts(), and
41
+ # #write() methods, which #cmd() is implemented on top of, are
42
+ # only needed if you are doing something more complicated.
43
+ #
44
+ # A Net::Telnet object can also be used to connect to non-telnet
45
+ # services, such as SMTP or HTTP. In this case, you normally
46
+ # want to provide the +Port+ option to specify the port to
47
+ # connect to, and set the +Telnetmode+ option to false to prevent
48
+ # the client from attempting to interpret telnet command sequences.
49
+ # Generally, #login() will not work with other protocols, and you
50
+ # have to handle authentication yourself.
51
+ #
52
+ # For some protocols, it will be possible to specify the +Prompt+
53
+ # option once when you create the Telnet object and use #cmd() calls;
54
+ # for others, you will have to specify the response sequence to
55
+ # look for as the Match option to every #cmd() call, or call
56
+ # #puts() and #waitfor() directly; for yet others, you will have
57
+ # to use #sysread() instead of #waitfor() and parse server
58
+ # responses yourself.
59
+ #
60
+ # It is worth noting that when you create a new Net::Telnet object,
61
+ # you can supply a proxy IO channel via the Proxy option. This
62
+ # can be used to attach the Telnet object to other Telnet objects,
63
+ # to already open sockets, or to any read-write IO object. This
64
+ # can be useful, for instance, for setting up a test fixture for
65
+ # unit testing.
66
+ #
67
+ # == Examples
68
+ #
69
+ # === Log in and send a command, echoing all output to stdout
70
+ #
71
+ # localhost = Net::Telnet::new("Host" => "localhost",
72
+ # "Timeout" => 10,
73
+ # "Prompt" => /[$%#>] \z/n)
74
+ # localhost.login("username", "password") { |c| print c }
75
+ # localhost.cmd("command") { |c| print c }
76
+ # localhost.close
77
+ #
78
+ #
79
+ # === Check a POP server to see if you have mail
80
+ #
81
+ # pop = Net::Telnet::new("Host" => "your_destination_host_here",
82
+ # "Port" => 110,
83
+ # "Telnetmode" => false,
84
+ # "Prompt" => /^\+OK/n)
85
+ # pop.cmd("user " + "your_username_here") { |c| print c }
86
+ # pop.cmd("pass " + "your_password_here") { |c| print c }
87
+ # pop.cmd("list") { |c| print c }
88
+ #
89
+ # == References
90
+ #
91
+ # There are a large number of RFCs relevant to the Telnet protocol.
92
+ # RFCs 854-861 define the base protocol. For a complete listing
93
+ # of relevant RFCs, see
94
+ # http://www.omnifarious.org/~hopper/technical/telnet-rfc.html
95
+ #
96
+ class Telnet < SimpleDelegator
97
+
98
+ # :stopdoc:
99
+ IAC = 255.chr # "\377" # "\xff" # interpret as command
100
+ DONT = 254.chr # "\376" # "\xfe" # you are not to use option
101
+ DO = 253.chr # "\375" # "\xfd" # please, you use option
102
+ WONT = 252.chr # "\374" # "\xfc" # I won't use option
103
+ WILL = 251.chr # "\373" # "\xfb" # I will use option
104
+ SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation
105
+ GA = 249.chr # "\371" # "\xf9" # you may reverse the line
106
+ EL = 248.chr # "\370" # "\xf8" # erase the current line
107
+ EC = 247.chr # "\367" # "\xf7" # erase the current character
108
+ AYT = 246.chr # "\366" # "\xf6" # are you there
109
+ AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish
110
+ IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently
111
+ BREAK = 243.chr # "\363" # "\xf3" # break
112
+ DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning
113
+ NOP = 241.chr # "\361" # "\xf1" # nop
114
+ SE = 240.chr # "\360" # "\xf0" # end sub negotiation
115
+ EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode)
116
+ ABORT = 238.chr # "\356" # "\xee" # Abort process
117
+ SUSP = 237.chr # "\355" # "\xed" # Suspend process
118
+ EOF = 236.chr # "\354" # "\xec" # End of file
119
+ SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls
120
+
121
+ OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission
122
+ OPT_ECHO = 1.chr # "\001" # "\x01" # Echo
123
+ OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection
124
+ OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead
125
+ OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation
126
+ OPT_STATUS = 5.chr # "\005" # "\x05" # Status
127
+ OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark
128
+ OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo
129
+ OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width
130
+ OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size
131
+ OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition
132
+ OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops
133
+ OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition
134
+ OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition
135
+ OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops
136
+ OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition
137
+ OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition
138
+ OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII
139
+ OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout
140
+ OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro
141
+ OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal
142
+ OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP
143
+ OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output
144
+ OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location
145
+ OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type
146
+ OPT_EOR = 25.chr # "\031" # "\x19" # End of Record
147
+ OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification
148
+ OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking
149
+ OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number
150
+ OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime
151
+ OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD
152
+ OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size
153
+ OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed
154
+ OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control
155
+ OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode
156
+ OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location
157
+ OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option
158
+ OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option
159
+ OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option
160
+ OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option
161
+ OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List
162
+
163
+ NULL = "\000"
164
+ CR = "\015"
165
+ LF = "\012"
166
+ EOL = CR + LF
167
+ REVISION = '$Id: telnet.rb 16458 2008-05-18 15:02:36Z knu $'
168
+ # :startdoc:
169
+
170
+ #
171
+ # Creates a new Net::Telnet object.
172
+ #
173
+ # Attempts to connect to the host (unless the Proxy option is
174
+ # provided: see below). If a block is provided, it is yielded
175
+ # status messages on the attempt to connect to the server, of
176
+ # the form:
177
+ #
178
+ # Trying localhost...
179
+ # Connected to localhost.
180
+ #
181
+ # +options+ is a hash of options. The following example lists
182
+ # all options and their default values.
183
+ #
184
+ # host = Net::Telnet::new(
185
+ # "Host" => "localhost", # default: "localhost"
186
+ # "Port" => 23, # default: 23
187
+ # "Binmode" => false, # default: false
188
+ # "Output_log" => "output_log", # default: nil (no output)
189
+ # "Dump_log" => "dump_log", # default: nil (no output)
190
+ # "Prompt" => /[$%#>] \z/n, # default: /[$%#>] \z/n
191
+ # "Telnetmode" => true, # default: true
192
+ # "Timeout" => 10, # default: 10
193
+ # # if ignore timeout then set "Timeout" to false.
194
+ # "Waittime" => 0, # default: 0
195
+ # "Proxy" => proxy # default: nil
196
+ # # proxy is Net::Telnet or IO object
197
+ # )
198
+ #
199
+ # The options have the following meanings:
200
+ #
201
+ # Host:: the hostname or IP address of the host to connect to, as a String.
202
+ # Defaults to "localhost".
203
+ #
204
+ # Port:: the port to connect to. Defaults to 23.
205
+ #
206
+ # Binmode:: if false (the default), newline substitution is performed.
207
+ # Outgoing LF is
208
+ # converted to CRLF, and incoming CRLF is converted to LF. If
209
+ # true, this substitution is not performed. This value can
210
+ # also be set with the #binmode() method. The
211
+ # outgoing conversion only applies to the #puts() and #print()
212
+ # methods, not the #write() method. The precise nature of
213
+ # the newline conversion is also affected by the telnet options
214
+ # SGA and BIN.
215
+ #
216
+ # Output_log:: the name of the file to write connection status messages
217
+ # and all received traffic to. In the case of a proper
218
+ # Telnet session, this will include the client input as
219
+ # echoed by the host; otherwise, it only includes server
220
+ # responses. Output is appended verbatim to this file.
221
+ # By default, no output log is kept.
222
+ #
223
+ # Dump_log:: as for Output_log, except that output is written in hexdump
224
+ # format (16 bytes per line as hex pairs, followed by their
225
+ # printable equivalent), with connection status messages
226
+ # preceded by '#', sent traffic preceded by '>', and
227
+ # received traffic preceded by '<'. By default, not dump log
228
+ # is kept.
229
+ #
230
+ # Prompt:: a regular expression matching the host's command-line prompt
231
+ # sequence. This is needed by the Telnet class to determine
232
+ # when the output from a command has finished and the host is
233
+ # ready to receive a new command. By default, this regular
234
+ # expression is /[$%#>] \z/n.
235
+ #
236
+ # Telnetmode:: a boolean value, true by default. In telnet mode,
237
+ # traffic received from the host is parsed for special
238
+ # command sequences, and these sequences are escaped
239
+ # in outgoing traffic sent using #puts() or #print()
240
+ # (but not #write()). If you are using the Net::Telnet
241
+ # object to connect to a non-telnet service (such as
242
+ # SMTP or POP), this should be set to "false" to prevent
243
+ # undesired data corruption. This value can also be set
244
+ # by the #telnetmode() method.
245
+ #
246
+ # Timeout:: the number of seconds to wait before timing out both the
247
+ # initial attempt to connect to host (in this constructor),
248
+ # and all attempts to read data from the host (in #waitfor(),
249
+ # #cmd(), and #login()). Exceeding this timeout causes a
250
+ # TimeoutError to be raised. The default value is 10 seconds.
251
+ # You can disable the timeout by setting this value to false.
252
+ # In this case, the connect attempt will eventually timeout
253
+ # on the underlying connect(2) socket call with an
254
+ # Errno::ETIMEDOUT error (but generally only after a few
255
+ # minutes), but other attempts to read data from the host
256
+ # will hand indefinitely if no data is forthcoming.
257
+ #
258
+ # Waittime:: the amount of time to wait after seeing what looks like a
259
+ # prompt (that is, received data that matches the Prompt
260
+ # option regular expression) to see if more data arrives.
261
+ # If more data does arrive in this time, Net::Telnet assumes
262
+ # that what it saw was not really a prompt. This is to try to
263
+ # avoid false matches, but it can also lead to missing real
264
+ # prompts (if, for instance, a background process writes to
265
+ # the terminal soon after the prompt is displayed). By
266
+ # default, set to 0, meaning not to wait for more data.
267
+ #
268
+ # Proxy:: a proxy object to used instead of opening a direct connection
269
+ # to the host. Must be either another Net::Telnet object or
270
+ # an IO object. If it is another Net::Telnet object, this
271
+ # instance will use that one's socket for communication. If an
272
+ # IO object, it is used directly for communication. Any other
273
+ # kind of object will cause an error to be raised.
274
+ #
275
+ def initialize(options) # :yield: mesg
276
+ @options = options
277
+ @options["Host"] = "localhost" unless @options.has_key?("Host")
278
+ @options["Port"] = 23 unless @options.has_key?("Port")
279
+ @options["Prompt"] = /[$%#>] \z/n unless @options.has_key?("Prompt")
280
+ @options["Timeout"] = 10 unless @options.has_key?("Timeout")
281
+ @options["Waittime"] = 0 unless @options.has_key?("Waittime")
282
+ unless @options.has_key?("Binmode")
283
+ @options["Binmode"] = false
284
+ else
285
+ unless (true == @options["Binmode"] or false == @options["Binmode"])
286
+ raise ArgumentError, "Binmode option must be true or false"
287
+ end
288
+ end
289
+
290
+ unless @options.has_key?("Telnetmode")
291
+ @options["Telnetmode"] = true
292
+ else
293
+ unless (true == @options["Telnetmode"] or false == @options["Telnetmode"])
294
+ raise ArgumentError, "Telnetmode option must be true or false"
295
+ end
296
+ end
297
+
298
+ @telnet_option = { "SGA" => false, "BINARY" => false }
299
+
300
+ if @options.has_key?("Output_log")
301
+ @log = File.open(@options["Output_log"], 'a+')
302
+ @log.sync = true
303
+ @log.binmode
304
+ end
305
+
306
+ if @options.has_key?("Dump_log")
307
+ @dumplog = File.open(@options["Dump_log"], 'a+')
308
+ @dumplog.sync = true
309
+ @dumplog.binmode
310
+ def @dumplog.log_dump(dir, x) # :nodoc:
311
+ len = x.length
312
+ addr = 0
313
+ offset = 0
314
+ while 0 < len
315
+ if len < 16
316
+ line = x[offset, len]
317
+ else
318
+ line = x[offset, 16]
319
+ end
320
+ hexvals = line.unpack('H*')[0]
321
+ hexvals += ' ' * (32 - hexvals.length)
322
+ hexvals = format("%s %s %s %s " * 4, *hexvals.unpack('a2' * 16))
323
+ line = line.gsub(/[\000-\037\177-\377]/n, '.')
324
+ printf "%s 0x%5.5x: %s%s\n", dir, addr, hexvals, line
325
+ addr += 16
326
+ offset += 16
327
+ len -= 16
328
+ end
329
+ print "\n"
330
+ end
331
+ end
332
+
333
+ if @options.has_key?("Proxy")
334
+ if @options["Proxy"].kind_of?(Net::Telnet)
335
+ @sock = @options["Proxy"].sock
336
+ elsif @options["Proxy"].kind_of?(IO)
337
+ @sock = @options["Proxy"]
338
+ else
339
+ raise "Error: Proxy must be an instance of Net::Telnet or IO."
340
+ end
341
+ else
342
+ message = "Trying " + @options["Host"] + "...\n"
343
+ yield(message) if block_given?
344
+ @log.write(message) if @options.has_key?("Output_log")
345
+ @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
346
+
347
+ begin
348
+ if @options["Timeout"] == false
349
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
350
+ else
351
+ timeout(@options["Timeout"]) do
352
+ @sock = TCPSocket.open(@options["Host"], @options["Port"])
353
+ end
354
+ end
355
+ rescue TimeoutError
356
+ raise TimeoutError, "timed out while opening a connection to the host"
357
+ rescue
358
+ @log.write($ERROR_INFO.to_s + "\n") if @options.has_key?("Output_log")
359
+ @dumplog.log_dump('#', $ERROR_INFO.to_s + "\n") if @options.has_key?("Dump_log")
360
+ raise
361
+ end
362
+ @sock.sync = true
363
+ @sock.binmode
364
+
365
+ message = "Connected to " + @options["Host"] + ".\n"
366
+ yield(message) if block_given?
367
+ @log.write(message) if @options.has_key?("Output_log")
368
+ @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
369
+ end
370
+
371
+ super(@sock)
372
+ end # initialize
373
+
374
+ # The socket the Telnet object is using. Note that this object becomes
375
+ # a delegate of the Telnet object, so normally you invoke its methods
376
+ # directly on the Telnet object.
377
+ attr :sock
378
+
379
+ # Set telnet command interpretation on (+mode+ == true) or off
380
+ # (+mode+ == false), or return the current value (+mode+ not
381
+ # provided). It should be on for true telnet sessions, off if
382
+ # using Net::Telnet to connect to a non-telnet service such
383
+ # as SMTP.
384
+ def telnetmode(mode = nil)
385
+ case mode
386
+ when nil
387
+ @options["Telnetmode"]
388
+ when true, false
389
+ @options["Telnetmode"] = mode
390
+ else
391
+ raise ArgumentError, "argument must be true or false, or missing"
392
+ end
393
+ end
394
+
395
+ # Turn telnet command interpretation on (true) or off (false). It
396
+ # should be on for true telnet sessions, off if using Net::Telnet
397
+ # to connect to a non-telnet service such as SMTP.
398
+ def telnetmode=(mode)
399
+ if (true == mode or false == mode)
400
+ @options["Telnetmode"] = mode
401
+ else
402
+ raise ArgumentError, "argument must be true or false"
403
+ end
404
+ end
405
+
406
+ # Turn newline conversion on (+mode+ == false) or off (+mode+ == true),
407
+ # or return the current value (+mode+ is not specified).
408
+ def binmode(mode = nil)
409
+ case mode
410
+ when nil
411
+ @options["Binmode"]
412
+ when true, false
413
+ @options["Binmode"] = mode
414
+ else
415
+ raise ArgumentError, "argument must be true or false"
416
+ end
417
+ end
418
+
419
+ # Turn newline conversion on (false) or off (true).
420
+ def binmode=(mode)
421
+ if (true == mode or false == mode)
422
+ @options["Binmode"] = mode
423
+ else
424
+ raise ArgumentError, "argument must be true or false"
425
+ end
426
+ end
427
+
428
+ # Preprocess received data from the host.
429
+ #
430
+ # Performs newline conversion and detects telnet command sequences.
431
+ # Called automatically by #waitfor(). You should only use this
432
+ # method yourself if you have read input directly using sysread()
433
+ # or similar, and even then only if in telnet mode.
434
+ def preprocess(string)
435
+ # combine CR+NULL into CR
436
+ string = string.gsub(/#{CR}#{NULL}/no, CR) if @options["Telnetmode"]
437
+
438
+ # combine EOL into "\n"
439
+ string = string.gsub(/#{EOL}/no, "\n") unless @options["Binmode"]
440
+
441
+ string.gsub(/#{IAC}(
442
+ [#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]|
443
+ [#{DO}#{DONT}#{WILL}#{WONT}]
444
+ [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]|
445
+ #{SB}[^#{IAC}]*#{IAC}#{SE}
446
+ )/xno) do
447
+ if IAC == $1 # handle escaped IAC characters
448
+ IAC
449
+ elsif AYT == $1 # respond to "IAC AYT" (are you there)
450
+ self.write("nobody here but us pigeons" + EOL)
451
+ ''
452
+ elsif DO[0] == $1[0] # respond to "IAC DO x"
453
+ if OPT_BINARY[0] == $1[1]
454
+ @telnet_option["BINARY"] = true
455
+ self.write(IAC + WILL + OPT_BINARY)
456
+ else
457
+ self.write(IAC + WONT + $1[1..1])
458
+ end
459
+ ''
460
+ elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x"
461
+ self.write(IAC + WONT + $1[1..1])
462
+ ''
463
+ elsif WILL[0] == $1[0] # respond to "IAC WILL x"
464
+ if OPT_BINARY[0] == $1[1]
465
+ self.write(IAC + DO + OPT_BINARY)
466
+ elsif OPT_ECHO[0] == $1[1]
467
+ self.write(IAC + DO + OPT_ECHO)
468
+ elsif OPT_SGA[0] == $1[1]
469
+ @telnet_option["SGA"] = true
470
+ self.write(IAC + DO + OPT_SGA)
471
+ else
472
+ self.write(IAC + DONT + $1[1..1])
473
+ end
474
+ ''
475
+ elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
476
+ if OPT_ECHO[0] == $1[1]
477
+ self.write(IAC + DONT + OPT_ECHO)
478
+ elsif OPT_SGA[0] == $1[1]
479
+ @telnet_option["SGA"] = false
480
+ self.write(IAC + DONT + OPT_SGA)
481
+ else
482
+ self.write(IAC + DONT + $1[1..1])
483
+ end
484
+ ''
485
+ else
486
+ ''
487
+ end
488
+ end
489
+ end # preprocess
490
+
491
+ # Read data from the host until a certain sequence is matched.
492
+ #
493
+ # If a block is given, the received data will be yielded as it
494
+ # is read in (not necessarily all in one go), or nil if EOF
495
+ # occurs before any data is received. Whether a block is given
496
+ # or not, all data read will be returned in a single string, or again
497
+ # nil if EOF occurs before any data is received. Note that
498
+ # received data includes the matched sequence we were looking for.
499
+ #
500
+ # +options+ can be either a regular expression or a hash of options.
501
+ # If a regular expression, this specifies the data to wait for.
502
+ # If a hash, this can specify the following options:
503
+ #
504
+ # Match:: a regular expression, specifying the data to wait for.
505
+ # Prompt:: as for Match; used only if Match is not specified.
506
+ # String:: as for Match, except a string that will be converted
507
+ # into a regular expression. Used only if Match and
508
+ # Prompt are not specified.
509
+ # Timeout:: the number of seconds to wait for data from the host
510
+ # before raising a TimeoutError. If set to false,
511
+ # no timeout will occur. If not specified, the
512
+ # Timeout option value specified when this instance
513
+ # was created will be used, or, failing that, the
514
+ # default value of 10 seconds.
515
+ # Waittime:: the number of seconds to wait after matching against
516
+ # the input data to see if more data arrives. If more
517
+ # data arrives within this time, we will judge ourselves
518
+ # not to have matched successfully, and will continue
519
+ # trying to match. If not specified, the Waittime option
520
+ # value specified when this instance was created will be
521
+ # used, or, failing that, the default value of 0 seconds,
522
+ # which means not to wait for more input.
523
+ # FailEOF:: if true, when the remote end closes the connection then an
524
+ # EOFError will be raised. Otherwise, defaults to the old
525
+ # behaviour that the function will return whatever data
526
+ # has been received already, or nil if nothing was received.
527
+ #
528
+ def waitfor(options) # :yield: recvdata
529
+ time_out = @options["Timeout"]
530
+ waittime = @options["Waittime"]
531
+ fail_eof = @options["FailEOF"]
532
+
533
+ if options.kind_of?(Hash)
534
+ prompt = if options.has_key?("Match")
535
+ options["Match"]
536
+ elsif options.has_key?("Prompt")
537
+ options["Prompt"]
538
+ elsif options.has_key?("String")
539
+ Regexp.new( Regexp.quote(options["String"]) )
540
+ end
541
+ time_out = options["Timeout"] if options.has_key?("Timeout")
542
+ waittime = options["Waittime"] if options.has_key?("Waittime")
543
+ fail_eof = options["FailEOF"] if options.has_key?("FailEOF")
544
+ else
545
+ prompt = options
546
+ end
547
+
548
+ if time_out == false
549
+ time_out = nil
550
+ end
551
+
552
+ line = ''
553
+ buf = ''
554
+ rest = ''
555
+ until(prompt === line and not IO::select([@sock], nil, nil, waittime))
556
+ unless IO::select([@sock], nil, nil, time_out)
557
+ raise TimeoutError, "timed out while waiting for more data"
558
+ end
559
+ begin
560
+ c = @sock.readpartial(1024 * 1024)
561
+ @dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
562
+ if @options["Telnetmode"]
563
+ c = rest + c
564
+ if Integer(c.rindex(/#{IAC}#{SE}/no)) <
565
+ Integer(c.rindex(/#{IAC}#{SB}/no))
566
+ buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
567
+ rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
568
+ elsif pt = c.rindex(/#{IAC}[^#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||
569
+ c.rindex(/\r\z/no)
570
+ buf = preprocess(c[0 ... pt])
571
+ rest = c[pt .. -1]
572
+ else
573
+ buf = preprocess(c)
574
+ rest = ''
575
+ end
576
+ else
577
+ # Not Telnetmode.
578
+ #
579
+ # We cannot use preprocess() on this data, because that
580
+ # method makes some Telnetmode-specific assumptions.
581
+ buf = rest + c
582
+ rest = ''
583
+ unless @options["Binmode"]
584
+ if pt = buf.rindex(/\r\z/no)
585
+ buf = buf[0 ... pt]
586
+ rest = buf[pt .. -1]
587
+ end
588
+ buf.gsub!(/#{EOL}/no, "\n")
589
+ end
590
+ end
591
+ @log.print(buf) if @options.has_key?("Output_log")
592
+ line += buf
593
+ yield buf if block_given?
594
+ rescue EOFError # End of file reached
595
+ raise if fail_eof
596
+ if line == ''
597
+ line = nil
598
+ yield nil if block_given?
599
+ end
600
+ break
601
+ end
602
+ end
603
+ line
604
+ end
605
+
606
+ # Write +string+ to the host.
607
+ #
608
+ # Does not perform any conversions on +string+. Will log +string+ to the
609
+ # dumplog, if the Dump_log option is set.
610
+ def write(string)
611
+ length = string.length
612
+ while 0 < length
613
+ IO::select(nil, [@sock])
614
+ @dumplog.log_dump('>', string[-length..-1]) if @options.has_key?("Dump_log")
615
+ length -= @sock.syswrite(string[-length..-1])
616
+ end
617
+ end
618
+
619
+ # Sends a string to the host.
620
+ #
621
+ # This does _not_ automatically append a newline to the string. Embedded
622
+ # newlines may be converted and telnet command sequences escaped
623
+ # depending upon the values of telnetmode, binmode, and telnet options
624
+ # set by the host.
625
+ def print(string)
626
+ string = string.gsub(/#{IAC}/no, IAC + IAC) if @options["Telnetmode"]
627
+
628
+ if @options["Binmode"]
629
+ self.write(string)
630
+ else
631
+ if @telnet_option["BINARY"] and @telnet_option["SGA"]
632
+ # IAC WILL SGA IAC DO BIN send EOL --> CR
633
+ self.write(string.gsub(/\n/n, CR))
634
+ elsif @telnet_option["SGA"]
635
+ # IAC WILL SGA send EOL --> CR+NULL
636
+ self.write(string.gsub(/\n/n, CR + NULL))
637
+ else
638
+ # NONE send EOL --> CR+LF
639
+ self.write(string.gsub(/\n/n, EOL))
640
+ end
641
+ end
642
+ end
643
+
644
+ # Sends a string to the host.
645
+ #
646
+ # Same as #print(), but appends a newline to the string.
647
+ def puts(string)
648
+ self.print(string + "\n")
649
+ end
650
+
651
+ # Send a command to the host.
652
+ #
653
+ # More exactly, sends a string to the host, and reads in all received
654
+ # data until is sees the prompt or other matched sequence.
655
+ #
656
+ # If a block is given, the received data will be yielded to it as
657
+ # it is read in. Whether a block is given or not, the received data
658
+ # will be return as a string. Note that the received data includes
659
+ # the prompt and in most cases the host's echo of our command.
660
+ #
661
+ # +options+ is either a String, specified the string or command to
662
+ # send to the host; or it is a hash of options. If a hash, the
663
+ # following options can be specified:
664
+ #
665
+ # String:: the command or other string to send to the host.
666
+ # Match:: a regular expression, the sequence to look for in
667
+ # the received data before returning. If not specified,
668
+ # the Prompt option value specified when this instance
669
+ # was created will be used, or, failing that, the default
670
+ # prompt of /[$%#>] \z/n.
671
+ # Timeout:: the seconds to wait for data from the host before raising
672
+ # a Timeout error. If not specified, the Timeout option
673
+ # value specified when this instance was created will be
674
+ # used, or, failing that, the default value of 10 seconds.
675
+ #
676
+ # The command or other string will have the newline sequence appended
677
+ # to it.
678
+ def cmd(options) # :yield: recvdata
679
+ match = @options["Prompt"]
680
+ time_out = @options["Timeout"]
681
+
682
+ if options.kind_of?(Hash)
683
+ string = options["String"]
684
+ match = options["Match"] if options.has_key?("Match")
685
+ time_out = options["Timeout"] if options.has_key?("Timeout")
686
+ else
687
+ string = options
688
+ end
689
+
690
+ self.puts(string)
691
+ if block_given?
692
+ waitfor({"Prompt" => match, "Timeout" => time_out}){|c| yield c }
693
+ else
694
+ waitfor({"Prompt" => match, "Timeout" => time_out})
695
+ end
696
+ end
697
+
698
+ # Login to the host with a given username and password.
699
+ #
700
+ # The username and password can either be provided as two string
701
+ # arguments in that order, or as a hash with keys "Name" and
702
+ # "Password".
703
+ #
704
+ # This method looks for the strings "login" and "Password" from the
705
+ # host to determine when to send the username and password. If the
706
+ # login sequence does not follow this pattern (for instance, you
707
+ # are connecting to a service other than telnet), you will need
708
+ # to handle login yourself.
709
+ #
710
+ # The password can be omitted, either by only
711
+ # provided one String argument, which will be used as the username,
712
+ # or by providing a has that has no "Password" key. In this case,
713
+ # the method will not look for the "Password:" prompt; if it is
714
+ # sent, it will have to be dealt with by later calls.
715
+ #
716
+ # The method returns all data received during the login process from
717
+ # the host, including the echoed username but not the password (which
718
+ # the host should not echo). If a block is passed in, this received
719
+ # data is also yielded to the block as it is received.
720
+ def login(options, password = nil) # :yield: recvdata
721
+ login_prompt = /[Ll]ogin[: ]*\z/n
722
+ password_prompt = /[Pp]ass(?:word|phrase)[: ]*\z/n
723
+ if options.kind_of?(Hash)
724
+ username = options["Name"]
725
+ password = options["Password"]
726
+ login_prompt = options["LoginPrompt"] if options["LoginPrompt"]
727
+ password_prompt = options["PasswordPrompt"] if options["PasswordPrompt"]
728
+ else
729
+ username = options
730
+ end
731
+
732
+ if block_given?
733
+ line = waitfor(login_prompt){|c| yield c }
734
+ if password
735
+ line += cmd({"String" => username,
736
+ "Match" => password_prompt}){|c| yield c }
737
+ line += cmd(password){|c| yield c }
738
+ else
739
+ line += cmd(username){|c| yield c }
740
+ end
741
+ else
742
+ line = waitfor(login_prompt)
743
+ if password
744
+ line += cmd({"String" => username,
745
+ "Match" => password_prompt})
746
+ line += cmd(password)
747
+ else
748
+ line += cmd(username)
749
+ end
750
+ end
751
+ line
752
+ end
753
+
754
+ end # class Telnet
755
+ end # module Net
756
+