IOWA 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (502) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +14 -0
  3. data/README.md +23 -0
  4. data/RELEASE_NOTES +77 -0
  5. data/ToDo +21 -0
  6. data/components/CRUDList/CRUDList.html +13 -0
  7. data/components/CRUDList/CRUDList.iwa +136 -0
  8. data/components/Content/Content.html +0 -0
  9. data/components/Content/Content.iwa +143 -0
  10. data/components/Content/example/README +9 -0
  11. data/components/Content/example/cgi/iowa.cgi +10 -0
  12. data/components/Content/example/demo.rb +30 -0
  13. data/components/Content/example/doc/index.html +7 -0
  14. data/components/Content/example/iowa/Content.html +1 -0
  15. data/components/Content/example/iowa/Content.iwa +1 -0
  16. data/components/Content/example/iowa/Main.html +6 -0
  17. data/components/Content/example/iowa/Main.iwa +3 -0
  18. data/components/Content/example/iowa/_content/body +7 -0
  19. data/components/Content/example/iowa/_content/body2 +3 -0
  20. data/components/Content/example/iowa/_content/title +2 -0
  21. data/components/Content/example/iowa/app.cnf +8 -0
  22. data/components/Content/example/iowa/app.rb +8 -0
  23. data/components/Content/example/webrick.rb +38 -0
  24. data/components/Include/Include.html +1 -0
  25. data/components/Include/Include.iwa +30 -0
  26. data/components/Include/readme +5 -0
  27. data/components/JumpTo/JumpTo.html +8 -0
  28. data/components/JumpTo/JumpTo.iwa +8 -0
  29. data/components/JumpTo/readme +6 -0
  30. data/doc/Architecture.txt +6 -0
  31. data/doc/History.txt +33 -0
  32. data/doc/StandardDispatcher.txt +19 -0
  33. data/examples/blog/README +1 -0
  34. data/examples/hello_world/README +17 -0
  35. data/examples/hello_world/htdocs/hello_world_html.html +24 -0
  36. data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
  37. data/examples/hello_world/iowa/HelloWorld.html +14 -0
  38. data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
  39. data/examples/hello_world/iowa/Index.html +16 -0
  40. data/examples/hello_world/iowa/Index.iwa +5 -0
  41. data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
  42. data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
  43. data/examples/hello_world/iowa/mapfile.cnf +6 -0
  44. data/examples/hw1/iowa/Main.html +1 -0
  45. data/examples/hw1/iowa/README +9 -0
  46. data/examples/hw1/iowa/hw.rb +4 -0
  47. data/examples/hw2/iowa/Main.html +10 -0
  48. data/examples/hw2/iowa/Main.iwa +7 -0
  49. data/examples/hw2/iowa/README +16 -0
  50. data/examples/hw2/iowa/hw.rb +4 -0
  51. data/examples/hw3/iowa/Main.html +11 -0
  52. data/examples/hw3/iowa/Main.iwa +7 -0
  53. data/examples/hw3/iowa/README +22 -0
  54. data/examples/hw3/iowa/hw.rb +4 -0
  55. data/examples/hw4/iowa/Greetings.html +10 -0
  56. data/examples/hw4/iowa/Greetings.iwa +9 -0
  57. data/examples/hw4/iowa/Main.html +12 -0
  58. data/examples/hw4/iowa/Main.iwa +10 -0
  59. data/examples/hw4/iowa/README +28 -0
  60. data/examples/hw4/iowa/hw.rb +4 -0
  61. data/examples/hw5/iowa/Footer.html +2 -0
  62. data/examples/hw5/iowa/Greetings.html +4 -0
  63. data/examples/hw5/iowa/Greetings.iwa +12 -0
  64. data/examples/hw5/iowa/Header.html +6 -0
  65. data/examples/hw5/iowa/Main.html +12 -0
  66. data/examples/hw5/iowa/Main.iwa +13 -0
  67. data/examples/hw5/iowa/README +16 -0
  68. data/examples/hw5/iowa/hw.rb +4 -0
  69. data/examples/template_server/iowa/Content.iwa +121 -0
  70. data/examples/template_server/iowa/Content.view +0 -0
  71. data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
  72. data/examples/template_server/iowa/DBContentPage.html +3 -0
  73. data/examples/template_server/iowa/DBContentPage.iwa +85 -0
  74. data/examples/template_server/iowa/app.cnf +13 -0
  75. data/examples/template_server/iowa/app.rb +5 -0
  76. data/ext/Classifier/classifier.c +256 -0
  77. data/ext/Classifier/ext_help.h +14 -0
  78. data/ext/Classifier/extconf.rb +5 -0
  79. data/ext/Classifier/tst.h +40 -0
  80. data/ext/Classifier/tst_cleanup.c +24 -0
  81. data/ext/Classifier/tst_delete.c +146 -0
  82. data/ext/Classifier/tst_grow_node_free_list.c +38 -0
  83. data/ext/Classifier/tst_init.c +41 -0
  84. data/ext/Classifier/tst_insert.c +192 -0
  85. data/ext/Classifier/tst_search.c +68 -0
  86. data/ext/http11/README +11 -0
  87. data/ext/http11/ext_help.h +15 -0
  88. data/ext/http11/extconf.rb +5 -0
  89. data/ext/http11/http11.c +534 -0
  90. data/ext/http11/http11.c.dif +422 -0
  91. data/ext/http11/http11_parser.c +1243 -0
  92. data/ext/http11/http11_parser.c.dif +193 -0
  93. data/ext/http11/http11_parser.h +49 -0
  94. data/ext/http11/http11_parser.h.dif +20 -0
  95. data/ext/http11/http11_parser.rl +192 -0
  96. data/ext/httpmachine/Makefile +149 -0
  97. data/ext/httpmachine/extconf.rb +33 -0
  98. data/ext/httpmachine/http.cpp +430 -0
  99. data/ext/httpmachine/http.h +156 -0
  100. data/ext/httpmachine/rubyhttp.cpp +165 -0
  101. data/external/mime-types/LICENCE +18 -0
  102. data/external/mime-types/README +46 -0
  103. data/external/mime-types/doc/classes/MIME.html +120 -0
  104. data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
  105. data/external/mime-types/doc/classes/MIME/Type.html +866 -0
  106. data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
  107. data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
  108. data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
  109. data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
  110. data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
  111. data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
  112. data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
  113. data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
  114. data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
  115. data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
  116. data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
  117. data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
  118. data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
  119. data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
  120. data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
  121. data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
  122. data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
  123. data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
  124. data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
  125. data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
  126. data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
  127. data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
  128. data/external/mime-types/doc/classes/MIME/Types.html +459 -0
  129. data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
  130. data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
  131. data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
  132. data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
  133. data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
  134. data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
  135. data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
  136. data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
  137. data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
  138. data/external/mime-types/doc/created.rid +1 -0
  139. data/external/mime-types/doc/files/ChangeLog.html +320 -0
  140. data/external/mime-types/doc/files/README.html +145 -0
  141. data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
  142. data/external/mime-types/doc/fr_class_index.html +30 -0
  143. data/external/mime-types/doc/fr_file_index.html +29 -0
  144. data/external/mime-types/doc/fr_method_index.html +57 -0
  145. data/external/mime-types/doc/index.html +24 -0
  146. data/external/mime-types/doc/rdoc-style.css +208 -0
  147. data/external/mime-types/lib/mime/types.rb +1558 -0
  148. data/external/package.rb +672 -0
  149. data/external/test_support.rb +95 -0
  150. data/external/tmail/README +7 -0
  151. data/external/tmail/tmail.rb +4 -0
  152. data/external/tmail/tmail/address.rb +222 -0
  153. data/external/tmail/tmail/base64.rb +52 -0
  154. data/external/tmail/tmail/compat.rb +39 -0
  155. data/external/tmail/tmail/config.rb +50 -0
  156. data/external/tmail/tmail/encode.rb +447 -0
  157. data/external/tmail/tmail/header.rb +895 -0
  158. data/external/tmail/tmail/info.rb +14 -0
  159. data/external/tmail/tmail/loader.rb +1 -0
  160. data/external/tmail/tmail/mail.rb +869 -0
  161. data/external/tmail/tmail/mailbox.rb +386 -0
  162. data/external/tmail/tmail/mbox.rb +1 -0
  163. data/external/tmail/tmail/net.rb +260 -0
  164. data/external/tmail/tmail/obsolete.rb +123 -0
  165. data/external/tmail/tmail/parser.rb +1475 -0
  166. data/external/tmail/tmail/parser.y +372 -0
  167. data/external/tmail/tmail/port.rb +356 -0
  168. data/external/tmail/tmail/scanner.rb +17 -0
  169. data/external/tmail/tmail/scanner_r.rb +243 -0
  170. data/external/tmail/tmail/stringio.rb +256 -0
  171. data/external/tmail/tmail/textutils.rb +197 -0
  172. data/external/tmail/tmail/tmail.rb +1 -0
  173. data/external/tmail/tmail/utils.rb +23 -0
  174. data/external/win32-process/README +133 -0
  175. data/external/win32-process/lib/win32/process.rb +561 -0
  176. data/external/windows-pr/README +145 -0
  177. data/external/windows-pr/doc/conversion_guide.txt +25 -0
  178. data/external/windows-pr/lib/windows/clipboard.rb +72 -0
  179. data/external/windows-pr/lib/windows/console.rb +323 -0
  180. data/external/windows-pr/lib/windows/device_io.rb +88 -0
  181. data/external/windows-pr/lib/windows/directory.rb +80 -0
  182. data/external/windows-pr/lib/windows/error.rb +313 -0
  183. data/external/windows-pr/lib/windows/eventlog.rb +120 -0
  184. data/external/windows-pr/lib/windows/file.rb +349 -0
  185. data/external/windows-pr/lib/windows/filesystem.rb +16 -0
  186. data/external/windows-pr/lib/windows/handle.rb +31 -0
  187. data/external/windows-pr/lib/windows/library.rb +76 -0
  188. data/external/windows-pr/lib/windows/limits.rb +13 -0
  189. data/external/windows-pr/lib/windows/memory.rb +117 -0
  190. data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
  191. data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
  192. data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
  193. data/external/windows-pr/lib/windows/national.rb +557 -0
  194. data/external/windows-pr/lib/windows/path.rb +296 -0
  195. data/external/windows-pr/lib/windows/pipe.rb +77 -0
  196. data/external/windows-pr/lib/windows/process.rb +171 -0
  197. data/external/windows-pr/lib/windows/registry.rb +238 -0
  198. data/external/windows-pr/lib/windows/security.rb +89 -0
  199. data/external/windows-pr/lib/windows/service.rb +183 -0
  200. data/external/windows-pr/lib/windows/shell.rb +88 -0
  201. data/external/windows-pr/lib/windows/sound.rb +52 -0
  202. data/external/windows-pr/lib/windows/synchronize.rb +161 -0
  203. data/external/windows-pr/lib/windows/system_info.rb +70 -0
  204. data/external/windows-pr/lib/windows/unicode.rb +138 -0
  205. data/external/windows-pr/lib/windows/window.rb +22 -0
  206. data/iowa.gemspec +45 -0
  207. data/microprojects/DiskCache/LICENSE +28 -0
  208. data/microprojects/DiskCache/README +17 -0
  209. data/microprojects/DiskCache/external/package.rb +608 -0
  210. data/microprojects/DiskCache/external/test_support.rb +8 -0
  211. data/microprojects/DiskCache/setup.rb +22 -0
  212. data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
  213. data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
  214. data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
  215. data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
  216. data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
  217. data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
  218. data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
  219. data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
  220. data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
  221. data/microprojects/LRUCache/LICENSE +28 -0
  222. data/microprojects/LRUCache/README +13 -0
  223. data/microprojects/LRUCache/external/package.rb +608 -0
  224. data/microprojects/LRUCache/external/test_support.rb +8 -0
  225. data/microprojects/LRUCache/setup.rb +22 -0
  226. data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
  227. data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
  228. data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
  229. data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
  230. data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
  231. data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
  232. data/microprojects/LinkedList/LICENSE +28 -0
  233. data/microprojects/LinkedList/README +13 -0
  234. data/microprojects/LinkedList/external/package.rb +608 -0
  235. data/microprojects/LinkedList/external/test_support.rb +8 -0
  236. data/microprojects/LinkedList/setup.rb +22 -0
  237. data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
  238. data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
  239. data/microprojects/README +8 -0
  240. data/setup.rb +116 -0
  241. data/share/iowa/app_skeleton/Main.html +8 -0
  242. data/share/iowa/app_skeleton/Main.iwa +15 -0
  243. data/share/iowa/app_skeleton/app.cnf +48 -0
  244. data/share/iowa/app_skeleton/app.rb +58 -0
  245. data/share/iowa/app_skeleton/models/model.rb +49 -0
  246. data/src/ihc.rb +223 -0
  247. data/src/iowa.cgi +29 -0
  248. data/src/iowa.rb +637 -0
  249. data/src/iowa/AbstractCache.rb +96 -0
  250. data/src/iowa/AcceptLanguage.rb +76 -0
  251. data/src/iowa/Application.rb +928 -0
  252. data/src/iowa/ApplicationStats.rb +72 -0
  253. data/src/iowa/Association.rb +67 -0
  254. data/src/iowa/BindingsParser.rb +62 -0
  255. data/src/iowa/Breakpoint.rb +273 -0
  256. data/src/iowa/CSS.rb +564 -0
  257. data/src/iowa/Client.rb +192 -0
  258. data/src/iowa/Component.rb +405 -0
  259. data/src/iowa/ComponentProxy.rb +26 -0
  260. data/src/iowa/Config.rb +21 -0
  261. data/src/iowa/Constants.rb +226 -0
  262. data/src/iowa/Context.rb +218 -0
  263. data/src/iowa/ContextLogger.rb +16 -0
  264. data/src/iowa/DbPool.rb +222 -0
  265. data/src/iowa/DetachedComponent.rb +18 -0
  266. data/src/iowa/Dispatcher.rb +27 -0
  267. data/src/iowa/DynamicElements.rb +471 -0
  268. data/src/iowa/Element.rb +100 -0
  269. data/src/iowa/Email.rb +287 -0
  270. data/src/iowa/Extensions/AllExtensions.rb +4 -0
  271. data/src/iowa/Extensions/Class.rb +94 -0
  272. data/src/iowa/Extensions/Date.rb +88 -0
  273. data/src/iowa/Extensions/DateTime.rb +88 -0
  274. data/src/iowa/Extensions/Hash.rb +22 -0
  275. data/src/iowa/Extensions/Kernel.rb +6 -0
  276. data/src/iowa/Extensions/Numeric.rb +47 -0
  277. data/src/iowa/Extensions/Object.rb +11 -0
  278. data/src/iowa/Extensions/String.rb +60 -0
  279. data/src/iowa/Extensions/Time.rb +89 -0
  280. data/src/iowa/Extensions/TimeExtensions.rb +6 -0
  281. data/src/iowa/Form.rb +368 -0
  282. data/src/iowa/Hash.rb +85 -0
  283. data/src/iowa/ISAAC.rb +175 -0
  284. data/src/iowa/ImageSize.rb +279 -0
  285. data/src/iowa/IowaComponentMixins.rb +7 -0
  286. data/src/iowa/JSON-lexer.rb +296 -0
  287. data/src/iowa/JSON-objects.rb +201 -0
  288. data/src/iowa/KeyValueCoding.rb +91 -0
  289. data/src/iowa/LinkedList.rb +175 -0
  290. data/src/iowa/Loader.rb +22 -0
  291. data/src/iowa/Lockfile.rb +575 -0
  292. data/src/iowa/Logger.rb +74 -0
  293. data/src/iowa/Monkey.rb +20 -0
  294. data/src/iowa/Mutex.rb +142 -0
  295. data/src/iowa/Policy.rb +70 -0
  296. data/src/iowa/Pool.rb +243 -0
  297. data/src/iowa/PrettyException.rb +1091 -0
  298. data/src/iowa/Request.rb +244 -0
  299. data/src/iowa/Response.rb +133 -0
  300. data/src/iowa/Session.rb +354 -0
  301. data/src/iowa/SessionStats.rb +78 -0
  302. data/src/iowa/String.rb +65 -0
  303. data/src/iowa/Tag.rb +101 -0
  304. data/src/iowa/TemplateParser.rb +236 -0
  305. data/src/iowa/Util.rb +314 -0
  306. data/src/iowa/Webcache.rb +122 -0
  307. data/src/iowa/caches/BiLevelCache.rb +65 -0
  308. data/src/iowa/caches/ClassLimitedCache.rb +67 -0
  309. data/src/iowa/caches/DiskCache.rb +609 -0
  310. data/src/iowa/caches/DiskStore.rb +380 -0
  311. data/src/iowa/caches/LRUCache-alternative.rb +155 -0
  312. data/src/iowa/caches/LRUCache.rb +290 -0
  313. data/src/iowa/caches/SimpleLRUCache.rb +112 -0
  314. data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
  315. data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
  316. data/src/iowa/js/iowa_jsonrpc.js +381 -0
  317. data/src/iowa/js/jsonrpc.js +187 -0
  318. data/src/iowa/js/jsonrpc_async.js +261 -0
  319. data/src/iowa/loaders/DiskLoader.rb +50 -0
  320. data/src/iowa/loggers/Analogger.rb +54 -0
  321. data/src/iowa/loggers/AsyncLogger.rb +54 -0
  322. data/src/iowa/loggers/BitBucket.rb +38 -0
  323. data/src/iowa/loggers/Log4R.rb +13 -0
  324. data/src/iowa/loggers/Log4rLogger.rb +48 -0
  325. data/src/iowa/loggers/Logger.rb +29 -0
  326. data/src/iowa/loggers/RubyLogger.rb +9 -0
  327. data/src/iowa/pools/DBConnectionPool.rb +53 -0
  328. data/src/iowa/request/Apache.rb +90 -0
  329. data/src/iowa/request/EMHybrid.rb +59 -0
  330. data/src/iowa/request/ENV.rb +80 -0
  331. data/src/iowa/request/FCGI.rb +68 -0
  332. data/src/iowa/request/HTTPMachine.rb +75 -0
  333. data/src/iowa/request/Mongrel.rb +68 -0
  334. data/src/iowa/request/WEBrick.rb +48 -0
  335. data/src/iowa/version.rb +3 -0
  336. data/src/iowa/webrick/HTTPServer.rb +43 -0
  337. data/src/iowa/webrick/WEBrickServlet.rb +28 -0
  338. data/src/iowa_fcgi_handler.rb +101 -0
  339. data/src/iowa_httpmachine.rb +141 -0
  340. data/src/iowa_hybrid.rb +193 -0
  341. data/src/iowa_hybrid_cluster.rb +231 -0
  342. data/src/iowa_mongrel.rb +136 -0
  343. data/src/iowa_webrick.rb +194 -0
  344. data/src/iowa_webrick_legacy.rb +104 -0
  345. data/src/mod_iowa.rb +104 -0
  346. data/tcss.rb +61 -0
  347. data/test/README.windows +12 -0
  348. data/test/TC_AcceptLanguage.rb +61 -0
  349. data/test/TC_AppConfig.rb +43 -0
  350. data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
  351. data/test/TC_AppConfig/doc/index.html +1 -0
  352. data/test/TC_AppConfig/iowa/Main.html +4 -0
  353. data/test/TC_AppConfig/iowa/Main.iwa +17 -0
  354. data/test/TC_AppConfig/iowa/README +1 -0
  355. data/test/TC_AppConfig/iowa/app.cnf +19 -0
  356. data/test/TC_AppConfig/iowa/app.rb +8 -0
  357. data/test/TC_AppConfig/webrick.rb +38 -0
  358. data/test/TC_Association.rb +29 -0
  359. data/test/TC_BiLevelCache.rb +71 -0
  360. data/test/TC_CGI_Adaptor.rb +55 -0
  361. data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
  362. data/test/TC_CGI_Adaptor/doc/index.html +1 -0
  363. data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
  364. data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
  365. data/test/TC_CGI_Adaptor/iowa/README +1 -0
  366. data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
  367. data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
  368. data/test/TC_CGI_Adaptor/webrick.rb +38 -0
  369. data/test/TC_CSS.rb +660 -0
  370. data/test/TC_ClassLimitedCache.rb +89 -0
  371. data/test/TC_Classifier.rb +80 -0
  372. data/test/TC_DbPool.rb +127 -0
  373. data/test/TC_DiskCache.rb +218 -0
  374. data/test/TC_Hybrid.rb +58 -0
  375. data/test/TC_Hybrid/doc/thing.txt +1 -0
  376. data/test/TC_Hybrid/iowa/Main.html +3 -0
  377. data/test/TC_Hybrid/iowa/Main.iwa +7 -0
  378. data/test/TC_Hybrid/iowa/NewPage.html +1 -0
  379. data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
  380. data/test/TC_Hybrid/iowa/app.cnf +10 -0
  381. data/test/TC_Hybrid/iowa/app.rb +5 -0
  382. data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
  383. data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
  384. data/test/TC_IOWAFunctions/doc/index.html +1 -0
  385. data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
  386. data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
  387. data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
  388. data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
  389. data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
  390. data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
  391. data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
  392. data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
  393. data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
  394. data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
  395. data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
  396. data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
  397. data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
  398. data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
  399. data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
  400. data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
  401. data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
  402. data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
  403. data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
  404. data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
  405. data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
  406. data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
  407. data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
  408. data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
  409. data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
  410. data/test/TC_ISAAC.rb +52 -0
  411. data/test/TC_ImageSize.rb +84 -0
  412. data/test/TC_ImageSize/img.bmp +0 -0
  413. data/test/TC_ImageSize/img.gif +0 -0
  414. data/test/TC_ImageSize/img.jpg +0 -0
  415. data/test/TC_ImageSize/img.pcx +0 -0
  416. data/test/TC_ImageSize/img.pgm +7144 -0
  417. data/test/TC_ImageSize/img.png +0 -0
  418. data/test/TC_ImageSize/img.ppm +0 -0
  419. data/test/TC_ImageSize/img.psd +0 -0
  420. data/test/TC_ImageSize/img.tiff +0 -0
  421. data/test/TC_ImageSize/img.xbm +22 -0
  422. data/test/TC_KeyValueCoding.rb +35 -0
  423. data/test/TC_LRUCache.rb +296 -0
  424. data/test/TC_LinkedList.rb +46 -0
  425. data/test/TC_Lockfile.rb +106 -0
  426. data/test/TC_Minimal.rb +45 -0
  427. data/test/TC_Minimal/app.cnf +8 -0
  428. data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
  429. data/test/TC_Minimal/doc/index.html +1 -0
  430. data/test/TC_Minimal/iowa/Main.html +1 -0
  431. data/test/TC_Minimal/iowa/README +1 -0
  432. data/test/TC_Minimal/iowa/app.rb +3 -0
  433. data/test/TC_Minimal/webrick.rb +38 -0
  434. data/test/TC_Mongrel.rb +58 -0
  435. data/test/TC_Mongrel/doc/thing.txt +1 -0
  436. data/test/TC_Mongrel/iowa/Main.html +3 -0
  437. data/test/TC_Mongrel/iowa/Main.iwa +7 -0
  438. data/test/TC_Mongrel/iowa/NewPage.html +1 -0
  439. data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
  440. data/test/TC_Mongrel/iowa/app.cnf +10 -0
  441. data/test/TC_Mongrel/iowa/app.rb +5 -0
  442. data/test/TC_NoSubclass.rb +56 -0
  443. data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
  444. data/test/TC_NoSubclass/doc/index.html +1 -0
  445. data/test/TC_NoSubclass/iowa/Main.html +8 -0
  446. data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
  447. data/test/TC_NoSubclass/iowa/README +1 -0
  448. data/test/TC_NoSubclass/iowa/app.cnf +8 -0
  449. data/test/TC_NoSubclass/iowa/app.rb +5 -0
  450. data/test/TC_NoSubclass/webrick.rb +38 -0
  451. data/test/TC_Pool.rb +139 -0
  452. data/test/TC_RenderedCache/doc/thing.txt +1 -0
  453. data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
  454. data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
  455. data/test/TC_RenderedCache/iowa/Main.html +3 -0
  456. data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
  457. data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
  458. data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
  459. data/test/TC_RenderedCache/iowa/app.cnf +13 -0
  460. data/test/TC_RenderedCache/iowa/app.rb +5 -0
  461. data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
  462. data/test/TC_ResourceURL.rb +73 -0
  463. data/test/TC_ResourceURL/iowa/Main.html +2 -0
  464. data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
  465. data/test/TC_ResourceURL/iowa/app.cnf +10 -0
  466. data/test/TC_ResourceURL/iowa/app.rb +5 -0
  467. data/test/TC_SimpleDetached.rb +41 -0
  468. data/test/TC_StandardDispatcher.rb +362 -0
  469. data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
  470. data/test/TC_String.rb +24 -0
  471. data/test/TC_Tag.rb +41 -0
  472. data/test/TC_Webrick.rb +56 -0
  473. data/test/TC_Webrick/doc/thing.txt +1 -0
  474. data/test/TC_Webrick/iowa/Main.html +3 -0
  475. data/test/TC_Webrick/iowa/Main.iwa +7 -0
  476. data/test/TC_Webrick/iowa/NewPage.html +1 -0
  477. data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
  478. data/test/TC_Webrick/iowa/app.cnf +10 -0
  479. data/test/TC_Webrick/iowa/app.rb +5 -0
  480. data/test/tc_template.rb +15 -0
  481. data/test/tests.conf +19 -0
  482. data/utils/CVS/Entries +3 -0
  483. data/utils/CVS/Repository +1 -0
  484. data/utils/CVS/Root +1 -0
  485. data/utils/QuickCert-1.0.2.tar.gz +0 -0
  486. data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
  487. data/utils/QuickCert-1.0.2/MANIFEST +10 -0
  488. data/utils/QuickCert-1.0.2/Makefile +15 -0
  489. data/utils/QuickCert-1.0.2/README +56 -0
  490. data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
  491. data/utils/QuickCert-1.0.2/config.save +12 -0
  492. data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
  493. data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
  494. data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
  495. data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
  496. data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
  497. data/utils/QuickCert-1.0.2/setup.rb +1312 -0
  498. data/utils/iowa_apps +422 -0
  499. data/utils/smtp_sink.rb +9 -0
  500. data/utils/startup_template.cnf +27 -0
  501. data/utils/startup_template.rb +73 -0
  502. metadata +551 -0
