carats 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +2 -0
- data/LICENSE +5 -0
- data/README +67 -0
- data/Reapfile +72 -0
- data/ToDo +24 -0
- data/bench/b_harray.rb +49 -0
- data/bench/b_range.rb +64 -0
- data/demo/ansicolor/cdiff.rb +20 -0
- data/demo/ansicolor/example.rb +82 -0
- data/demo/io-reactor/chatserver.rb +347 -0
- data/doc/classes/Array.html +172 -0
- data/doc/classes/BBCode.html +638 -0
- data/doc/classes/BinaryReader.html +675 -0
- data/doc/classes/Binding.html +223 -0
- data/doc/classes/ByteOrder.html +284 -0
- data/doc/classes/Class.html +189 -0
- data/doc/classes/Constant.html +785 -0
- data/doc/classes/Constant/CGS.html +609 -0
- data/doc/classes/Continuation.html +113 -0
- data/doc/classes/Coroutine.html +387 -0
- data/doc/classes/CountingSemaphore.html +337 -0
- data/doc/classes/CrossCase.html +561 -0
- data/doc/classes/DynamicMixin.html +185 -0
- data/doc/classes/EnumerableWithArgs.html +550 -0
- data/doc/classes/Expect.html +428 -0
- data/doc/classes/Expect/DefaultChain.html +113 -0
- data/doc/classes/Expect/SeparatedPattern.html +223 -0
- data/doc/classes/Expect/Timeout.html +167 -0
- data/doc/classes/Expect/UnmatchedMessage.html +160 -0
- data/doc/classes/FileList.html +833 -0
- data/doc/classes/FloatString.html +534 -0
- data/doc/classes/Functor.html +211 -0
- data/doc/classes/HArray.html +1872 -0
- data/doc/classes/HTML.html +328 -0
- data/doc/classes/Heap.html +683 -0
- data/doc/classes/Heap/EmptyHeapException.html +111 -0
- data/doc/classes/Heap/Max.html +176 -0
- data/doc/classes/Heap/Min.html +176 -0
- data/doc/classes/IO.html +108 -0
- data/doc/classes/IO/Reactor.html +790 -0
- data/doc/classes/IO/Redirect.html +289 -0
- data/doc/classes/Infinity.html +320 -0
- data/doc/classes/Interval.html +1014 -0
- data/doc/classes/InvalidNackError.html +161 -0
- data/doc/classes/Kernel.html +204 -0
- data/doc/classes/Lisp.html +1132 -0
- data/doc/classes/Lisp/DottedPair.html +379 -0
- data/doc/classes/Lisp/Format.html +178 -0
- data/doc/classes/Lisp/Format/ArgumentError.html +126 -0
- data/doc/classes/Lisp/Format/Directives.html +155 -0
- data/doc/classes/Lisp/Format/Directives/ArgJump.html +178 -0
- data/doc/classes/Lisp/Format/Directives/Ascii.html +119 -0
- data/doc/classes/Lisp/Format/Directives/BeginCaseConversion.html +185 -0
- data/doc/classes/Lisp/Format/Directives/BeginConditional.html +307 -0
- data/doc/classes/Lisp/Format/Directives/BeginIteration.html +338 -0
- data/doc/classes/Lisp/Format/Directives/Binary.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Character.html +228 -0
- data/doc/classes/Lisp/Format/Directives/CharacterDirective.html +203 -0
- data/doc/classes/Lisp/Format/Directives/ClauseSeparator.html +166 -0
- data/doc/classes/Lisp/Format/Directives/Decimal.html +119 -0
- data/doc/classes/Lisp/Format/Directives/Directive.html +397 -0
- data/doc/classes/Lisp/Format/Directives/DollarFP.html +205 -0
- data/doc/classes/Lisp/Format/Directives/EndCaseConversion.html +174 -0
- data/doc/classes/Lisp/Format/Directives/EndConditional.html +159 -0
- data/doc/classes/Lisp/Format/Directives/EndIteration.html +163 -0
- data/doc/classes/Lisp/Format/Directives/ExpFP.html +252 -0
- data/doc/classes/Lisp/Format/Directives/FFFP.html +224 -0
- data/doc/classes/Lisp/Format/Directives/Factory.html +180 -0
- data/doc/classes/Lisp/Format/Directives/FreshLine.html +175 -0
- data/doc/classes/Lisp/Format/Directives/GeneralFP.html +265 -0
- data/doc/classes/Lisp/Format/Directives/Hexadecimal.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Indirection.html +183 -0
- data/doc/classes/Lisp/Format/Directives/Literal.html +187 -0
- data/doc/classes/Lisp/Format/Directives/NewLine.html +158 -0
- data/doc/classes/Lisp/Format/Directives/NewPage.html +158 -0
- data/doc/classes/Lisp/Format/Directives/Number.html +243 -0
- data/doc/classes/Lisp/Format/Directives/Octal.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Plural.html +177 -0
- data/doc/classes/Lisp/Format/Directives/Print.html +237 -0
- data/doc/classes/Lisp/Format/Directives/Radix.html +432 -0
- data/doc/classes/Lisp/Format/Directives/SExpression.html +157 -0
- data/doc/classes/Lisp/Format/Directives/SkipWhitespace.html +165 -0
- data/doc/classes/Lisp/Format/Directives/Tabulate.html +198 -0
- data/doc/classes/Lisp/Format/Directives/Tilde.html +158 -0
- data/doc/classes/Lisp/Format/Directives/UnknownDirectiveError.html +117 -0
- data/doc/classes/Lisp/Format/Formatter.html +193 -0
- data/doc/classes/Lisp/Format/IncompleteParameterError.html +119 -0
- data/doc/classes/Lisp/Format/IndexError.html +126 -0
- data/doc/classes/Lisp/Format/Lexer.html +479 -0
- data/doc/classes/Lisp/Format/MalformedError.html +119 -0
- data/doc/classes/Lisp/Format/MissingParameterError.html +119 -0
- data/doc/classes/Lisp/Format/ModifierError.html +119 -0
- data/doc/classes/Lisp/Format/Output.html +239 -0
- data/doc/classes/Lisp/Format/ParameterError.html +126 -0
- data/doc/classes/Lisp/Format/Parameters.html +123 -0
- data/doc/classes/Lisp/Format/Parameters/Argument.html +172 -0
- data/doc/classes/Lisp/Format/Parameters/ArgumentCount.html +159 -0
- data/doc/classes/Lisp/Format/Parameters/Character.html +119 -0
- data/doc/classes/Lisp/Format/Parameters/Default.html +120 -0
- data/doc/classes/Lisp/Format/Parameters/Integer.html +119 -0
- data/doc/classes/Lisp/Format/Parameters/Parameter.html +206 -0
- data/doc/classes/Lisp/Format/Parser.html +212 -0
- data/doc/classes/Lisp/Format/Positioned.html +166 -0
- data/doc/classes/Lisp/Format/State.html +455 -0
- data/doc/classes/Lisp/Format/SyntaxError.html +126 -0
- data/doc/classes/Method.html +274 -0
- data/doc/classes/Method/DuckHunter.html +281 -0
- data/doc/classes/Module.html +709 -0
- data/doc/classes/Multiton.html +284 -0
- data/doc/classes/Multiton/New.html +164 -0
- data/doc/classes/Multiton/Semi.html +155 -0
- data/doc/classes/NackClass.html +322 -0
- data/doc/classes/NilClass.html +231 -0
- data/doc/classes/NilComparable.html +179 -0
- data/doc/classes/NotCopyable.html +273 -0
- data/doc/classes/Object.html +261 -0
- data/doc/classes/OpenStructable.html +346 -0
- data/doc/classes/OrderedHash.html +939 -0
- data/doc/classes/Parser.html +515 -0
- data/doc/classes/Parser/Main.html +178 -0
- data/doc/classes/Parser/Marker.html +475 -0
- data/doc/classes/Parser/Registry.html +354 -0
- data/doc/classes/Parser/Token.html +399 -0
- data/doc/classes/Parser/UnitToken.html +222 -0
- data/doc/classes/Ref.html +230 -0
- data/doc/classes/SimpleStringIO.html +183 -0
- data/doc/classes/StaticHash.html +202 -0
- data/doc/classes/String.html +172 -0
- data/doc/classes/Struct.html +181 -0
- data/doc/classes/SuperStruct.html +382 -0
- data/doc/classes/Term.html +156 -0
- data/doc/classes/Term/ANSIColor.html +185 -0
- data/doc/classes/Text.html +138 -0
- data/doc/classes/Text/Soundex.html +222 -0
- data/doc/classes/TextTagIterator.html +911 -0
- data/doc/classes/Time.html +119 -0
- data/doc/classes/Time/Limit.html +303 -0
- data/doc/classes/Time/Limit/Dummy.html +181 -0
- data/doc/classes/Timer.html +351 -0
- data/doc/classes/TracePoint.html +532 -0
- data/doc/classes/Tuple.html +178 -0
- data/doc/classes/Uninheritable.html +213 -0
- data/doc/classes/Version.html +783 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +113 -0
- data/doc/files/README.html +201 -0
- data/doc/files/lib/carat/1st_rb.html +107 -0
- data/doc/files/lib/carat/ansicolor_rb.html +146 -0
- data/doc/files/lib/carat/attr_rb.html +101 -0
- data/doc/files/lib/carat/bbcode_rb.html +152 -0
- data/doc/files/lib/carat/binaryreader_rb.html +114 -0
- data/doc/files/lib/carat/binding-of-caller_rb.html +108 -0
- data/doc/files/lib/carat/byteorder_rb.html +107 -0
- data/doc/files/lib/carat/constant_rb.html +167 -0
- data/doc/files/lib/carat/coroutine_rb.html +156 -0
- data/doc/files/lib/carat/crosscase_rb.html +224 -0
- data/doc/files/lib/carat/duckhunter_rb.html +165 -0
- data/doc/files/lib/carat/dynamic-mixin_rb.html +101 -0
- data/doc/files/lib/carat/enumerable-args_rb.html +140 -0
- data/doc/files/lib/carat/expect_rb.html +137 -0
- data/doc/files/lib/carat/filelist_rb.html +130 -0
- data/doc/files/lib/carat/floatstring_rb.html +126 -0
- data/doc/files/lib/carat/functor_rb.html +140 -0
- data/doc/files/lib/carat/harray_rb.html +128 -0
- data/doc/files/lib/carat/heap_rb.html +154 -0
- data/doc/files/lib/carat/html-helpers_rb.html +116 -0
- data/doc/files/lib/carat/infinity_rb.html +142 -0
- data/doc/files/lib/carat/init_rb.html +127 -0
- data/doc/files/lib/carat/interval_rb.html +162 -0
- data/doc/files/lib/carat/io-reactor_rb.html +211 -0
- data/doc/files/lib/carat/io-redirect_rb.html +132 -0
- data/doc/files/lib/carat/lisp-format_rb.html +187 -0
- data/doc/files/lib/carat/lisp_rb.html +152 -0
- data/doc/files/lib/carat/macro_rb.html +129 -0
- data/doc/files/lib/carat/multiton_rb.html +178 -0
- data/doc/files/lib/carat/nack_rb.html +193 -0
- data/doc/files/lib/carat/nil-comparable_rb.html +126 -0
- data/doc/files/lib/carat/nil-missing_rb.html +101 -0
- data/doc/files/lib/carat/notcopyable_rb.html +166 -0
- data/doc/files/lib/carat/orderedhash_rb.html +107 -0
- data/doc/files/lib/carat/ostructable_rb.html +157 -0
- data/doc/files/lib/carat/parser-old_rb.html +239 -0
- data/doc/files/lib/carat/parser_rb.html +244 -0
- data/doc/files/lib/carat/ref_rb.html +107 -0
- data/doc/files/lib/carat/semaphore_rb.html +132 -0
- data/doc/files/lib/carat/snapshot_rb.html +152 -0
- data/doc/files/lib/carat/soundex_rb.html +128 -0
- data/doc/files/lib/carat/sstruct_rb.html +142 -0
- data/doc/files/lib/carat/statichash_rb.html +150 -0
- data/doc/files/lib/carat/tagiter_rb.html +236 -0
- data/doc/files/lib/carat/timelimit_rb.html +136 -0
- data/doc/files/lib/carat/timer_rb.html +153 -0
- data/doc/files/lib/carat/tracepoint_rb.html +160 -0
- data/doc/files/lib/carat/tuple_rb.html +123 -0
- data/doc/files/lib/carat/uninheritable_rb.html +101 -0
- data/doc/files/lib/carat/version_rb.html +141 -0
- data/doc/fr_class_index.html +159 -0
- data/doc/fr_file_index.html +78 -0
- data/doc/fr_method_index.html +663 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/carat-dev/README +11 -0
- data/lib/carat-dev/access-blocks/access_blocks.rb +42 -0
- data/lib/carat-dev/association/association.rb +70 -0
- data/lib/carat-dev/blankslate/blankslate.rb +51 -0
- data/lib/carat-dev/breakpoint.rb +518 -0
- data/lib/carat-dev/class-constructor/constructor_methods.rb +78 -0
- data/lib/carat-dev/class-constructor/tc_constructor.rb +35 -0
- data/lib/carat-dev/closecall/closecall-test.rb +39 -0
- data/lib/carat-dev/closecall/closecall.rb +101 -0
- data/lib/carat-dev/commandrunner/commandrunner.rb +100 -0
- data/lib/carat-dev/conditional/conditionals.rb +106 -0
- data/lib/carat-dev/daemon/daemon.rb +70 -0
- data/lib/carat-dev/detach/detach.rb +363 -0
- data/lib/carat-dev/detach/tc_detach.rb +57 -0
- data/lib/carat-dev/import-module/import-module-0.81.tar.gz +0 -0
- data/lib/carat-dev/import-module/import-module-0.81/LICENSE +1 -0
- data/lib/carat-dev/import-module/import-module-0.81/Makefile +11 -0
- data/lib/carat-dev/import-module/import-module-0.81/README +4 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-hash.rb +49 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-pip.rb +71 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-unbound-method.rb +36 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.html +293 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.rd +306 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README.html +290 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README.rd +303 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/style.css +85 -0
- data/lib/carat-dev/import-module/import-module-0.81/install.rb +99 -0
- data/lib/carat-dev/import-module/import-module-0.81/lib/import-module-single-thread.rb +84 -0
- data/lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb +493 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/Makefile +2 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test +91 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-import-module.rb +936 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-import_scope.rb +33 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-scope_import.rb +33 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-time.rb +184 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test.sh +91 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/time.rb +135 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/times-do.sh +10 -0
- data/lib/carat-dev/interface_work/SCRAP/i-contracts.rb +37 -0
- data/lib/carat-dev/interface_work/SCRAP/interface.rb +105 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0.zip +0 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/CHANGES +3 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/MANIFEST +15 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/README +32 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.rd +73 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.txt +94 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/install.rb +16 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/lib/interface.rb +50 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/tc_interface.rb +51 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test.rb +29 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_instance.rb +24 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_sub.rb +29 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_unrequire.rb +28 -0
- data/lib/carat-dev/interface_work/contracts/contract.zip +0 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.html +376 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000001.html +23 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000002.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000003.html +19 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000004.html +29 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000005.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000006.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractError.html +142 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractException.html +153 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractMismatch.html +125 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.html +157 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.src/M000007.html +112 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/created.rid +1 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/assertions_rb.html +109 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/exception_rb.html +108 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/integration_rb.html +108 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/overrides_rb.html +109 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract_rb.html +114 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_class_index.html +31 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_file_index.html +31 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_method_index.html +33 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/index.html +24 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/rdoc-style.css +208 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract.rb +88 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/assertions.rb +37 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/exception.rb +92 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/integration.rb +132 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/overrides.rb +32 -0
- data/lib/carat-dev/interface_work/must.rb +37 -0
- data/lib/carat-dev/interface_work/type.rb +232 -0
- data/lib/carat-dev/main/tc_toplevel.rb +23 -0
- data/lib/carat-dev/main/toplevel.rb +33 -0
- data/lib/carat-dev/main/toplevel_test.rb +24 -0
- data/lib/carat-dev/misc/1.rb +40 -0
- data/lib/carat-dev/misc/misc.rb +44 -0
- data/lib/carat-dev/misc/sys.rb +186 -0
- data/lib/carat-dev/misc/temp.rb +1 -0
- data/lib/carat-dev/misc/utils.rb +518 -0
- data/lib/carat-dev/predicate/predicate.rb +109 -0
- data/lib/carat-dev/predicate/predicate_test.rb +67 -0
- data/lib/carat-dev/premshree.rb +40 -0
- data/lib/carat-dev/priority-queue/pqueue.rb +183 -0
- data/lib/carat-dev/priority-queue/priorityqueue.rb +84 -0
- data/lib/carat-dev/quaternion/quaternion.rb +529 -0
- data/lib/carat-dev/range.rb +259 -0
- data/lib/carat-dev/system/rubyinfo.rb +75 -0
- data/lib/carat-dev/system/system.rb +105 -0
- data/lib/carat-dev/tc_range.rb +118 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.html +291 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000001.html +26 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000002.html +19 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000003.html +18 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000004.html +18 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000005.html +21 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000006.html +23 -0
- data/lib/carat-dev/timer/timer-doc/created.rid +1 -0
- data/lib/carat-dev/timer/timer-doc/files/timer_rb.html +144 -0
- data/lib/carat-dev/timer/timer-doc/fr_class_index.html +27 -0
- data/lib/carat-dev/timer/timer-doc/fr_file_index.html +27 -0
- data/lib/carat-dev/timer/timer-doc/fr_method_index.html +32 -0
- data/lib/carat-dev/timer/timer-doc/index.html +24 -0
- data/lib/carat-dev/timer/timer-doc/rdoc-style.css +208 -0
- data/lib/carat-dev/timer/timer.rb +160 -0
- data/lib/carat-dev/vars/vars.rb +62 -0
- data/lib/carat/1st.rb +58 -0
- data/lib/carat/ansicolor.rb +122 -0
- data/lib/carat/attr.rb +342 -0
- data/lib/carat/bbcode.rb +352 -0
- data/lib/carat/binaryreader.rb +170 -0
- data/lib/carat/binding-of-caller.rb +83 -0
- data/lib/carat/byteorder.rb +34 -0
- data/lib/carat/constant.rb +287 -0
- data/lib/carat/coroutine.rb +102 -0
- data/lib/carat/crosscase.rb +309 -0
- data/lib/carat/duckhunter.rb +158 -0
- data/lib/carat/dynamic-mixin.rb +71 -0
- data/lib/carat/enumerable-args.rb +125 -0
- data/lib/carat/expect.rb +192 -0
- data/lib/carat/filelist.rb +277 -0
- data/lib/carat/floatstring.rb +153 -0
- data/lib/carat/functor.rb +41 -0
- data/lib/carat/harray.rb +507 -0
- data/lib/carat/heap.rb +193 -0
- data/lib/carat/html-helpers.rb +82 -0
- data/lib/carat/infinity.rb +61 -0
- data/lib/carat/init.rb +33 -0
- data/lib/carat/interval.rb +248 -0
- data/lib/carat/io-reactor.rb +657 -0
- data/lib/carat/io-redirect.rb +99 -0
- data/lib/carat/lisp-format.rb +1832 -0
- data/lib/carat/lisp.rb +336 -0
- data/lib/carat/macro.rb +68 -0
- data/lib/carat/multiton.rb +153 -0
- data/lib/carat/nack.rb +115 -0
- data/lib/carat/nil-comparable.rb +67 -0
- data/lib/carat/nil-missing.rb +12 -0
- data/lib/carat/notcopyable.rb +68 -0
- data/lib/carat/orderedhash.rb +249 -0
- data/lib/carat/ostructable.rb +138 -0
- data/lib/carat/parser-old.rb +350 -0
- data/lib/carat/parser.rb +393 -0
- data/lib/carat/ref.rb +31 -0
- data/lib/carat/semaphore.rb +69 -0
- data/lib/carat/snapshot.rb +94 -0
- data/lib/carat/soundex.rb +104 -0
- data/lib/carat/sstruct.rb +223 -0
- data/lib/carat/statichash.rb +49 -0
- data/lib/carat/tagiter.rb +345 -0
- data/lib/carat/timelimit.rb +114 -0
- data/lib/carat/timer.rb +99 -0
- data/lib/carat/tracepoint.rb +154 -0
- data/lib/carat/tuple.rb +31 -0
- data/lib/carat/uninheritable.rb +68 -0
- data/lib/carat/version.rb +147 -0
- data/pub/doc/sstruct.txt +204 -0
- data/pub/doc/tagiter.html +145 -0
- data/setup.rb +1361 -0
- data/test/fixtures/filelist/testfile.txt +1 -0
- data/test/fixtures/filelist/testfile2.txt +1 -0
- data/test/tc_1st.rb +16 -0
- data/test/tc_ansicolor.rb +23 -0
- data/test/tc_attr.rb +46 -0
- data/test/tc_bbcode.rb +20 -0
- data/test/tc_binaryreader.rb +14 -0
- data/test/tc_binding_of_caller.rb +2 -0
- data/test/tc_byteorder.rb +41 -0
- data/test/tc_constant.rb +12 -0
- data/test/tc_coroutine.rb +50 -0
- data/test/tc_crosscase.rb +33 -0
- data/test/tc_duckhunter.rb +37 -0
- data/test/tc_dynamic-mixin.rb +66 -0
- data/test/tc_enumerable-args.rb +66 -0
- data/test/tc_expect.rb +83 -0
- data/test/tc_filelist.rb +17 -0
- data/test/tc_floatstring.rb +22 -0
- data/test/tc_functor.rb +18 -0
- data/test/tc_harray.rb +280 -0
- data/test/tc_heap.rb +6 -0
- data/test/tc_infinity.rb +23 -0
- data/test/tc_init.rb +29 -0
- data/test/tc_interval.rb +153 -0
- data/test/tc_io-reactor.rb +5 -0
- data/test/tc_io-redirect.rb +5 -0
- data/test/tc_lisp-format.rb +24 -0
- data/test/tc_lisp.rb +32 -0
- data/test/tc_macro.rb +48 -0
- data/test/tc_multiton.rb +188 -0
- data/test/tc_nack.rb +31 -0
- data/test/tc_nil-as-emptiness.rb +19 -0
- data/test/tc_nil-comparable.rb +29 -0
- data/test/tc_nil-missing.rb +0 -0
- data/test/tc_notcopyable.rb +64 -0
- data/test/tc_orderedhash.rb +36 -0
- data/test/tc_ostructable.rb +31 -0
- data/test/tc_semaphore.rb +5 -0
- data/test/tc_snapshot.rb +20 -0
- data/test/tc_soundex.rb +19 -0
- data/test/tc_sstruct.rb +313 -0
- data/test/tc_statichash.rb +24 -0
- data/test/tc_tagiter.rb +80 -0
- data/test/tc_timelimit.rb +47 -0
- data/test/tc_timer.rb +35 -0
- data/test/tc_tracepoint.rb +10 -0
- data/test/tc_tuple.rb +25 -0
- data/test/tc_uninheritable.rb +33 -0
- data/test/tc_version.rb +90 -0
- metadata +531 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Copyright (c) 2003, 2004 Jim Weirich
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
#++
|
|
25
|
+
#
|
|
26
|
+
require 'ftools'
|
|
27
|
+
require 'rbconfig'
|
|
28
|
+
|
|
29
|
+
######################################################################
|
|
30
|
+
# Sys provides a number of file manipulation tools for the convenience
|
|
31
|
+
# of writing Rakefiles. All commands in this module will announce
|
|
32
|
+
# their activity on standard output if the $verbose flag is set
|
|
33
|
+
# ($verbose = true is the default). You can control this by globally
|
|
34
|
+
# setting $verbose or by using the +verbose+ and +quiet+ methods.
|
|
35
|
+
#
|
|
36
|
+
# Sys has been deprecated in favor of the FileUtils module available
|
|
37
|
+
# in Ruby 1.8.
|
|
38
|
+
#
|
|
39
|
+
module Sys
|
|
40
|
+
RUBY = Config::CONFIG['ruby_install_name']
|
|
41
|
+
|
|
42
|
+
# Install all the files matching +wildcard+ into the +dest_dir+
|
|
43
|
+
# directory. The permission mode is set to +mode+.
|
|
44
|
+
def install(wildcard, dest_dir, mode)
|
|
45
|
+
Dir[wildcard].each do |fn|
|
|
46
|
+
File.install(fn, dest_dir, mode, $verbose)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Run the system command +cmd+.
|
|
51
|
+
def run(cmd)
|
|
52
|
+
log cmd
|
|
53
|
+
system(cmd) or fail "Command Failed: [#{cmd}]"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Run a Ruby interpreter with the given arguments.
|
|
57
|
+
def ruby(*args)
|
|
58
|
+
run "#{RUBY} #{args.join(' ')}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Copy a single file from +file_name+ to +dest_file+.
|
|
62
|
+
def copy(file_name, dest_file)
|
|
63
|
+
log "Copying file #{file_name} to #{dest_file}"
|
|
64
|
+
File.copy(file_name, dest_file)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Copy all files matching +wildcard+ into the directory +dest_dir+.
|
|
68
|
+
def copy_files(wildcard, dest_dir)
|
|
69
|
+
for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Link +file_name+ to +dest_file+.
|
|
73
|
+
def link(file_name, dest_file)
|
|
74
|
+
log "Linking file #{file_name} to #{dest_file}"
|
|
75
|
+
File.link(file_name, dest_file)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Link all files matching +wildcard+ into the directory +dest_dir+.
|
|
79
|
+
def link_files(wildcard, dest_dir)
|
|
80
|
+
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Symlink +file_name+ to +dest_file+.
|
|
84
|
+
def symlink(file_name, dest_file)
|
|
85
|
+
log "Symlinking file #{file_name} to #{dest_file}"
|
|
86
|
+
File.symlink(file_name, dest_file)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Symlink all files matching +wildcard+ into the directory +dest_dir+.
|
|
90
|
+
def symlink_files(wildcard, dest_dir)
|
|
91
|
+
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Remove all files matching +wildcard+. If a matching file is a
|
|
95
|
+
# directory, it must be empty to be removed. used +delete_all+ to
|
|
96
|
+
# recursively delete directories.
|
|
97
|
+
def delete(*wildcards)
|
|
98
|
+
wildcards.each do |wildcard|
|
|
99
|
+
Dir[wildcard].each do |fn|
|
|
100
|
+
if File.directory?(fn)
|
|
101
|
+
log "Deleting directory #{fn}"
|
|
102
|
+
Dir.delete(fn)
|
|
103
|
+
else
|
|
104
|
+
log "Deleting file #{fn}"
|
|
105
|
+
File.delete(fn)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Recursively delete all files and directories matching +wildcard+.
|
|
112
|
+
def delete_all(*wildcards)
|
|
113
|
+
wildcards.each do |wildcard|
|
|
114
|
+
Dir[wildcard].each do |fn|
|
|
115
|
+
next if ! File.exist?(fn)
|
|
116
|
+
if File.directory?(fn)
|
|
117
|
+
Dir["#{fn}/*"].each do |subfn|
|
|
118
|
+
next if subfn=='.' || subfn=='..'
|
|
119
|
+
delete_all(subfn)
|
|
120
|
+
end
|
|
121
|
+
log "Deleting directory #{fn}"
|
|
122
|
+
Dir.delete(fn)
|
|
123
|
+
else
|
|
124
|
+
log "Deleting file #{fn}"
|
|
125
|
+
File.delete(fn)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Make the directories given in +dirs+.
|
|
132
|
+
def makedirs(*dirs)
|
|
133
|
+
dirs.each do |fn|
|
|
134
|
+
log "Making directory #{fn}"
|
|
135
|
+
File.makedirs(fn)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Write a message to standard out if $verbose is enabled.
|
|
140
|
+
def log(msg)
|
|
141
|
+
print " " if $trace && $verbose
|
|
142
|
+
puts msg if $verbose
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Perform a block with $verbose disabled.
|
|
146
|
+
def quiet(&block)
|
|
147
|
+
with_verbose(false, &block)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Perform a block with $verbose enabled.
|
|
151
|
+
def verbose(&block)
|
|
152
|
+
with_verbose(true, &block)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Perform a block with each file matching a set of wildcards.
|
|
156
|
+
def for_files(*wildcards)
|
|
157
|
+
wildcards.each do |wildcard|
|
|
158
|
+
Dir[wildcard].each do |fn|
|
|
159
|
+
yield(fn)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
extend(self)
|
|
165
|
+
|
|
166
|
+
private # ----------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
def for_matching_files(wildcard, dest_dir)
|
|
169
|
+
Dir[wildcard].each do |fn|
|
|
170
|
+
dest_file = File.join(dest_dir, fn)
|
|
171
|
+
parent = File.dirname(dest_file)
|
|
172
|
+
makedirs(parent) if ! File.directory?(parent)
|
|
173
|
+
yield(fn, dest_file)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def with_verbose(v)
|
|
178
|
+
oldverbose = $verbose
|
|
179
|
+
$verbose = v
|
|
180
|
+
yield
|
|
181
|
+
ensure
|
|
182
|
+
$verbose = oldverbose
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby -rcomplex -e'c,m,w,h=Complex(-0.75,0.136),50,200,100;puts"P6\n"+"#{w} #{h}\n255";(0...h).each{|j|(0...w).each{|i|n,z=0,Complex(0.9*i/w,0.9*j/h);while n<=m&&(z-c).abs<=2;z=z*z+c;n+=1 end;print [20+n*10,0,rand*99].pack("C*")}}'|display
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
= Utils
|
|
4
|
+
|
|
5
|
+
Utils is simply a plethora of functions that one might use for degugging, testing,
|
|
6
|
+
finding certain files, etc. It's really a place to put methods related to progrmming task,
|
|
7
|
+
that while useful simply don't have a specifc home elsehwere. It is possible that they will
|
|
8
|
+
evetnually find said home and go live there.
|
|
9
|
+
|
|
10
|
+
Most of this was shamelessly ripped form the CrossCase distribution labeled
|
|
11
|
+
'Install/distribution utility functions'. But this will evolove over time.
|
|
12
|
+
|
|
13
|
+
== Authors
|
|
14
|
+
|
|
15
|
+
* Michael Granger <ged@FaerieMUD.org>
|
|
16
|
+
|
|
17
|
+
== Version
|
|
18
|
+
|
|
19
|
+
$Id: utils.rb,v 1.1.1.1 2003/07/25 15:43:29 deveiant Exp $
|
|
20
|
+
|
|
21
|
+
== Legal
|
|
22
|
+
|
|
23
|
+
Parital Copyright (c) 2001-2003, The FaerieMUD Consortium.
|
|
24
|
+
|
|
25
|
+
This is free software. You may use, modify, and/or redistribute this
|
|
26
|
+
software under the terms of the Perl Artistic License. (See
|
|
27
|
+
http://language.perl.com/misc/Artistic.html)
|
|
28
|
+
|
|
29
|
+
=end
|
|
30
|
+
|
|
31
|
+
=begin
|
|
32
|
+
BEGIN {
|
|
33
|
+
begin
|
|
34
|
+
require 'readline'
|
|
35
|
+
include Readline
|
|
36
|
+
rescue LoadError => e
|
|
37
|
+
$stderr.puts "Faking readline..."
|
|
38
|
+
def readline( prompt )
|
|
39
|
+
$stderr.print prompt.chomp
|
|
40
|
+
return $stdin.gets.chomp
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
begin
|
|
45
|
+
require 'yaml'
|
|
46
|
+
$yaml = true
|
|
47
|
+
rescue LoadError => e
|
|
48
|
+
$stderr.puts "No YAML; try() will use .inspect instead."
|
|
49
|
+
$yaml = false
|
|
50
|
+
end
|
|
51
|
+
}
|
|
52
|
+
=end
|
|
53
|
+
|
|
54
|
+
module UtilityFunctions
|
|
55
|
+
|
|
56
|
+
# The list of regexen that eliminate files from the MANIFEST
|
|
57
|
+
ANTIMANIFEST = [
|
|
58
|
+
/makedist\.rb/,
|
|
59
|
+
/\bCVS\b/,
|
|
60
|
+
/~$/,
|
|
61
|
+
/^#/,
|
|
62
|
+
%r{docs/html},
|
|
63
|
+
%r{docs/man},
|
|
64
|
+
/^TEMPLATE/,
|
|
65
|
+
/\.cvsignore/,
|
|
66
|
+
/\.s?o$/
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
# Set some ANSI escape code constants (Shamelessly stolen from Perl's
|
|
70
|
+
# Term::ANSIColor by Russ Allbery <rra@stanford.edu> and Zenin <zenin@best.com>
|
|
71
|
+
AnsiAttributes = {
|
|
72
|
+
'clear' => 0,
|
|
73
|
+
'reset' => 0,
|
|
74
|
+
'bold' => 1,
|
|
75
|
+
'dark' => 2,
|
|
76
|
+
'underline' => 4,
|
|
77
|
+
'underscore' => 4,
|
|
78
|
+
'blink' => 5,
|
|
79
|
+
'reverse' => 7,
|
|
80
|
+
'concealed' => 8,
|
|
81
|
+
|
|
82
|
+
'black' => 30, 'on_black' => 40,
|
|
83
|
+
'red' => 31, 'on_red' => 41,
|
|
84
|
+
'green' => 32, 'on_green' => 42,
|
|
85
|
+
'yellow' => 33, 'on_yellow' => 43,
|
|
86
|
+
'blue' => 34, 'on_blue' => 44,
|
|
87
|
+
'magenta' => 35, 'on_magenta' => 45,
|
|
88
|
+
'cyan' => 36, 'on_cyan' => 46,
|
|
89
|
+
'white' => 37, 'on_white' => 47
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ErasePreviousLine = "\033[A\033[K"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
###############
|
|
96
|
+
module_function
|
|
97
|
+
###############
|
|
98
|
+
|
|
99
|
+
# Create a string that contains the ANSI codes specified and return it
|
|
100
|
+
def ansiCode( *attributes )
|
|
101
|
+
return '' unless /(?:vt10[03]|xterm(?:-color)?|linux)/i =~ ENV['TERM']
|
|
102
|
+
attr = attributes.collect {|a| AnsiAttributes[a] ? AnsiAttributes[a] : nil}.compact.join(';')
|
|
103
|
+
if attr.empty?
|
|
104
|
+
return ''
|
|
105
|
+
else
|
|
106
|
+
return "\e[%sm" % attr
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Test for the presence of the specified <tt>library</tt>, and output a
|
|
111
|
+
# message describing the test using <tt>nicename</tt>. If <tt>nicename</tt>
|
|
112
|
+
# is <tt>nil</tt>, the value in <tt>library</tt> is used to build a default.
|
|
113
|
+
def testForLibrary( library, nicename=nil )
|
|
114
|
+
nicename ||= library
|
|
115
|
+
message( "Testing for the #{nicename} library..." )
|
|
116
|
+
if $:.detect{ |dir|
|
|
117
|
+
File.exists?(File.join(dir,"#{library}.rb")) || File.exists?(File.join(dir,"#{library}.so"))
|
|
118
|
+
}
|
|
119
|
+
message( "found.\n" )
|
|
120
|
+
return true
|
|
121
|
+
else
|
|
122
|
+
message( "not found.\n" )
|
|
123
|
+
return false
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Test for the presence of the specified <tt>library</tt>, and output a
|
|
128
|
+
# message describing the problem using <tt>nicename</tt>. If
|
|
129
|
+
# <tt>nicename</tt> is <tt>nil</tt>, the value in <tt>library</tt> is used
|
|
130
|
+
# to build a default. If <tt>raaUrl</tt> and/or <tt>downloadUrl</tt> are
|
|
131
|
+
# specified, they are also use to build a message describing how to find the
|
|
132
|
+
# required library. If <tt>fatal</tt> is <tt>true</tt>, a missing library
|
|
133
|
+
# will cause the program to abort.
|
|
134
|
+
def testForRequiredLibrary( library, nicename=nil, raaUrl=nil, downloadUrl=nil, fatal=true )
|
|
135
|
+
nicename ||= library
|
|
136
|
+
unless testForLibrary( library, nicename )
|
|
137
|
+
msgs = [ "You are missing the required #{nicename} library.\n" ]
|
|
138
|
+
msgs << "RAA: #{raaUrl}\n" if raaUrl
|
|
139
|
+
msgs << "Download: #{downloadUrl}\n" if downloadUrl
|
|
140
|
+
if fatal
|
|
141
|
+
abort msgs.join('')
|
|
142
|
+
else
|
|
143
|
+
errorMessage msgs.join('')
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
return true
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
### Output <tt>msg</tt> as a ANSI-colored program/section header (white on
|
|
150
|
+
### blue).
|
|
151
|
+
def header( msg )
|
|
152
|
+
msg.chomp!
|
|
153
|
+
$stderr.puts ansiCode( 'bold', 'white', 'on_blue' ) + msg + ansiCode( 'reset' )
|
|
154
|
+
$stderr.flush
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
### Output <tt>msg</tt> to STDERR and flush it.
|
|
158
|
+
def message( msg )
|
|
159
|
+
$stderr.print ansiCode( 'cyan' ) + msg + ansiCode( 'reset' )
|
|
160
|
+
$stderr.flush
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
### Output the specified <tt>msg</tt> as an ANSI-colored error message
|
|
164
|
+
### (white on red).
|
|
165
|
+
def errorMessage( msg )
|
|
166
|
+
message ansiCode( 'bold', 'white', 'on_red' ) + msg + ansiCode( 'reset' )
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
### Output the specified <tt>msg</tt> as an ANSI-colored debugging message
|
|
170
|
+
### (yellow on blue).
|
|
171
|
+
def debugMsg( msg )
|
|
172
|
+
return unless $DEBUG
|
|
173
|
+
msg.chomp!
|
|
174
|
+
$stderr.puts ansiCode( 'bold', 'yellow', 'on_blue' ) + ">>> #{msg}" + ansiCode( 'reset' )
|
|
175
|
+
$stderr.flush
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
### Erase the previous line (if supported by your terminal) and output the
|
|
179
|
+
### specified <tt>msg</tt> instead.
|
|
180
|
+
def replaceMessage( msg )
|
|
181
|
+
print ErasePreviousLine
|
|
182
|
+
message( msg )
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
### Output a divider made up of <tt>length</tt> hyphen characters.
|
|
186
|
+
def divider( length=75 )
|
|
187
|
+
puts "\r" + ("-" * length )
|
|
188
|
+
end
|
|
189
|
+
alias :writeLine :divider
|
|
190
|
+
|
|
191
|
+
### Output the specified <tt>msg</tt> colored in ANSI red and exit with a
|
|
192
|
+
### status of 1.
|
|
193
|
+
def abort( msg )
|
|
194
|
+
print ansiCode( 'bold', 'red' ) + "Aborted: " + msg.chomp + ansiCode( 'reset' ) + "\n\n"
|
|
195
|
+
Kernel.exit!( 1 )
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
### Output the specified <tt>promptString</tt> as a prompt (in green) and
|
|
199
|
+
### return the user's input with leading and trailing spaces removed.
|
|
200
|
+
def prompt( promptString )
|
|
201
|
+
promptString.chomp!
|
|
202
|
+
return readline( ansiCode('bold', 'green') + "#{promptString}: " + ansiCode('reset') ).strip
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
### Prompt the user with the given <tt>promptString</tt> via #prompt,
|
|
206
|
+
### substituting the given <tt>default</tt> if the user doesn't input
|
|
207
|
+
### anything.
|
|
208
|
+
def promptWithDefault( promptString, default )
|
|
209
|
+
response = prompt( "%s [%s]" % [ promptString, default ] )
|
|
210
|
+
if response.empty?
|
|
211
|
+
return default
|
|
212
|
+
else
|
|
213
|
+
return response
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
### Search for the program specified by the given <tt>progname</tt> in the
|
|
218
|
+
### user's <tt>PATH</tt>, and return the full path to it, or <tt>nil</tt> if
|
|
219
|
+
### no such program is in the path.
|
|
220
|
+
def findProgram( progname )
|
|
221
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each {|d|
|
|
222
|
+
file = File.join( d, progname )
|
|
223
|
+
return file if File.executable?( file )
|
|
224
|
+
}
|
|
225
|
+
return nil
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
### Using the CVS log for the given <tt>file</tt> attempt to guess what the
|
|
229
|
+
### next release version might be. This only works if releases are tagged
|
|
230
|
+
### with tags like 'RELEASE_x_y'.
|
|
231
|
+
def extractNextVersionFromTags( file )
|
|
232
|
+
message "Attempting to extract next release version from CVS tags for #{file}...\n"
|
|
233
|
+
raise RuntimeError, "No such file '#{file}'" unless File.exists?( file )
|
|
234
|
+
cvsPath = findProgram( 'cvs' ) or
|
|
235
|
+
raise RuntimeError, "Cannot find the 'cvs' program. Aborting."
|
|
236
|
+
|
|
237
|
+
output = %x{#{cvsPath} log #{file}}
|
|
238
|
+
release = [ 0, 0 ]
|
|
239
|
+
output.scan( /RELEASE_(\d+)_(\d+)/ ) {|match|
|
|
240
|
+
if $1.to_i > release[0] || $2.to_i > release[1]
|
|
241
|
+
release = [ $1.to_i, $2.to_i ]
|
|
242
|
+
replaceMessage( "Found %d.%02d...\n" % release )
|
|
243
|
+
end
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if release[1] >= 99
|
|
247
|
+
release[0] += 1
|
|
248
|
+
release[1] = 1
|
|
249
|
+
else
|
|
250
|
+
release[1] += 1
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
return "%d.%02d" % release
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
### Extract the project name (CVS Repository name) for the given directory.
|
|
257
|
+
def extractProjectName
|
|
258
|
+
File.open( "CVS/Repository", "r").readline.chomp
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
### Read the specified <tt>manifestFile</tt>, which is a text file
|
|
262
|
+
### describing which files to package up for a distribution. The manifest
|
|
263
|
+
### should consist of one or more lines, each containing one filename or
|
|
264
|
+
### shell glob pattern.
|
|
265
|
+
def readManifest( manifestFile="MANIFEST" )
|
|
266
|
+
message "Building manifest..."
|
|
267
|
+
raise "Missing #{manifestFile}, please remake it" unless File.exists? manifestFile
|
|
268
|
+
|
|
269
|
+
manifest = IO::readlines( manifestFile ).collect{ |line|
|
|
270
|
+
line.chomp
|
|
271
|
+
}.select{ |line|
|
|
272
|
+
line !~ /^(\s*(#.*)?)?$/
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
filelist = []
|
|
276
|
+
for pat in manifest
|
|
277
|
+
$stderr.puts "Adding files that match '#{pat}' to the file list" if $VERBOSE
|
|
278
|
+
filelist |= Dir.glob( pat ).find_all {|f| FileTest.file?(f)}
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
message "found #{filelist.length} files.\n"
|
|
282
|
+
return filelist
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
### Given a <tt>filelist</tt> like that returned by #readManifest, remove
|
|
286
|
+
### the entries therein which match the Regexp objects in the given
|
|
287
|
+
### <tt>antimanifest</tt> and return the resultant Array.
|
|
288
|
+
def vetManifest( filelist, antimanifest=ANITMANIFEST )
|
|
289
|
+
origLength = filelist.length
|
|
290
|
+
message "Vetting manifest..."
|
|
291
|
+
|
|
292
|
+
for regex in antimanifest
|
|
293
|
+
if $VERBOSE
|
|
294
|
+
message "\n\tPattern /#{regex.source}/ removed: " +
|
|
295
|
+
filelist.find_all {|file| regex.match(file)}.join(', ')
|
|
296
|
+
end
|
|
297
|
+
filelist.delete_if {|file| regex.match(file)}
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
message "removed #{origLength - filelist.length} files from the list.\n"
|
|
301
|
+
return filelist
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
### Combine a call to #readManifest with one to #vetManifest.
|
|
305
|
+
def getVettedManifest( manifestFile="MANIFEST", antimanifest=ANTIMANIFEST )
|
|
306
|
+
vetManifest( readManifest(manifestFile), antimanifest )
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
### Given a documentation <tt>catalogFile</tt>, which is in the same format
|
|
310
|
+
### as that described by #readManifest, read and expand it, and then return
|
|
311
|
+
### a list of those files which appear to have RDoc documentation in
|
|
312
|
+
### them. If <tt>catalogFile</tt> is nil or does not exist, the MANIFEST
|
|
313
|
+
### file is used instead.
|
|
314
|
+
def findRdocableFiles( catalogFile="docs/CATALOG" )
|
|
315
|
+
startlist = []
|
|
316
|
+
if File.exists? catalogFile
|
|
317
|
+
message "Using CATALOG file (%s).\n" % catalogFile
|
|
318
|
+
startlist = getVettedManifest( catalogFile )
|
|
319
|
+
else
|
|
320
|
+
message "Using default MANIFEST\n"
|
|
321
|
+
startlist = getVettedManifest()
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
message "Looking for RDoc comments in:\n" if $VERBOSE
|
|
325
|
+
startlist.select {|fn|
|
|
326
|
+
message " #{fn}: " if $VERBOSE
|
|
327
|
+
found = false
|
|
328
|
+
File::open( fn, "r" ) {|fh|
|
|
329
|
+
fh.each {|line|
|
|
330
|
+
if line =~ /^(\s*#)?\s*=/ || line =~ /:\w+:/ || line =~ %r{/\*}
|
|
331
|
+
found = true
|
|
332
|
+
break
|
|
333
|
+
end
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
message( (found ? "yes" : "no") + "\n" ) if $VERBOSE
|
|
338
|
+
found
|
|
339
|
+
}
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
### Open a file and filter each of its lines through the given block a
|
|
343
|
+
### <tt>line</tt> at a time. The return value of the block is used as the
|
|
344
|
+
### new line, or omitted if the block returns <tt>nil</tt> or
|
|
345
|
+
### <tt>false</tt>.
|
|
346
|
+
def editInPlace( file ) # :yields: line
|
|
347
|
+
raise "No block specified for editing operation" unless block_given?
|
|
348
|
+
|
|
349
|
+
tempName = "#{file}.#{$$}"
|
|
350
|
+
File::open( tempName, File::RDWR|File::CREAT, 0600 ) {|tempfile|
|
|
351
|
+
File::unlink( tempName )
|
|
352
|
+
File::open( file, File::RDONLY ) {|fh|
|
|
353
|
+
fh.each {|line|
|
|
354
|
+
newline = yield( line ) or next
|
|
355
|
+
tempfile.print( newline )
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
tempfile.seek(0)
|
|
360
|
+
|
|
361
|
+
File::open( file, File::TRUNC|File::WRONLY, 0644 ) {|newfile|
|
|
362
|
+
newfile.print( tempfile.read )
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
### Execute the specified shell <tt>command</tt>, read the results, and
|
|
368
|
+
### return them. Like a %x{} that returns an Array instead of a String.
|
|
369
|
+
def shellCommand( *command )
|
|
370
|
+
raise "Empty command" if command.empty?
|
|
371
|
+
|
|
372
|
+
cmdpipe = IO::popen( command.join(' '), 'r' )
|
|
373
|
+
return cmdpipe.readlines
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
### Execute a block with $VERBOSE set to +false+, restoring it to its
|
|
377
|
+
### previous value before returning.
|
|
378
|
+
def verboseOff
|
|
379
|
+
raise LocalJumpError, "No block given" unless block_given?
|
|
380
|
+
|
|
381
|
+
thrcrit = Thread.critical
|
|
382
|
+
oldverbose = $VERBOSE
|
|
383
|
+
begin
|
|
384
|
+
Thread.critical = true
|
|
385
|
+
$VERBOSE = false
|
|
386
|
+
yield
|
|
387
|
+
ensure
|
|
388
|
+
$VERBOSE = oldverbose
|
|
389
|
+
Thread.critical = false
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
### Try the specified code block, printing the given
|
|
395
|
+
def try( msg, bind=nil ) #:yield:
|
|
396
|
+
result = nil
|
|
397
|
+
message "Trying #{msg}..."
|
|
398
|
+
|
|
399
|
+
begin
|
|
400
|
+
rval = nil
|
|
401
|
+
if block_given?
|
|
402
|
+
rval = yield
|
|
403
|
+
else
|
|
404
|
+
file, line = caller(1)[0].split(/:/,2)
|
|
405
|
+
rval = eval( msg, bind, file, line.to_i )
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
if $yaml
|
|
409
|
+
result = rval.to_yaml
|
|
410
|
+
else
|
|
411
|
+
result = rval.inspect
|
|
412
|
+
end
|
|
413
|
+
rescue Exception => err
|
|
414
|
+
nicetrace = err.backtrace.delete_if {|frame|
|
|
415
|
+
/in `(try|eval)'/ =~ frame
|
|
416
|
+
}.join("\n\t")
|
|
417
|
+
result = err.message + "\n\t" + nicetrace
|
|
418
|
+
ensure
|
|
419
|
+
puts result
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
# Run a block, with $VERBOSE set to v. No other threads will
|
|
425
|
+
# run while this block is being executed.
|
|
426
|
+
def verbose_block(v = true, &block)
|
|
427
|
+
Thread.critical = true
|
|
428
|
+
tmp = $VERBOSE
|
|
429
|
+
$VERBOSE = v
|
|
430
|
+
begin
|
|
431
|
+
yield
|
|
432
|
+
ensure
|
|
433
|
+
$VERBOSE = tmp
|
|
434
|
+
Thread.critical = false
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
# Run a block, with $VERBOSE set to false. No other threads will
|
|
439
|
+
# run while this block is being executed.
|
|
440
|
+
def terse_block(&block)
|
|
441
|
+
verbose_block(false, &block)
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
# Ensures that the version number of the installed ruby
|
|
446
|
+
# is greater than or equal to the version string supplied.
|
|
447
|
+
# Credit to Robert Klemme for posting this on ruby-talk.
|
|
448
|
+
#
|
|
449
|
+
# ensure_version "1.7.0"
|
|
450
|
+
# ensure_version "1.8.0"
|
|
451
|
+
# ensure_version "1.8.1"
|
|
452
|
+
def ensure_version( ver )
|
|
453
|
+
if ( RUBY_VERSION.split(/\./).map{|x|x.to_i} <=> ver.split(/\./).map{|x|x.to_i} ) < 0
|
|
454
|
+
throw "Version error: should be #{ver} but is #{RUBY_VERSION}"
|
|
455
|
+
end
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
# Adapted from Minero Aoki's rubyloader.rb
|
|
461
|
+
|
|
462
|
+
require 'rbconfig'
|
|
463
|
+
|
|
464
|
+
module RubyLoader
|
|
465
|
+
|
|
466
|
+
###############
|
|
467
|
+
module_function
|
|
468
|
+
###############
|
|
469
|
+
|
|
470
|
+
def find_feature( feature )
|
|
471
|
+
with_ext( feature ) do |fname|
|
|
472
|
+
$LOAD_PATH.each do |dir|
|
|
473
|
+
path = dir + '/' + fname
|
|
474
|
+
if File.file? path then
|
|
475
|
+
return path
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
end
|
|
479
|
+
nil
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
def provided?( feature )
|
|
483
|
+
with_ext( feature ) do |fn|
|
|
484
|
+
$".index fn and return true
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
false
|
|
488
|
+
end
|
|
489
|
+
alias required? provided?
|
|
490
|
+
|
|
491
|
+
def provide( feature )
|
|
492
|
+
$".push feature
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
def with_ext( feature )
|
|
496
|
+
if /\.(?:rb|#{Config::CONFIG['DLEXT']})\z/o === feature then
|
|
497
|
+
yield feature
|
|
498
|
+
else
|
|
499
|
+
[ 'rb', Config::CONFIG['DLEXT'] ].each do |ext|
|
|
500
|
+
yield feature + '.' + ext
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
# --- test ---
|
|
512
|
+
|
|
513
|
+
if $0 == __FILE__
|
|
514
|
+
|
|
515
|
+
p Utils::RubyLoader.find_feature("enumerator")
|
|
516
|
+
|
|
517
|
+
end
|
|
518
|
+
|