ruby_on_ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/lib/ruby_on_ruby.rb +5 -0
- data/lib/ruby_on_ruby/console.rb +7 -0
- data/lib/ruby_on_ruby/context.rb +33 -0
- data/lib/ruby_on_ruby/file_loader.rb +31 -0
- data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
- data/lib/ruby_on_ruby/version.rb +3 -0
- data/lib/rubyonruby.rb +1 -0
- data/ruby_in_ruby.gemspec +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
- data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
- data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
- data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
- data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
- data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
- data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
- data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
- data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
- data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
- data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
- data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
- data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
- data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
- data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
- data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
- data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
- data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
- data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
- data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
- data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
- data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
- data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
- data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
- data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
- data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
- data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
- data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
- data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
- data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
- data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
- data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
- data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
- data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
- data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
- data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
- data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
- data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
- metadata +554 -0
@@ -0,0 +1,269 @@
|
|
1
|
+
#
|
2
|
+
# shell.rb -
|
3
|
+
# $Release Version: 0.6.0 $
|
4
|
+
# $Revision: 1.8 $
|
5
|
+
# $Date: 2001/03/19 09:01:11 $
|
6
|
+
# by Keiju ISHITSUKA(Nippon Rational Inc.)
|
7
|
+
#
|
8
|
+
# --
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
|
13
|
+
require "e2mmap"
|
14
|
+
require "thread"
|
15
|
+
|
16
|
+
require "shell/error"
|
17
|
+
require "shell/command-processor"
|
18
|
+
require "shell/process-controller"
|
19
|
+
|
20
|
+
class Shell
|
21
|
+
@RCS_ID='-$Id: shell.rb,v 1.8 2001/03/19 09:01:11 keiju Exp keiju $-'
|
22
|
+
|
23
|
+
include Error
|
24
|
+
extend Exception2MessageMapper
|
25
|
+
|
26
|
+
# @cascade = true
|
27
|
+
# debug: true -> normal debug
|
28
|
+
# debug: 1 -> eval definition debug
|
29
|
+
# debug: 2 -> detail inspect debug
|
30
|
+
@debug = false
|
31
|
+
@verbose = true
|
32
|
+
|
33
|
+
class << Shell
|
34
|
+
attr :cascade, true
|
35
|
+
attr :debug, true
|
36
|
+
attr :verbose, true
|
37
|
+
|
38
|
+
# alias cascade? cascade
|
39
|
+
alias debug? debug
|
40
|
+
alias verbose? verbose
|
41
|
+
@verbose = true
|
42
|
+
|
43
|
+
def debug=(val)
|
44
|
+
@debug = val
|
45
|
+
@verbose = val if val
|
46
|
+
end
|
47
|
+
|
48
|
+
def cd(path)
|
49
|
+
sh = new
|
50
|
+
sh.cd path
|
51
|
+
sh
|
52
|
+
end
|
53
|
+
|
54
|
+
def default_system_path
|
55
|
+
if @default_system_path
|
56
|
+
@default_system_path
|
57
|
+
else
|
58
|
+
ENV["PATH"].split(":")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def default_system_path=(path)
|
63
|
+
@default_system_path = path
|
64
|
+
end
|
65
|
+
|
66
|
+
def default_record_separator
|
67
|
+
if @default_record_separator
|
68
|
+
@default_record_separator
|
69
|
+
else
|
70
|
+
$/
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def default_record_separator=(rs)
|
75
|
+
@default_record_separator = rs
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def initialize
|
80
|
+
@cwd = Dir.pwd
|
81
|
+
@dir_stack = []
|
82
|
+
@umask = nil
|
83
|
+
|
84
|
+
@system_path = Shell.default_system_path
|
85
|
+
@record_separator = Shell.default_record_separator
|
86
|
+
|
87
|
+
@command_processor = CommandProcessor.new(self)
|
88
|
+
@process_controller = ProcessController.new(self)
|
89
|
+
|
90
|
+
@verbose = Shell.verbose
|
91
|
+
@debug = Shell.debug
|
92
|
+
end
|
93
|
+
|
94
|
+
attr_reader :system_path
|
95
|
+
|
96
|
+
def system_path=(path)
|
97
|
+
@system_path = path
|
98
|
+
rehash
|
99
|
+
end
|
100
|
+
|
101
|
+
attr :umask, true
|
102
|
+
attr :record_separator, true
|
103
|
+
|
104
|
+
attr :verbose, true
|
105
|
+
attr :debug, true
|
106
|
+
|
107
|
+
def debug=(val)
|
108
|
+
@debug = val
|
109
|
+
@verbose = val if val
|
110
|
+
end
|
111
|
+
|
112
|
+
alias verbose? verbose
|
113
|
+
alias debug? debug
|
114
|
+
|
115
|
+
attr_reader :command_processor
|
116
|
+
attr_reader :process_controller
|
117
|
+
|
118
|
+
def expand_path(path)
|
119
|
+
File.expand_path(path, @cwd)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Most Shell commands are defined via CommandProcessor
|
123
|
+
|
124
|
+
#
|
125
|
+
# Dir related methods
|
126
|
+
#
|
127
|
+
# Shell#cwd/dir/getwd/pwd
|
128
|
+
# Shell#chdir/cd
|
129
|
+
# Shell#pushdir/pushd
|
130
|
+
# Shell#popdir/popd
|
131
|
+
# Shell#mkdir
|
132
|
+
# Shell#rmdir
|
133
|
+
|
134
|
+
attr :cwd
|
135
|
+
alias dir cwd
|
136
|
+
alias getwd cwd
|
137
|
+
alias pwd cwd
|
138
|
+
|
139
|
+
attr :dir_stack
|
140
|
+
alias dirs dir_stack
|
141
|
+
|
142
|
+
# If called as iterator, it restores the current directory when the
|
143
|
+
# block ends.
|
144
|
+
def chdir(path = nil)
|
145
|
+
if iterator?
|
146
|
+
cwd_old = @cwd
|
147
|
+
begin
|
148
|
+
chdir(path)
|
149
|
+
yield
|
150
|
+
ensure
|
151
|
+
chdir(cwd_old)
|
152
|
+
end
|
153
|
+
else
|
154
|
+
path = "~" unless path
|
155
|
+
@cwd = expand_path(path)
|
156
|
+
notify "current dir: #{@cwd}"
|
157
|
+
rehash
|
158
|
+
self
|
159
|
+
end
|
160
|
+
end
|
161
|
+
alias cd chdir
|
162
|
+
|
163
|
+
def pushdir(path = nil)
|
164
|
+
if iterator?
|
165
|
+
pushdir(path)
|
166
|
+
begin
|
167
|
+
yield
|
168
|
+
ensure
|
169
|
+
popdir
|
170
|
+
end
|
171
|
+
elsif path
|
172
|
+
@dir_stack.push @cwd
|
173
|
+
chdir path
|
174
|
+
notify "dir stack: [#{@dir_stack.join ', '}]"
|
175
|
+
self
|
176
|
+
else
|
177
|
+
if pop = @dir_stack.pop
|
178
|
+
@dir_stack.push @cwd
|
179
|
+
chdir pop
|
180
|
+
notify "dir stack: [#{@dir_stack.join ', '}]"
|
181
|
+
self
|
182
|
+
else
|
183
|
+
Shell.Fail DirStackEmpty
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
alias pushd pushdir
|
188
|
+
|
189
|
+
def popdir
|
190
|
+
if pop = @dir_stack.pop
|
191
|
+
chdir pop
|
192
|
+
notify "dir stack: [#{@dir_stack.join ', '}]"
|
193
|
+
self
|
194
|
+
else
|
195
|
+
Shell.Fail DirStackEmpty
|
196
|
+
end
|
197
|
+
end
|
198
|
+
alias popd popdir
|
199
|
+
|
200
|
+
|
201
|
+
#
|
202
|
+
# process management
|
203
|
+
#
|
204
|
+
def jobs
|
205
|
+
@process_controller.jobs
|
206
|
+
end
|
207
|
+
|
208
|
+
def kill(sig, command)
|
209
|
+
@process_controller.kill_job(sig, command)
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# command definitions
|
214
|
+
#
|
215
|
+
def Shell.def_system_command(command, path = command)
|
216
|
+
CommandProcessor.def_system_command(command, path)
|
217
|
+
end
|
218
|
+
|
219
|
+
def Shell.undef_system_command(command)
|
220
|
+
CommandProcessor.undef_system_command(command)
|
221
|
+
end
|
222
|
+
|
223
|
+
def Shell.alias_command(ali, command, *opts, &block)
|
224
|
+
CommandProcessor.alias_command(ali, command, *opts, &block)
|
225
|
+
end
|
226
|
+
|
227
|
+
def Shell.unalias_command(ali)
|
228
|
+
CommandProcessor.unalias_command(ali)
|
229
|
+
end
|
230
|
+
|
231
|
+
def Shell.install_system_commands(pre = "sys_")
|
232
|
+
CommandProcessor.install_system_commands(pre)
|
233
|
+
end
|
234
|
+
|
235
|
+
#
|
236
|
+
def inspect
|
237
|
+
if debug.kind_of?(Integer) && debug > 2
|
238
|
+
super
|
239
|
+
else
|
240
|
+
to_s
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def self.notify(*opts, &block)
|
245
|
+
Thread.exclusive do
|
246
|
+
if opts[-1].kind_of?(String)
|
247
|
+
yorn = verbose?
|
248
|
+
else
|
249
|
+
yorn = opts.pop
|
250
|
+
end
|
251
|
+
return unless yorn
|
252
|
+
|
253
|
+
_head = true
|
254
|
+
print opts.collect{|mes|
|
255
|
+
mes = mes.dup
|
256
|
+
yield mes if iterator?
|
257
|
+
if _head
|
258
|
+
_head = false
|
259
|
+
"shell: " + mes
|
260
|
+
else
|
261
|
+
" " + mes
|
262
|
+
end
|
263
|
+
}.join("\n")+"\n"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
CommandProcessor.initialize
|
268
|
+
CommandProcessor.run_config
|
269
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
#
|
2
|
+
# shell/builtin-command.rb -
|
3
|
+
# $Release Version: 0.6.0 $
|
4
|
+
# $Revision: 11708 $
|
5
|
+
# $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $
|
6
|
+
# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
|
7
|
+
#
|
8
|
+
# --
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
|
13
|
+
require "shell/filter"
|
14
|
+
|
15
|
+
class Shell
|
16
|
+
class BuiltInCommand<Filter
|
17
|
+
def wait?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
def active?
|
21
|
+
true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Echo < BuiltInCommand
|
26
|
+
def initialize(sh, *strings)
|
27
|
+
super sh
|
28
|
+
@strings = strings
|
29
|
+
end
|
30
|
+
|
31
|
+
def each(rs = nil)
|
32
|
+
rs = @shell.record_separator unless rs
|
33
|
+
for str in @strings
|
34
|
+
yield str + rs
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Cat < BuiltInCommand
|
40
|
+
def initialize(sh, *filenames)
|
41
|
+
super sh
|
42
|
+
@cat_files = filenames
|
43
|
+
end
|
44
|
+
|
45
|
+
def each(rs = nil)
|
46
|
+
if @cat_files.empty?
|
47
|
+
super
|
48
|
+
else
|
49
|
+
for src in @cat_files
|
50
|
+
@shell.foreach(src, rs){|l| yield l}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Glob < BuiltInCommand
|
57
|
+
def initialize(sh, pattern)
|
58
|
+
super sh
|
59
|
+
|
60
|
+
@pattern = pattern
|
61
|
+
Thread.critical = true
|
62
|
+
back = Dir.pwd
|
63
|
+
begin
|
64
|
+
Dir.chdir @shell.cwd
|
65
|
+
@files = Dir[pattern]
|
66
|
+
ensure
|
67
|
+
Dir.chdir back
|
68
|
+
Thread.critical = false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def each(rs = nil)
|
73
|
+
rs = @shell.record_separator unless rs
|
74
|
+
for f in @files
|
75
|
+
yield f+rs
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# class Sort < Cat
|
81
|
+
# def initialize(sh, *filenames)
|
82
|
+
# super
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# def each(rs = nil)
|
86
|
+
# ary = []
|
87
|
+
# super{|l| ary.push l}
|
88
|
+
# for l in ary.sort!
|
89
|
+
# yield l
|
90
|
+
# end
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
|
94
|
+
class AppendIO < BuiltInCommand
|
95
|
+
def initialize(sh, io, filter)
|
96
|
+
super sh
|
97
|
+
@input = filter
|
98
|
+
@io = io
|
99
|
+
end
|
100
|
+
|
101
|
+
def input=(filter)
|
102
|
+
@input.input=filter
|
103
|
+
for l in @input
|
104
|
+
@io << l
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
class AppendFile < AppendIO
|
111
|
+
def initialize(sh, to_filename, filter)
|
112
|
+
@file_name = to_filename
|
113
|
+
io = sh.open(to_filename, "a")
|
114
|
+
super(sh, io, filter)
|
115
|
+
end
|
116
|
+
|
117
|
+
def input=(filter)
|
118
|
+
begin
|
119
|
+
super
|
120
|
+
ensure
|
121
|
+
@io.close
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class Tee < BuiltInCommand
|
127
|
+
def initialize(sh, filename)
|
128
|
+
super sh
|
129
|
+
@to_filename = filename
|
130
|
+
end
|
131
|
+
|
132
|
+
def each(rs = nil)
|
133
|
+
to = @shell.open(@to_filename, "w")
|
134
|
+
begin
|
135
|
+
super{|l| to << l; yield l}
|
136
|
+
ensure
|
137
|
+
to.close
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class Concat < BuiltInCommand
|
143
|
+
def initialize(sh, *jobs)
|
144
|
+
super(sh)
|
145
|
+
@jobs = jobs
|
146
|
+
end
|
147
|
+
|
148
|
+
def each(rs = nil)
|
149
|
+
while job = @jobs.shift
|
150
|
+
job.each{|l| yield l}
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,592 @@
|
|
1
|
+
#
|
2
|
+
# shell/command-controller.rb -
|
3
|
+
# $Release Version: 0.6.0 $
|
4
|
+
# $Revision: 11708 $
|
5
|
+
# $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $
|
6
|
+
# by Keiju ISHITSUKA(Nippon Rational Inc.)
|
7
|
+
#
|
8
|
+
# --
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
|
13
|
+
require "e2mmap"
|
14
|
+
require "ftools"
|
15
|
+
require "thread"
|
16
|
+
|
17
|
+
require "shell/error"
|
18
|
+
require "shell/filter"
|
19
|
+
require "shell/system-command"
|
20
|
+
require "shell/builtin-command"
|
21
|
+
|
22
|
+
class Shell
|
23
|
+
class CommandProcessor
|
24
|
+
# include Error
|
25
|
+
|
26
|
+
#
|
27
|
+
# initialize of Shell and related classes.
|
28
|
+
#
|
29
|
+
NoDelegateMethods = ["initialize", "expand_path"]
|
30
|
+
def self.initialize
|
31
|
+
|
32
|
+
install_builtin_commands
|
33
|
+
|
34
|
+
# define CommandProccessor#methods to Shell#methods and Filter#methods
|
35
|
+
for m in CommandProcessor.instance_methods(false) - NoDelegateMethods
|
36
|
+
add_delegate_command_to_shell(m)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.method_added(id)
|
40
|
+
add_delegate_command_to_shell(id)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# include run file.
|
46
|
+
#
|
47
|
+
def self.run_config
|
48
|
+
begin
|
49
|
+
load File.expand_path("~/.rb_shell") if ENV.key?("HOME")
|
50
|
+
rescue LoadError, Errno::ENOENT
|
51
|
+
rescue
|
52
|
+
print "load error: #{rc}\n"
|
53
|
+
print $!.class, ": ", $!, "\n"
|
54
|
+
for err in $@[0, $@.size - 2]
|
55
|
+
print "\t", err, "\n"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def initialize(shell)
|
61
|
+
@shell = shell
|
62
|
+
@system_commands = {}
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# CommandProcessor#expand_path(path)
|
67
|
+
# path: String
|
68
|
+
# return: String
|
69
|
+
# returns the absolute path for <path>
|
70
|
+
#
|
71
|
+
def expand_path(path)
|
72
|
+
@shell.expand_path(path)
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# File related commands
|
77
|
+
# Shell#foreach
|
78
|
+
# Shell#open
|
79
|
+
# Shell#unlink
|
80
|
+
# Shell#test
|
81
|
+
#
|
82
|
+
# -
|
83
|
+
#
|
84
|
+
# CommandProcessor#foreach(path, rs)
|
85
|
+
# path: String
|
86
|
+
# rs: String - record separator
|
87
|
+
# iterator
|
88
|
+
# Same as:
|
89
|
+
# File#foreach (when path is file)
|
90
|
+
# Dir#foreach (when path is directory)
|
91
|
+
# path is relative to pwd
|
92
|
+
#
|
93
|
+
def foreach(path = nil, *rs)
|
94
|
+
path = "." unless path
|
95
|
+
path = expand_path(path)
|
96
|
+
|
97
|
+
if File.directory?(path)
|
98
|
+
Dir.foreach(path){|fn| yield fn}
|
99
|
+
else
|
100
|
+
IO.foreach(path, *rs){|l| yield l}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# CommandProcessor#open(path, mode)
|
106
|
+
# path: String
|
107
|
+
# mode: String
|
108
|
+
# return: File or Dir
|
109
|
+
# Same as:
|
110
|
+
# File#open (when path is file)
|
111
|
+
# Dir#open (when path is directory)
|
112
|
+
# mode has an effect only when path is a file
|
113
|
+
#
|
114
|
+
def open(path, mode)
|
115
|
+
path = expand_path(path)
|
116
|
+
if File.directory?(path)
|
117
|
+
Dir.open(path)
|
118
|
+
else
|
119
|
+
effect_umask do
|
120
|
+
File.open(path, mode)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
# public :open
|
125
|
+
|
126
|
+
#
|
127
|
+
# CommandProcessor#unlink(path)
|
128
|
+
# same as:
|
129
|
+
# Dir#unlink (when path is directory)
|
130
|
+
# File#unlink (when path is file)
|
131
|
+
#
|
132
|
+
def unlink(path)
|
133
|
+
path = expand_path(path)
|
134
|
+
if File.directory?(path)
|
135
|
+
Dir.unlink(path)
|
136
|
+
else
|
137
|
+
IO.unlink(path)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
142
|
+
# CommandProcessor#test(command, file1, file2)
|
143
|
+
# CommandProcessor#[command, file1, file2]
|
144
|
+
# command: char or String or Symbol
|
145
|
+
# file1: String
|
146
|
+
# file2: String(optional)
|
147
|
+
# return: Boolean
|
148
|
+
# same as:
|
149
|
+
# test() (when command is char or length 1 string or symbol)
|
150
|
+
# FileTest.command (others)
|
151
|
+
# example:
|
152
|
+
# sh[?e, "foo"]
|
153
|
+
# sh[:e, "foo"]
|
154
|
+
# sh["e", "foo"]
|
155
|
+
# sh[:exists?, "foo"]
|
156
|
+
# sh["exists?", "foo"]
|
157
|
+
#
|
158
|
+
def test(command, file1, file2=nil)
|
159
|
+
file1 = expand_path(file1)
|
160
|
+
file2 = expand_path(file2) if file2
|
161
|
+
command = command.id2name if command.kind_of?(Symbol)
|
162
|
+
|
163
|
+
case command
|
164
|
+
when Integer
|
165
|
+
top_level_test(command, file1, file2)
|
166
|
+
when String
|
167
|
+
if command.size == 1
|
168
|
+
if file2
|
169
|
+
top_level_test(command, file1, file2)
|
170
|
+
else
|
171
|
+
top_level_test(command, file1)
|
172
|
+
end
|
173
|
+
else
|
174
|
+
if file2
|
175
|
+
FileTest.send(command, file1, file2)
|
176
|
+
else
|
177
|
+
FileTest.send(command, file1)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
alias [] test
|
183
|
+
|
184
|
+
#
|
185
|
+
# Dir related methods
|
186
|
+
#
|
187
|
+
# Shell#mkdir
|
188
|
+
# Shell#rmdir
|
189
|
+
#
|
190
|
+
#--
|
191
|
+
#
|
192
|
+
# CommandProcessor#mkdir(*path)
|
193
|
+
# path: String
|
194
|
+
# same as Dir.mkdir()
|
195
|
+
#
|
196
|
+
def mkdir(*path)
|
197
|
+
for dir in path
|
198
|
+
Dir.mkdir(expand_path(dir))
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
#
|
203
|
+
# CommandProcessor#rmdir(*path)
|
204
|
+
# path: String
|
205
|
+
# same as Dir.rmdir()
|
206
|
+
#
|
207
|
+
def rmdir(*path)
|
208
|
+
for dir in path
|
209
|
+
Dir.rmdir(expand_path(dir))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
#
|
214
|
+
# CommandProcessor#system(command, *opts)
|
215
|
+
# command: String
|
216
|
+
# opts: String
|
217
|
+
# return: SystemCommand
|
218
|
+
# Same as system() function
|
219
|
+
# example:
|
220
|
+
# print sh.system("ls", "-l")
|
221
|
+
# sh.system("ls", "-l") | sh.head > STDOUT
|
222
|
+
#
|
223
|
+
def system(command, *opts)
|
224
|
+
if opts.empty?
|
225
|
+
if command =~ /\*|\?|\{|\}|\[|\]|<|>|\(|\)|~|&|\||\\|\$|;|'|`|"|\n/
|
226
|
+
return SystemCommand.new(@shell, find_system_command("sh"), "-c", command)
|
227
|
+
else
|
228
|
+
command, *opts = command.split(/\s+/)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
SystemCommand.new(@shell, find_system_command(command), *opts)
|
232
|
+
end
|
233
|
+
|
234
|
+
#
|
235
|
+
# ProcessCommand#rehash
|
236
|
+
# clear command hash table.
|
237
|
+
#
|
238
|
+
def rehash
|
239
|
+
@system_commands = {}
|
240
|
+
end
|
241
|
+
|
242
|
+
#
|
243
|
+
# ProcessCommand#transact
|
244
|
+
#
|
245
|
+
def check_point
|
246
|
+
@shell.process_controller.wait_all_jobs_execution
|
247
|
+
end
|
248
|
+
alias finish_all_jobs check_point
|
249
|
+
|
250
|
+
def transact(&block)
|
251
|
+
begin
|
252
|
+
@shell.instance_eval(&block)
|
253
|
+
ensure
|
254
|
+
check_point
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
#
|
259
|
+
# internal commands
|
260
|
+
#
|
261
|
+
def out(dev = STDOUT, &block)
|
262
|
+
dev.print transact(&block)
|
263
|
+
end
|
264
|
+
|
265
|
+
def echo(*strings)
|
266
|
+
Echo.new(@shell, *strings)
|
267
|
+
end
|
268
|
+
|
269
|
+
def cat(*filenames)
|
270
|
+
Cat.new(@shell, *filenames)
|
271
|
+
end
|
272
|
+
|
273
|
+
# def sort(*filenames)
|
274
|
+
# Sort.new(self, *filenames)
|
275
|
+
# end
|
276
|
+
|
277
|
+
def glob(pattern)
|
278
|
+
Glob.new(@shell, pattern)
|
279
|
+
end
|
280
|
+
|
281
|
+
def append(to, filter)
|
282
|
+
case to
|
283
|
+
when String
|
284
|
+
AppendFile.new(@shell, to, filter)
|
285
|
+
when IO
|
286
|
+
AppendIO.new(@shell, to, filter)
|
287
|
+
else
|
288
|
+
Shell.Fail Error::CantApplyMethod, "append", to.class
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
def tee(file)
|
293
|
+
Tee.new(@shell, file)
|
294
|
+
end
|
295
|
+
|
296
|
+
def concat(*jobs)
|
297
|
+
Concat.new(@shell, *jobs)
|
298
|
+
end
|
299
|
+
|
300
|
+
# %pwd, %cwd -> @pwd
|
301
|
+
def notify(*opts, &block)
|
302
|
+
Thread.exclusive do
|
303
|
+
Shell.notify(*opts) {|mes|
|
304
|
+
yield mes if iterator?
|
305
|
+
|
306
|
+
mes.gsub!("%pwd", "#{@cwd}")
|
307
|
+
mes.gsub!("%cwd", "#{@cwd}")
|
308
|
+
}
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
#
|
313
|
+
# private functions
|
314
|
+
#
|
315
|
+
def effect_umask
|
316
|
+
if @shell.umask
|
317
|
+
Thread.critical = true
|
318
|
+
save = File.umask
|
319
|
+
begin
|
320
|
+
yield
|
321
|
+
ensure
|
322
|
+
File.umask save
|
323
|
+
Thread.critical = false
|
324
|
+
end
|
325
|
+
else
|
326
|
+
yield
|
327
|
+
end
|
328
|
+
end
|
329
|
+
private :effect_umask
|
330
|
+
|
331
|
+
def find_system_command(command)
|
332
|
+
return command if /^\// =~ command
|
333
|
+
case path = @system_commands[command]
|
334
|
+
when String
|
335
|
+
if exists?(path)
|
336
|
+
return path
|
337
|
+
else
|
338
|
+
Shell.Fail Error::CommandNotFound, command
|
339
|
+
end
|
340
|
+
when false
|
341
|
+
Shell.Fail Error::CommandNotFound, command
|
342
|
+
end
|
343
|
+
|
344
|
+
for p in @shell.system_path
|
345
|
+
path = join(p, command)
|
346
|
+
if FileTest.exists?(path)
|
347
|
+
@system_commands[command] = path
|
348
|
+
return path
|
349
|
+
end
|
350
|
+
end
|
351
|
+
@system_commands[command] = false
|
352
|
+
Shell.Fail Error::CommandNotFound, command
|
353
|
+
end
|
354
|
+
|
355
|
+
#
|
356
|
+
# CommandProcessor.def_system_command(command, path)
|
357
|
+
# command: String
|
358
|
+
# path: String
|
359
|
+
# define 'command()' method as method.
|
360
|
+
#
|
361
|
+
def self.def_system_command(command, path = command)
|
362
|
+
begin
|
363
|
+
eval((d = %Q[def #{command}(*opts)
|
364
|
+
SystemCommand.new(@shell, '#{path}', *opts)
|
365
|
+
end]), nil, __FILE__, __LINE__ - 1)
|
366
|
+
rescue SyntaxError
|
367
|
+
Shell.notify "warn: Can't define #{command} path: #{path}."
|
368
|
+
end
|
369
|
+
Shell.notify "Define #{command} path: #{path}.", Shell.debug?
|
370
|
+
Shell.notify("Definition of #{command}: ", d,
|
371
|
+
Shell.debug.kind_of?(Integer) && Shell.debug > 1)
|
372
|
+
end
|
373
|
+
|
374
|
+
def self.undef_system_command(command)
|
375
|
+
command = command.id2name if command.kind_of?(Symbol)
|
376
|
+
remove_method(command)
|
377
|
+
Shell.module_eval{remove_method(command)}
|
378
|
+
Filter.module_eval{remove_method(command)}
|
379
|
+
self
|
380
|
+
end
|
381
|
+
|
382
|
+
# define command alias
|
383
|
+
# ex)
|
384
|
+
# def_alias_command("ls_c", "ls", "-C", "-F")
|
385
|
+
# def_alias_command("ls_c", "ls"){|*opts| ["-C", "-F", *opts]}
|
386
|
+
#
|
387
|
+
@alias_map = {}
|
388
|
+
def self.alias_map
|
389
|
+
@alias_map
|
390
|
+
end
|
391
|
+
def self.alias_command(ali, command, *opts, &block)
|
392
|
+
ali = ali.id2name if ali.kind_of?(Symbol)
|
393
|
+
command = command.id2name if command.kind_of?(Symbol)
|
394
|
+
begin
|
395
|
+
if iterator?
|
396
|
+
@alias_map[ali.intern] = proc
|
397
|
+
|
398
|
+
eval((d = %Q[def #{ali}(*opts)
|
399
|
+
@shell.__send__(:#{command},
|
400
|
+
*(CommandProcessor.alias_map[:#{ali}].call *opts))
|
401
|
+
end]), nil, __FILE__, __LINE__ - 1)
|
402
|
+
|
403
|
+
else
|
404
|
+
args = opts.collect{|opt| '"' + opt + '"'}.join(",")
|
405
|
+
eval((d = %Q[def #{ali}(*opts)
|
406
|
+
@shell.__send__(:#{command}, #{args}, *opts)
|
407
|
+
end]), nil, __FILE__, __LINE__ - 1)
|
408
|
+
end
|
409
|
+
rescue SyntaxError
|
410
|
+
Shell.notify "warn: Can't alias #{ali} command: #{command}."
|
411
|
+
Shell.notify("Definition of #{ali}: ", d)
|
412
|
+
raise
|
413
|
+
end
|
414
|
+
Shell.notify "Define #{ali} command: #{command}.", Shell.debug?
|
415
|
+
Shell.notify("Definition of #{ali}: ", d,
|
416
|
+
Shell.debug.kind_of?(Integer) && Shell.debug > 1)
|
417
|
+
self
|
418
|
+
end
|
419
|
+
|
420
|
+
def self.unalias_command(ali)
|
421
|
+
ali = ali.id2name if ali.kind_of?(Symbol)
|
422
|
+
@alias_map.delete ali.intern
|
423
|
+
undef_system_command(ali)
|
424
|
+
end
|
425
|
+
|
426
|
+
#
|
427
|
+
# CommandProcessor.def_builtin_commands(delegation_class, command_specs)
|
428
|
+
# delegation_class: Class or Module
|
429
|
+
# command_specs: [[command_name, [argument,...]],...]
|
430
|
+
# command_name: String
|
431
|
+
# arguments: String
|
432
|
+
# FILENAME?? -> expand_path(filename??)
|
433
|
+
# *FILENAME?? -> filename??.collect{|f|expand_path(f)}.join(", ")
|
434
|
+
# define command_name(argument,...) as
|
435
|
+
# delegation_class.command_name(argument,...)
|
436
|
+
#
|
437
|
+
def self.def_builtin_commands(delegation_class, command_specs)
|
438
|
+
for meth, args in command_specs
|
439
|
+
arg_str = args.collect{|arg| arg.downcase}.join(", ")
|
440
|
+
call_arg_str = args.collect{
|
441
|
+
|arg|
|
442
|
+
case arg
|
443
|
+
when /^(FILENAME.*)$/
|
444
|
+
format("expand_path(%s)", $1.downcase)
|
445
|
+
when /^(\*FILENAME.*)$/
|
446
|
+
# \*FILENAME* -> filenames.collect{|fn| expand_path(fn)}.join(", ")
|
447
|
+
$1.downcase + '.collect{|fn| expand_path(fn)}'
|
448
|
+
else
|
449
|
+
arg
|
450
|
+
end
|
451
|
+
}.join(", ")
|
452
|
+
d = %Q[def #{meth}(#{arg_str})
|
453
|
+
#{delegation_class}.#{meth}(#{call_arg_str})
|
454
|
+
end]
|
455
|
+
Shell.notify "Define #{meth}(#{arg_str})", Shell.debug?
|
456
|
+
Shell.notify("Definition of #{meth}: ", d,
|
457
|
+
Shell.debug.kind_of?(Integer) && Shell.debug > 1)
|
458
|
+
eval d
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
#
|
463
|
+
# CommandProcessor.install_system_commands(pre)
|
464
|
+
# pre: String - command name prefix
|
465
|
+
# defines every command which belongs in default_system_path via
|
466
|
+
# CommandProcessor.command(). It doesn't define already defined
|
467
|
+
# methods twice. By default, "pre_" is prefixes to each method
|
468
|
+
# name. Characters that may not be used in a method name are
|
469
|
+
# all converted to '_'. Definition errors are just ignored.
|
470
|
+
#
|
471
|
+
def self.install_system_commands(pre = "sys_")
|
472
|
+
defined_meth = {}
|
473
|
+
for m in Shell.methods
|
474
|
+
defined_meth[m] = true
|
475
|
+
end
|
476
|
+
sh = Shell.new
|
477
|
+
for path in Shell.default_system_path
|
478
|
+
next unless sh.directory? path
|
479
|
+
sh.cd path
|
480
|
+
sh.foreach do
|
481
|
+
|cn|
|
482
|
+
if !defined_meth[pre + cn] && sh.file?(cn) && sh.executable?(cn)
|
483
|
+
command = (pre + cn).gsub(/\W/, "_").sub(/^([0-9])/, '_\1')
|
484
|
+
begin
|
485
|
+
def_system_command(command, sh.expand_path(cn))
|
486
|
+
rescue
|
487
|
+
Shell.notify "warn: Can't define #{command} path: #{cn}"
|
488
|
+
end
|
489
|
+
defined_meth[command] = command
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
#----------------------------------------------------------------------
|
496
|
+
#
|
497
|
+
# class initializing methods -
|
498
|
+
#
|
499
|
+
#----------------------------------------------------------------------
|
500
|
+
def self.add_delegate_command_to_shell(id)
|
501
|
+
id = id.intern if id.kind_of?(String)
|
502
|
+
name = id.id2name
|
503
|
+
if Shell.method_defined?(id)
|
504
|
+
Shell.notify "warn: override definnition of Shell##{name}."
|
505
|
+
Shell.notify "warn: alias Shell##{name} to Shell##{name}_org.\n"
|
506
|
+
Shell.module_eval "alias #{name}_org #{name}"
|
507
|
+
end
|
508
|
+
Shell.notify "method added: Shell##{name}.", Shell.debug?
|
509
|
+
Shell.module_eval(%Q[def #{name}(*args, &block)
|
510
|
+
begin
|
511
|
+
@command_processor.__send__(:#{name}, *args, &block)
|
512
|
+
rescue Exception
|
513
|
+
$@.delete_if{|s| /:in `__getobj__'$/ =~ s} #`
|
514
|
+
$@.delete_if{|s| /^\\(eval\\):/ =~ s}
|
515
|
+
raise
|
516
|
+
end
|
517
|
+
end], __FILE__, __LINE__)
|
518
|
+
|
519
|
+
if Shell::Filter.method_defined?(id)
|
520
|
+
Shell.notify "warn: override definnition of Shell::Filter##{name}."
|
521
|
+
Shell.notify "warn: alias Shell##{name} to Shell::Filter##{name}_org."
|
522
|
+
Filter.module_eval "alias #{name}_org #{name}"
|
523
|
+
end
|
524
|
+
Shell.notify "method added: Shell::Filter##{name}.", Shell.debug?
|
525
|
+
Filter.module_eval(%Q[def #{name}(*args, &block)
|
526
|
+
begin
|
527
|
+
self | @shell.__send__(:#{name}, *args, &block)
|
528
|
+
rescue Exception
|
529
|
+
$@.delete_if{|s| /:in `__getobj__'$/ =~ s} #`
|
530
|
+
$@.delete_if{|s| /^\\(eval\\):/ =~ s}
|
531
|
+
raise
|
532
|
+
end
|
533
|
+
end], __FILE__, __LINE__)
|
534
|
+
end
|
535
|
+
|
536
|
+
#
|
537
|
+
# define default builtin commands
|
538
|
+
#
|
539
|
+
def self.install_builtin_commands
|
540
|
+
# method related File.
|
541
|
+
# (exclude open/foreach/unlink)
|
542
|
+
normal_delegation_file_methods = [
|
543
|
+
["atime", ["FILENAME"]],
|
544
|
+
["basename", ["fn", "*opts"]],
|
545
|
+
["chmod", ["mode", "*FILENAMES"]],
|
546
|
+
["chown", ["owner", "group", "*FILENAME"]],
|
547
|
+
["ctime", ["FILENAMES"]],
|
548
|
+
["delete", ["*FILENAMES"]],
|
549
|
+
["dirname", ["FILENAME"]],
|
550
|
+
["ftype", ["FILENAME"]],
|
551
|
+
["join", ["*items"]],
|
552
|
+
["link", ["FILENAME_O", "FILENAME_N"]],
|
553
|
+
["lstat", ["FILENAME"]],
|
554
|
+
["mtime", ["FILENAME"]],
|
555
|
+
["readlink", ["FILENAME"]],
|
556
|
+
["rename", ["FILENAME_FROM", "FILENAME_TO"]],
|
557
|
+
# ["size", ["FILENAME"]],
|
558
|
+
["split", ["pathname"]],
|
559
|
+
["stat", ["FILENAME"]],
|
560
|
+
["symlink", ["FILENAME_O", "FILENAME_N"]],
|
561
|
+
["truncate", ["FILENAME", "length"]],
|
562
|
+
["utime", ["atime", "mtime", "*FILENAMES"]]]
|
563
|
+
|
564
|
+
def_builtin_commands(File, normal_delegation_file_methods)
|
565
|
+
alias_method :rm, :delete
|
566
|
+
|
567
|
+
# method related FileTest
|
568
|
+
def_builtin_commands(FileTest,
|
569
|
+
FileTest.singleton_methods(false).collect{|m| [m, ["FILENAME"]]})
|
570
|
+
|
571
|
+
# method related ftools
|
572
|
+
normal_delegation_ftools_methods = [
|
573
|
+
["syscopy", ["FILENAME_FROM", "FILENAME_TO"]],
|
574
|
+
["copy", ["FILENAME_FROM", "FILENAME_TO"]],
|
575
|
+
["move", ["FILENAME_FROM", "FILENAME_TO"]],
|
576
|
+
["compare", ["FILENAME_FROM", "FILENAME_TO"]],
|
577
|
+
["safe_unlink", ["*FILENAMES"]],
|
578
|
+
["makedirs", ["*FILENAMES"]],
|
579
|
+
# ["chmod", ["mode", "*FILENAMES"]],
|
580
|
+
["install", ["FILENAME_FROM", "FILENAME_TO", "mode"]],
|
581
|
+
]
|
582
|
+
def_builtin_commands(File,
|
583
|
+
normal_delegation_ftools_methods)
|
584
|
+
alias_method :cmp, :compare
|
585
|
+
alias_method :mv, :move
|
586
|
+
alias_method :cp, :copy
|
587
|
+
alias_method :rm_f, :safe_unlink
|
588
|
+
alias_method :mkpath, :makedirs
|
589
|
+
end
|
590
|
+
|
591
|
+
end
|
592
|
+
end
|