@@ -0,0 +1,22 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module Window
5
+ # ShowWindow() constants
6
+ SW_HIDE = 0
7
+ SW_SHOWNORMAL = 1
8
+ SW_NORMAL = 1
9
+ SW_SHOWMINIMIZED = 2
10
+ SW_SHOWMAXIMIZED = 3
11
+ SW_MAXIMIZE = 3
12
+ SW_SHOWNOACTIVATE = 4
13
+ SW_SHOW = 5
14
+ SW_MINIMIZE = 6
15
+ SW_SHOWMINNOACTIVE = 7
16
+ SW_SHOWNA = 8
17
+ SW_RESTORE = 9
18
+ SW_SHOWDEFAULT = 10
19
+ SW_FORCEMINIMIZE = 11
20
+ SW_MAX = 11
21
+ end
22
+ end
@@ -0,0 +1,45 @@
1
+ #####
2
+ # Swiftcore Swiftiply
3
+ # http://swiftiply.swiftcore.org
4
+ # Copyright 2007-2017 Kirk Haines
5
+ # wyhaines@gmail.com
6
+ #
7
+ # Licensed under the Ruby License. See the README for details.
8
+ #
9
+ #####
10
+ lib = File.expand_path('../src', __FILE__)
11
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
+ require 'iowa/version'
13
+
14
+ spec = Gem::Specification.new do |s|
15
+ s.name = 'IOWA'
16
+ s.author = %q(Kirk Haines)
17
+ s.email = %q(wyhaines@gmail.com)
18
+ s.version = Iowa::VERSION
19
+ s.summary = %q(Internet Objects for Web Applications - A unique and
20
+ capable framework for quickly building web applications with Ruby)
21
+ s.platform = Gem::Platform::RUBY
22
+
23
+ s.has_rdoc = true
24
+ s.rdoc_options = %w(--title IOWA --main README.md --line-numbers)
25
+ s.extra_rdoc_files = %w(README.md)
26
+ s.extensions << 'ext/Classifier/extconf.rb'
27
+ s.extensions << 'ext/http11/extconf.rb'
28
+ s.files = Dir['**/*']
29
+ s.executables = %w()
30
+ s.require_paths = %w(src)
31
+
32
+ s.test_files = []
33
+
34
+ s.rubyforge_project = %q(iowa)
35
+ s.homepage = %q(http://iowa.swiftcore.org/)
36
+ description = []
37
+ File.open("README.md") do |file|
38
+ file.each do |line|
39
+ line.chomp!
40
+ break if line.empty?
41
+ description << "#{line.gsub(/\[\d\]/, '')}"
42
+ end
43
+ end
44
+ s.description = description[1..-1].join(" ")
45
+ end
@@ -0,0 +1,28 @@
1
+ Iowa::LinkedList is copyrighted free software by Kirk Haines <khaines@enigo.com>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ version 2 (see the file GPL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
26
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
27
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
+ PURPOSE.
@@ -0,0 +1,17 @@
1
+ Iowa::Caches::DiskCache v. 0.99.2.9
2
+
3
+ Iowa::Caches::DiskCache implements an on-disk LRU cache via a linked list
4
+ maintained in persistent storage.
5
+
6
+ Iowa::DiskStore is a general purpose persistence engine extracted from the
7
+ DiskCache. It offers a hashlike access to stored data and nestable
8
+ nestable transactions.
9
+
10
+ To install:
11
+
12
+ ruby setup.rb
13
+
14
+
15
+ To test:
16
+
17
+ ruby setup.rb test
@@ -0,0 +1,608 @@
1
+ require 'rbconfig'
2
+ require 'fileutils'
3
+ require 'optparse'
4
+ require 'yaml'
5
+
6
+ class String
7
+ # This patch for win32 paths contributed by James Britt.
8
+ def w32
9
+ if self =~ /^\w:\/\w:/i
10
+ self.gsub(/^\w:\//i, '')
11
+ else
12
+ self
13
+ end
14
+ end
15
+ end
16
+
17
+ module Package
18
+
19
+ class SpecificationError < StandardError; end
20
+ class PackageSpecification_1_0; end
21
+
22
+ SEMANTICS = { "1.0" => PackageSpecification_1_0 }
23
+
24
+ KINDS = [
25
+ :bin, :lib, :ext, :data, :conf, :doc
26
+ ]
27
+
28
+ mapping = { '.' => '\.', '$' => '\$', '#' => '\#', '*' => '.*' }
29
+ ignore_files = %w[core RCSLOG tags TAGS .make.state .nse_depinfo .hg
30
+ #* .#* cvslog.* ,* .del-* *.olb *~ *.old *.bak *.BAK *.orig *.rej _$* *$
31
+ *.org *.in .* ]
32
+
33
+ IGNORE_FILES = ignore_files.map do |x|
34
+ Regexp.new('\A' + x.gsub(/[\.\$\#\*]/){|c| mapping[c]} + '\z')
35
+ end
36
+
37
+ def self.config(name)
38
+ # XXX use pathname
39
+ prefix = Regexp.quote(Config::CONFIG["prefix"])
40
+ exec_prefix = Regexp.quote(Config::CONFIG["exec_prefix"])
41
+ Config::CONFIG[name].gsub(/\A\/?(#{prefix}|#{exec_prefix})\/?/, '')
42
+ end
43
+
44
+ SITE_DIRS = {
45
+ :bin => config("bindir"),
46
+ :lib => config("sitelibdir"),
47
+ :ext => config("sitearchdir"),
48
+ :data => config("datadir"),
49
+ :conf => config("sysconfdir"),
50
+ :doc => File.join(config("datadir"), "doc"),
51
+ }
52
+
53
+ VENDOR_DIRS = {
54
+ :bin => config("bindir"),
55
+ :lib => config("rubylibdir"),
56
+ :ext => config("archdir"),
57
+ :data => config("datadir"),
58
+ :conf => config("sysconfdir"),
59
+ :doc => File.join(config("datadir"), "doc"),
60
+ }
61
+
62
+ MODES = {
63
+ :bin => 0755,
64
+ :lib => 0644,
65
+ :ext => 0755, # was: 0555,
66
+ :data => 0644,
67
+ :conf => 0644,
68
+ :doc => 0644,
69
+ }
70
+
71
+
72
+ SETUP_OPTIONS = {:parse_cmdline => true, :load_conf => true, :run_tasks => true}
73
+
74
+ def self.setup(version, options = {}, &instructions)
75
+ prefixes = dirs = nil
76
+ options = SETUP_OPTIONS.dup.update(options)
77
+
78
+ if options[:load_conf] && File.exist?("config.save")
79
+ config = YAML.load_file "config.save"
80
+ prefixes = config[:prefixes]
81
+ dirs = config[:dirs]
82
+ end
83
+
84
+ pkg = package_specification_with_semantics(version).new(prefixes, dirs)
85
+ pkg.parse_command_line if options[:parse_cmdline]
86
+ pkg.instance_eval(&instructions)
87
+
88
+ pkg.run_tasks if options[:run_tasks]
89
+
90
+ # pkg.install
91
+ pkg
92
+ end
93
+
94
+ def self.package_specification_with_semantics(version)
95
+ #XXX: implement the full x.y(.z)? semantics
96
+ r = SEMANTICS[version]
97
+ raise SpecificationError, "Unknown version #{version}." unless r
98
+ r
99
+ end
100
+
101
+
102
+ module Actions
103
+
104
+ class InstallFile
105
+
106
+ attr_reader :source, :destination, :mode
107
+
108
+ def initialize(source, destination, mode, options)
109
+ @source = source
110
+ @destination = destination
111
+ @mode = mode
112
+ @options = options
113
+ end
114
+
115
+ def install
116
+ dirs = [@options.destdir.to_s, @destination].select {|x| x}
117
+ d = File.expand_path(File.join(dirs)).w32
118
+ FileUtils.install @source, d,
119
+ {:verbose => @options.verbose,
120
+ :noop => @options.noop, :mode => @mode }
121
+ end
122
+
123
+ def hash
124
+ [@source.hash, @destination.hash].hash
125
+ end
126
+
127
+ def eql?(other)
128
+ self.class == other.class &&
129
+ @source == other.source &&
130
+ @destination == other.destination &&
131
+ @mode == other.mode
132
+ end
133
+
134
+ def <=>(other)
135
+ FULL_ORDER[self, other] || self.destination <=> other.destination
136
+ end
137
+ end
138
+
139
+ class MkDir
140
+
141
+ attr_reader :directory
142
+
143
+ def initialize(directory, options)
144
+ @directory = directory
145
+ @options = options
146
+ end
147
+
148
+ def install
149
+ dirs = [@options.destdir.to_s, @directory].select {|x| x}
150
+ d = File.expand_path(File.join(dirs)).w32
151
+ FileUtils.mkdir_p d,
152
+ {:verbose => @options.verbose,
153
+ :noop => @options.noop }
154
+ end
155
+
156
+ def <=>(other)
157
+ FULL_ORDER[self, other] || self.directory <=> other.directory
158
+ end
159
+ end
160
+
161
+ class FixShebang
162
+
163
+ attr_reader :destination
164
+
165
+ def initialize(destination, options)
166
+ @options = options
167
+ @destination = destination
168
+ end
169
+
170
+ def install
171
+ dirs = [@options.destdir.to_s, @destination].select {|x| x}
172
+ d = File.expand_path(File.join(dirs)).w32
173
+ path = d
174
+ fix_shebang(path)
175
+ end
176
+
177
+ # taken from rpa-base, originally based on setup.rb's
178
+ # modify: #!/usr/bin/ruby
179
+ # modify: #! /usr/bin/ruby
180
+ # modify: #!ruby
181
+ # not modify: #!/usr/bin/env ruby
182
+ SHEBANG_RE = /\A\#!\s*\S*ruby\S*/
183
+
184
+ #TODO allow the ruby-prog to be placed in the shebang line to be passed as
185
+ # an option
186
+ def fix_shebang(path)
187
+ tmpfile = path + '.tmp'
188
+ begin
189
+ #XXX: needed at all?
190
+ # it seems that FileUtils doesn't expose its default output
191
+ # @fileutils_output = $stderr
192
+ # we might want to allow this to be redirected.
193
+ $stderr.puts "shebang:open #{tmpfile}" if @options.verbose
194
+ unless @options.noop
195
+ File.open(path) do |r|
196
+ File.open(tmpfile, 'w', 0755) do |w|
197
+ first = r.gets
198
+ return unless SHEBANG_RE =~ first
199
+ w.print first.sub(SHEBANG_RE, '#!' + Config::CONFIG['ruby-prog'])
200
+ w.write r.read
201
+ end
202
+ end
203
+ end
204
+ FileUtils.mv(tmpfile, path, :verbose => @options.verbose,
205
+ :noop => @options.noop)
206
+ ensure
207
+ FileUtils.rm_f(tmpfile, :verbose => @options.verbose,
208
+ :noop => @options.noop)
209
+ end
210
+ end
211
+
212
+ def <=>(other)
213
+ FULL_ORDER[self, other] || self.destination <=> other.destination
214
+ end
215
+
216
+ def hash
217
+ @destination.hash
218
+ end
219
+
220
+ def eql?(other)
221
+ self.class == other.class && self.destination == other.destination
222
+ end
223
+ end
224
+
225
+ order = [MkDir, InstallFile, FixShebang]
226
+ FULL_ORDER = lambda do |me, other|
227
+ a, b = order.index(me.class), order.index(other.class)
228
+ if a && b
229
+ (r = a - b) == 0 ? nil : r
230
+ else
231
+ -1 # arbitrary
232
+ end
233
+ end
234
+
235
+ class ActionList < Array
236
+
237
+ def directories!(options)
238
+ dirnames = []
239
+ map! { |d|
240
+ if d.kind_of?(InstallFile) && !dirnames.include?(File.dirname(d.destination))
241
+ dirnames << File.dirname(d.destination)
242
+ [MkDir.new(File.dirname(d.destination), options), d]
243
+ else
244
+ d
245
+ end
246
+ }
247
+ flatten!
248
+ end
249
+
250
+ def run(task)
251
+ each { |action| action.__send__ task }
252
+ end
253
+ end
254
+
255
+ end # module Actions
256
+
257
+ Options = Struct.new(:noop, :verbose, :destdir)
258
+
259
+ class PackageSpecification_1_0
260
+
261
+ TASKS = %w[config setup install test show]
262
+ # default options for translate(foo => bar)
263
+ TRANSLATE_DEFAULT_OPTIONS = { :inherit => true }
264
+
265
+ def self.declare_file_type(args, &handle_arg)
266
+ str_arr_p = lambda{|x| Array === x && x.all?{|y| String === y}}
267
+
268
+ # strict type checking --- we don't want this to be extended arbitrarily
269
+ unless args.size == 1 && Hash === args.first &&
270
+ args.first.all?{|f,r| [Proc, String, NilClass].include?(r.class) &&
271
+ (String === f || str_arr_p[f])} or
272
+ args.all?{|x| String === x || str_arr_p[x]}
273
+ raise SpecificationError,
274
+ "Unspecified semantics for the given arguments: #{args.inspect}"
275
+ end
276
+
277
+ if args.size == 1 && Hash === args.first
278
+ args.first.to_a.each do |file, rename_info|
279
+ if Array === file
280
+ # ignoring boring files
281
+ handle_arg.call(file, true, rename_info)
282
+ else
283
+ # we do want "boring" files given explicitly
284
+ handle_arg.call([file], false, rename_info)
285
+ end
286
+ end
287
+ else
288
+ args.each do |a|
289
+ if Array === a
290
+ a.each{|file| handle_arg.call(file, true, nil)}
291
+ else
292
+ handle_arg.call(a, false, nil)
293
+ end
294
+ end
295
+ end
296
+ end
297
+
298
+ #{{{ define the file tagging methods
299
+ KINDS.each { |kind|
300
+ define_method(kind) { |*args| # if this were 1.9 we could also take a block
301
+ bin_callback = lambda do |kind_, type, dest, options|
302
+ next if kind_ != :bin || type == :dir
303
+ @actions << Actions::FixShebang.new(dest, options)
304
+ end
305
+ #TODO: refactor
306
+ self.class.declare_file_type(args) do |files, ignore_p, opt_rename_info|
307
+ files.each do |file|
308
+ next if ignore_p && IGNORE_FILES.any?{|re| re.match(file)}
309
+ add_file(kind, file, opt_rename_info, &bin_callback)
310
+ end
311
+ end
312
+ }
313
+ }
314
+
315
+ def unit_test(*files)
316
+ @unit_tests.concat files.flatten
317
+ end
318
+
319
+ def ri(*files)
320
+ @ri_files.concat files.flatten
321
+ end
322
+
323
+ attr_accessor :actions, :options
324
+
325
+ def self.metadata(name)
326
+ define_method(name) { |*args|
327
+ if args.size == 1
328
+ @metadata[name] = args.first
329
+ end
330
+ @metadata[name]
331
+ }
332
+ end
333
+
334
+ metadata :name
335
+ metadata :version
336
+ metadata :author
337
+
338
+
339
+ def translate_dir(kind, dir)
340
+ replaced_dir_parts = dir.split(%r{/})
341
+ kept_dir_parts = []
342
+ loop do
343
+ replaced_path = replaced_dir_parts.join("/")
344
+ target, options = @translate[kind][replaced_path]
345
+ options ||= TRANSLATE_DEFAULT_OPTIONS
346
+ if target && (replaced_path == dir || options[:inherit])
347
+ dir = (target != '' ? File.join(target, *kept_dir_parts) :
348
+ File.join(*kept_dir_parts))
349
+ break
350
+ end
351
+ break if replaced_dir_parts.empty?
352
+ kept_dir_parts.unshift replaced_dir_parts.pop
353
+ end
354
+ dir
355
+ end
356
+
357
+ def add_file(kind, filename, new_filename_info, &callback)
358
+ #TODO: refactor!!!
359
+ if File.directory? filename #XXX setup.rb and rpa-base defined File.dir?
360
+ # to cope with some win32 issue
361
+ dir = filename.sub(/\A\.\//, "").sub(/\/\z/, "")
362
+ dest = File.join(@prefixes[kind], @dirs[kind], translate_dir(kind, dir))
363
+ @actions << Actions::MkDir.new(dest, @options)
364
+ callback.call(kind, :dir, dest, @options) if block_given?
365
+ else
366
+ if new_filename_info
367
+ case new_filename_info
368
+ when Proc
369
+ dest_name = new_filename_info.call(filename.dup)
370
+ else
371
+ dest_name = new_filename_info.dup
372
+ end
373
+ else
374
+ dest_name = filename.dup
375
+ end
376
+
377
+ dirname = File.dirname(dest_name)
378
+ dirname = "" if dirname == "."
379
+ dest_name = File.join(translate_dir(kind, dirname), File.basename(dest_name))
380
+
381
+ dest = File.join(@prefixes[kind], @dirs[kind], dest_name)
382
+ @actions << Actions::InstallFile.new(filename, dest, MODES[kind], @options)
383
+ callback.call(kind, :file, dest, @options) if block_given?
384
+ end
385
+ end
386
+
387
+ def initialize(prefixes = nil, dirs = nil)
388
+ @prefix = Config::CONFIG["prefix"].gsub(/\A\//, '')
389
+ @translate = {}
390
+ @prefixes = (prefixes || {}).dup
391
+ KINDS.each { |kind|
392
+ @prefixes[kind] = @prefix unless prefixes
393
+ @translate[kind] = {}
394
+ }
395
+
396
+ @dirs = (dirs || {}).dup
397
+ @dirs.update SITE_DIRS unless dirs
398
+
399
+ @actions = Actions::ActionList.new
400
+
401
+ @metadata = {}
402
+ @unit_tests = []
403
+ @ri_files = []
404
+
405
+ @options = Options.new
406
+ @options.verbose = true
407
+ @options.noop = false # XXX for testing
408
+ @options.destdir = ''
409
+
410
+ @tasks = []
411
+ end
412
+
413
+ def aoki
414
+ (KINDS - [:ext]).each { |kind|
415
+ translate(kind, kind.to_s => "", :inherit => true)
416
+ __send__ kind, Dir["#{kind}/**/*"]
417
+ }
418
+ translate(:ext, "ext/*" => "", :inherit => true)
419
+ ext Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"]
420
+ end
421
+
422
+ def install
423
+ $stderr.puts "Installing #{name || "unknown package"} #{version}..." if options.verbose
424
+
425
+ actions.uniq!
426
+ actions.sort!
427
+ actions.directories!(options)
428
+
429
+ actions.run :install
430
+
431
+ unless @ri_files.empty?
432
+ $stderr.puts "Generating ri documentation from #{@ri_files.join(',')}"
433
+ require 'rdoc/rdoc'
434
+ unless options.noop
435
+ begin
436
+ RDoc::RDoc.new.document(["--ri-site"].concat(@ri_files.flatten))
437
+ rescue Exception => e
438
+ $stderr.write("Installation of ri documentation failed: #{e.to_s} #{e.backtrace.join("\n")}")
439
+ end
440
+ end
441
+ end
442
+ end
443
+
444
+ def test
445
+ unless @unit_tests.empty?
446
+ puts "Testing #{name || "unknown package"} #{version}..." if options.verbose
447
+ require 'test/unit'
448
+ unless options.noop
449
+ t = Test::Unit::AutoRunner.new(true)
450
+ t.process_args(@unit_tests)
451
+ #t.process_args(['test/TC_AppConfig.rb','TC_ISAAC.rb'])
452
+ t.run
453
+ end
454
+ end
455
+ end
456
+
457
+ def config
458
+ File.open("config.save", "w") { |f|
459
+ YAML.dump({:prefixes => @prefixes, :dirs => @dirs}, f)
460
+ }
461
+ end
462
+
463
+ def show
464
+ KINDS.each { |kind|
465
+ puts "#{kind}\t#{File.join(options.destdir, @prefixes[kind], @dirs[kind])}"
466
+ }
467
+ end
468
+
469
+ def translate(kind, additional_translations)
470
+ default_opts = TRANSLATE_DEFAULT_OPTIONS.dup
471
+ key_val_pairs = additional_translations.to_a
472
+ option_pairs = key_val_pairs.select{|(k,v)| Symbol === k}
473
+ default_opts.update(Hash[*option_pairs.flatten])
474
+
475
+ (key_val_pairs - option_pairs).each do |key, val|
476
+ add_translation(kind, key, val, default_opts)
477
+ end
478
+ end
479
+
480
+ def add_translation(kind, src, dest, options)
481
+ if is_glob?(src)
482
+ dirs = expand_dir_glob(src)
483
+ else
484
+ dirs = [src]
485
+ end
486
+ dirs.each do |dirname|
487
+ dirname = dirname.sub(%r{\A\./}, "").sub(%r{/\z}, "")
488
+ @translate[kind].update({dirname => [dest, options]})
489
+ end
490
+ end
491
+
492
+ def is_glob?(x)
493
+ /(^|[^\\])[*?{\[]/.match(x)
494
+ end
495
+
496
+ def expand_dir_glob(src)
497
+ Dir[src].select{|x| File.directory?(x)}
498
+ end
499
+
500
+ def clean_path(path)
501
+ path.gsub(/\A\//, '').gsub(/\/+\Z/, '').squeeze("/")
502
+ end
503
+
504
+ def parse_command_line
505
+ opts = OptionParser.new(nil, 24, ' ') { |opts|
506
+ opts.banner = "Usage: setup.rb [options] [task]"
507
+
508
+ opts.separator ""
509
+ opts.separator "Tasks:"
510
+ opts.separator " config configures paths"
511
+ opts.separator " show shows paths"
512
+ opts.separator " setup compiles ruby extentions and others XXX"
513
+ opts.separator " install installs files"
514
+ opts.separator " test runs unit tests"
515
+
516
+
517
+ opts.separator ""
518
+ opts.separator "Specific options:"
519
+
520
+ opts.on "--prefix=PREFIX",
521
+ "path prefix of target environment [#@prefix]" do |prefix|
522
+ @prefix.replace clean_path(prefix) # Shared!
523
+ end
524
+
525
+ opts.separator ""
526
+
527
+ KINDS.each { |kind|
528
+ opts.on "--#{kind}prefix=PREFIX",
529
+ "path prefix for #{kind} files [#{@prefixes[kind]}]" do |prefix|
530
+ @prefixes[kind] = clean_path(prefix)
531
+ end
532
+ }
533
+
534
+ opts.separator ""
535
+
536
+ KINDS.each { |kind|
537
+ opts.on "--#{kind}dir=PREFIX",
538
+ "directory for #{kind} files [#{@dirs[kind]}]" do |prefix|
539
+ @dirs[kind] = clean_path(prefix)
540
+ end
541
+ }
542
+
543
+ opts.separator ""
544
+
545
+ KINDS.each { |kind|
546
+ opts.on "--#{kind}=PREFIX",
547
+ "absolute directory for #{kind} files [#{File.join(@prefixes[kind], @dirs[kind])}]" do |prefix|
548
+ @prefixes[kind] = clean_path(prefix)
549
+ end
550
+ }
551
+
552
+ opts.separator ""
553
+ opts.separator "Predefined path configurations:"
554
+ opts.on "--site", "install into site-local directories (default)" do
555
+ @dirs.update SITE_DIRS
556
+ end
557
+
558
+ opts.on "--vendor", "install into distribution directories (for packagers)" do
559
+ @dirs.update VENDOR_DIRS
560
+ end
561
+
562
+ opts.separator ""
563
+ opts.separator "General options:"
564
+
565
+ opts.on "--destdir=DESTDIR",
566
+ "install all files relative to DESTDIR (/)" do |destdir|
567
+ @options.destdir = destdir
568
+ end
569
+
570
+ opts.on "--dry-run", "only display what to do if given [#{@options.noop}]" do
571
+ @options.noop = true
572
+ end
573
+
574
+ opts.on "--no-harm", "only display what to do if given" do
575
+ @options.noop = true
576
+ end
577
+
578
+ opts.on "--[no-]verbose", "output messages verbosely [#{@options.verbose}]" do |verbose|
579
+ @options.verbose = verbose
580
+ end
581
+
582
+ opts.on_tail("-h", "--help", "Show this message") do
583
+ puts opts
584
+ exit
585
+ end
586
+ }
587
+
588
+ opts.parse! ARGV
589
+
590
+ if (ARGV - TASKS).empty? # Only existing tasks?
591
+ @tasks = ARGV
592
+ @tasks = ["install"] if @tasks.empty?
593
+ else
594
+ abort "Unknown task(s) #{(ARGV-TASKS).join ", "}."
595
+ end
596
+ end
597
+
598
+ def run_tasks
599
+ @tasks.each { |task| __send__ task }
600
+ end
601
+ end
602
+
603
+ end # module Package
604
+
605
+ require 'rbconfig'
606
+ def config(x)
607
+ Config::CONFIG[x]
608
+ end