facets 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (794) hide show
  1. data/ProjectInfo +22 -34
  2. metadata +37 -895
  3. data/CHANGELOG +0 -254
  4. data/Rakefile +0 -173
  5. data/TODO +0 -46
  6. data/conf/facets/noauto +0 -48
  7. data/data/facets/index.yml +0 -446
  8. data/lib/facet/array.rb +0 -33
  9. data/lib/facet/array/at_rand.rb +0 -52
  10. data/lib/facet/array/body.rb +0 -2
  11. data/lib/facet/array/delete_unless.rb +0 -35
  12. data/lib/facet/array/delete_values.rb +0 -38
  13. data/lib/facet/array/delete_values_at.rb +0 -57
  14. data/lib/facet/array/each_with_key.rb +0 -9
  15. data/lib/facet/array/first.rb +0 -84
  16. data/lib/facet/array/foot.rb +0 -2
  17. data/lib/facet/array/head.rb +0 -80
  18. data/lib/facet/array/last.rb +0 -2
  19. data/lib/facet/array/last_index.rb +0 -35
  20. data/lib/facet/array/merge.rb +0 -40
  21. data/lib/facet/array/mid.rb +0 -50
  22. data/lib/facet/array/middle.rb +0 -45
  23. data/lib/facet/array/op_fetch.rb +0 -40
  24. data/lib/facet/array/op_store.rb +0 -47
  25. data/lib/facet/array/pick.rb +0 -68
  26. data/lib/facet/array/pos.rb +0 -39
  27. data/lib/facet/array/pull.rb +0 -37
  28. data/lib/facet/array/rand_index.rb +0 -30
  29. data/lib/facet/array/rand_subset.rb +0 -56
  30. data/lib/facet/array/range.rb +0 -47
  31. data/lib/facet/array/rotate.rb +0 -67
  32. data/lib/facet/array/select.rb +0 -37
  33. data/lib/facet/array/shuffle.rb +0 -66
  34. data/lib/facet/array/slap.rb +0 -37
  35. data/lib/facet/array/store.rb +0 -7
  36. data/lib/facet/array/tail.rb +0 -2
  37. data/lib/facet/array/thru.rb +0 -38
  38. data/lib/facet/array/to_b.rb +0 -31
  39. data/lib/facet/array/to_h.rb +0 -57
  40. data/lib/facet/array/to_hash.rb +0 -46
  41. data/lib/facet/array/unzip.rb +0 -20
  42. data/lib/facet/binding.rb +0 -14
  43. data/lib/facet/binding/__DIR__.rb +0 -2
  44. data/lib/facet/binding/__FILE__.rb +0 -2
  45. data/lib/facet/binding/__LINE__.rb +0 -58
  46. data/lib/facet/binding/call_stack.rb +0 -42
  47. data/lib/facet/binding/called.rb +0 -41
  48. data/lib/facet/binding/caller.rb +0 -42
  49. data/lib/facet/binding/defined.rb +0 -41
  50. data/lib/facet/binding/eval.rb +0 -42
  51. data/lib/facet/binding/local_variables.rb +0 -45
  52. data/lib/facet/binding/method_name.rb +0 -48
  53. data/lib/facet/binding/op_fetch.rb +0 -45
  54. data/lib/facet/binding/op_store.rb +0 -46
  55. data/lib/facet/binding/self.rb +0 -41
  56. data/lib/facet/binding/self/of_caller.rb +0 -122
  57. data/lib/facet/class.rb +0 -5
  58. data/lib/facet/class/by_name.rb +0 -1
  59. data/lib/facet/class/descendents.rb +0 -44
  60. data/lib/facet/class/remove_descendents.rb +0 -46
  61. data/lib/facet/class/remove_subclasses.rb +0 -2
  62. data/lib/facet/class/subclasses.rb +0 -2
  63. data/lib/facet/comparable.rb +0 -5
  64. data/lib/facet/comparable/at_least.rb +0 -53
  65. data/lib/facet/comparable/at_most.rb +0 -2
  66. data/lib/facet/comparable/cap.rb +0 -2
  67. data/lib/facet/comparable/clip.rb +0 -72
  68. data/lib/facet/comparable/cmp.rb +0 -38
  69. data/lib/facet/continuation.rb +0 -1
  70. data/lib/facet/continuation/self/create.rb +0 -71
  71. data/lib/facet/date.rb +0 -0
  72. data/lib/facet/date/days_in_month.rb +0 -42
  73. data/lib/facet/date/days_of_month.rb +0 -34
  74. data/lib/facet/date/stamp.rb +0 -52
  75. data/lib/facet/date/to_date.rb +0 -36
  76. data/lib/facet/date/to_s.rb +0 -33
  77. data/lib/facet/date/to_time.rb +0 -36
  78. data/lib/facet/dir.rb +0 -4
  79. data/lib/facet/dir/self/ancestor.rb +0 -33
  80. data/lib/facet/dir/self/ascend.rb +0 -56
  81. data/lib/facet/dir/self/ls_r.rb +0 -76
  82. data/lib/facet/dir/self/recurse.rb +0 -2
  83. data/lib/facet/enumerable.rb +0 -38
  84. data/lib/facet/enumerable/collect_with_counter.rb +0 -2
  85. data/lib/facet/enumerable/collect_with_index.rb +0 -51
  86. data/lib/facet/enumerable/commonality.rb +0 -63
  87. data/lib/facet/enumerable/compact_collect.rb +0 -50
  88. data/lib/facet/enumerable/compact_map.rb +0 -2
  89. data/lib/facet/enumerable/cross.rb +0 -44
  90. data/lib/facet/enumerable/each_by.rb +0 -2
  91. data/lib/facet/enumerable/each_combination.rb +0 -59
  92. data/lib/facet/enumerable/each_pair.rb +0 -50
  93. data/lib/facet/enumerable/each_permutation.rb +0 -2
  94. data/lib/facet/enumerable/each_slice.rb +0 -131
  95. data/lib/facet/enumerable/each_unique_pair.rb +0 -66
  96. data/lib/facet/enumerable/each_with_counter.rb +0 -8
  97. data/lib/facet/enumerable/elementwise.rb +0 -2
  98. data/lib/facet/enumerable/entropy.rb +0 -52
  99. data/lib/facet/enumerable/every.rb +0 -65
  100. data/lib/facet/enumerable/ew.rb +0 -64
  101. data/lib/facet/enumerable/filter_collect.rb +0 -58
  102. data/lib/facet/enumerable/filter_map.rb +0 -2
  103. data/lib/facet/enumerable/find_collisions.rb +0 -41
  104. data/lib/facet/enumerable/frequency.rb +0 -39
  105. data/lib/facet/enumerable/graph.rb +0 -59
  106. data/lib/facet/enumerable/ideal_entropy.rb +0 -49
  107. data/lib/facet/enumerable/map_with_counter.rb +0 -2
  108. data/lib/facet/enumerable/map_with_index.rb +0 -2
  109. data/lib/facet/enumerable/none.rb +0 -56
  110. data/lib/facet/enumerable/nonuniq.rb +0 -39
  111. data/lib/facet/enumerable/occur.rb +0 -62
  112. data/lib/facet/enumerable/one.rb +0 -65
  113. data/lib/facet/enumerable/op_pow.rb +0 -38
  114. data/lib/facet/enumerable/partition_by.rb +0 -55
  115. data/lib/facet/enumerable/permute.rb +0 -135
  116. data/lib/facet/enumerable/probability.rb +0 -59
  117. data/lib/facet/enumerable/project.rb +0 -11
  118. data/lib/facet/enumerable/self/combinations.rb +0 -68
  119. data/lib/facet/enumerable/self/cross.rb +0 -79
  120. data/lib/facet/enumerable/to_h.rb +0 -50
  121. data/lib/facet/enumerable/uniq_by.rb +0 -39
  122. data/lib/facet/enumerable/where.rb +0 -12
  123. data/lib/facet/file.rb +0 -5
  124. data/lib/facet/file/self/create.rb +0 -52
  125. data/lib/facet/file/self/open_as_string.rb +0 -81
  126. data/lib/facet/file/self/read_list.rb +0 -47
  127. data/lib/facet/file/self/sanitize.rb +0 -50
  128. data/lib/facet/file/self/split_all.rb +0 -36
  129. data/lib/facet/fileutils.rb +0 -0
  130. data/lib/facet/fileutils/head.rb +0 -2
  131. data/lib/facet/fileutils/safe_ln.rb +0 -38
  132. data/lib/facet/fileutils/slice.rb +0 -152
  133. data/lib/facet/fileutils/split_all.rb +0 -29
  134. data/lib/facet/fileutils/tail.rb +0 -2
  135. data/lib/facet/fileutils/wc.rb +0 -128
  136. data/lib/facet/fileutils/whereis.rb +0 -76
  137. data/lib/facet/fileutils/which.rb +0 -117
  138. data/lib/facet/float.rb +0 -3
  139. data/lib/facet/float/approx.rb +0 -42
  140. data/lib/facet/float/round_at.rb +0 -72
  141. data/lib/facet/float/round_to.rb +0 -73
  142. data/lib/facet/hash.rb +0 -40
  143. data/lib/facet/hash/alias.rb +0 -54
  144. data/lib/facet/hash/assert_has_keys.rb +0 -38
  145. data/lib/facet/hash/assert_has_only_keys.rb +0 -38
  146. data/lib/facet/hash/at.rb +0 -26
  147. data/lib/facet/hash/collate.rb +0 -53
  148. data/lib/facet/hash/delete_unless.rb +0 -15
  149. data/lib/facet/hash/each.rb +0 -61
  150. data/lib/facet/hash/each_with_index.rb +0 -35
  151. data/lib/facet/hash/each_with_key.rb +0 -32
  152. data/lib/facet/hash/graph.rb +0 -31
  153. data/lib/facet/hash/has_keys.rb +0 -37
  154. data/lib/facet/hash/has_only_keys.rb +0 -37
  155. data/lib/facet/hash/inverse.rb +0 -51
  156. data/lib/facet/hash/join.rb +0 -19
  157. data/lib/facet/hash/keys_to_iv.rb +0 -60
  158. data/lib/facet/hash/keys_to_s.rb +0 -80
  159. data/lib/facet/hash/keys_to_sym.rb +0 -91
  160. data/lib/facet/hash/op_fetch.rb +0 -146
  161. data/lib/facet/hash/op_lshift.rb +0 -28
  162. data/lib/facet/hash/op_store.rb +0 -2
  163. data/lib/facet/hash/rand_key.rb +0 -47
  164. data/lib/facet/hash/rand_pair.rb +0 -50
  165. data/lib/facet/hash/rand_value.rb +0 -60
  166. data/lib/facet/hash/replace_each.rb +0 -33
  167. data/lib/facet/hash/self/zipnew.rb +0 -37
  168. data/lib/facet/hash/shuffle.rb +0 -53
  169. data/lib/facet/hash/slice.rb +0 -33
  170. data/lib/facet/hash/stringify_keys.rb +0 -2
  171. data/lib/facet/hash/swap.rb +0 -36
  172. data/lib/facet/hash/swapkey.rb +0 -44
  173. data/lib/facet/hash/symoblize_keys.rb +0 -2
  174. data/lib/facet/hash/to_h.rb +0 -35
  175. data/lib/facet/hash/to_ostruct.rb +0 -40
  176. data/lib/facet/hash/to_ostruct_recurse.rb +0 -45
  177. data/lib/facet/hash/traverse.rb +0 -63
  178. data/lib/facet/hash/update_each.rb +0 -43
  179. data/lib/facet/hash/update_keys.rb +0 -31
  180. data/lib/facet/hash/update_values.rb +0 -32
  181. data/lib/facet/hash/variablize_keys.rb +0 -2
  182. data/lib/facet/hash/weave.rb +0 -88
  183. data/lib/facet/integer.rb +0 -8
  184. data/lib/facet/integer/even.rb +0 -2
  185. data/lib/facet/integer/fac.rb +0 -2
  186. data/lib/facet/integer/fact.rb +0 -2
  187. data/lib/facet/integer/factorial.rb +0 -61
  188. data/lib/facet/integer/multiple.rb +0 -69
  189. data/lib/facet/integer/odd.rb +0 -2
  190. data/lib/facet/integer/ordinal.rb +0 -41
  191. data/lib/facet/integer/times_collect.rb +0 -39
  192. data/lib/facet/integer/times_map.rb +0 -2
  193. data/lib/facet/kernel.rb +0 -65
  194. data/lib/facet/kernel/__DIR__.rb +0 -11
  195. data/lib/facet/kernel/__class__.rb +0 -31
  196. data/lib/facet/kernel/__meta__.rb +0 -28
  197. data/lib/facet/kernel/adhoc.rb +0 -11
  198. data/lib/facet/kernel/as.rb +0 -91
  199. data/lib/facet/kernel/assign_from.rb +0 -82
  200. data/lib/facet/kernel/assign_with.rb +0 -75
  201. data/lib/facet/kernel/autoreload.rb +0 -46
  202. data/lib/facet/kernel/autoreload_glob.rb +0 -36
  203. data/lib/facet/kernel/bool.rb +0 -77
  204. data/lib/facet/kernel/bug.rb +0 -39
  205. data/lib/facet/kernel/call_stack.rb +0 -59
  206. data/lib/facet/kernel/called.rb +0 -40
  207. data/lib/facet/kernel/complete.rb +0 -6
  208. data/lib/facet/kernel/constant.rb +0 -52
  209. data/lib/facet/kernel/copy.rb +0 -48
  210. data/lib/facet/kernel/deep_copy.rb +0 -49
  211. data/lib/facet/kernel/demo.rb +0 -46
  212. data/lib/facet/kernel/eigenclass.rb +0 -17
  213. data/lib/facet/kernel/false.rb +0 -2
  214. data/lib/facet/kernel/fn.rb +0 -33
  215. data/lib/facet/kernel/generate_method_name.rb +0 -39
  216. data/lib/facet/kernel/get_by_id.rb +0 -33
  217. data/lib/facet/kernel/here.rb +0 -34
  218. data/lib/facet/kernel/in.rb +0 -35
  219. data/lib/facet/kernel/instance_assign.rb +0 -25
  220. data/lib/facet/kernel/instvar.rb +0 -13
  221. data/lib/facet/kernel/is.rb +0 -5
  222. data/lib/facet/kernel/maybe.rb +0 -41
  223. data/lib/facet/kernel/me.rb +0 -17
  224. data/lib/facet/kernel/meta.rb +0 -2
  225. data/lib/facet/kernel/metaclass.rb +0 -42
  226. data/lib/facet/kernel/method.rb +0 -76
  227. data/lib/facet/kernel/method_name.rb +0 -49
  228. data/lib/facet/kernel/methods.rb +0 -79
  229. data/lib/facet/kernel/nack.rb +0 -12
  230. data/lib/facet/kernel/new.rb +0 -40
  231. data/lib/facet/kernel/object_class.rb +0 -31
  232. data/lib/facet/kernel/object_hexid.rb +0 -35
  233. data/lib/facet/kernel/op_esc.rb +0 -37
  234. data/lib/facet/kernel/own.rb +0 -17
  235. data/lib/facet/kernel/p.rb +0 -12
  236. data/lib/facet/kernel/require_all.rb +0 -44
  237. data/lib/facet/kernel/require_esc.rb +0 -42
  238. data/lib/facet/kernel/require_facet.rb +0 -41
  239. data/lib/facet/kernel/require_local.rb +0 -25
  240. data/lib/facet/kernel/resc.rb +0 -32
  241. data/lib/facet/kernel/returning.rb +0 -49
  242. data/lib/facet/kernel/send_as.rb +0 -34
  243. data/lib/facet/kernel/set_from.rb +0 -69
  244. data/lib/facet/kernel/set_with.rb +0 -74
  245. data/lib/facet/kernel/silence_warnings.rb +0 -2
  246. data/lib/facet/kernel/silently.rb +0 -41
  247. data/lib/facet/kernel/singleton.rb +0 -47
  248. data/lib/facet/kernel/superior.rb +0 -53
  249. data/lib/facet/kernel/supermethod.rb +0 -44
  250. data/lib/facet/kernel/this.rb +0 -33
  251. data/lib/facet/kernel/to_b.rb +0 -41
  252. data/lib/facet/kernel/to_bool.rb +0 -47
  253. data/lib/facet/kernel/true.rb +0 -2
  254. data/lib/facet/kernel/unuri.rb +0 -2
  255. data/lib/facet/kernel/uri.rb +0 -38
  256. data/lib/facet/kernel/val.rb +0 -52
  257. data/lib/facet/kernel/warn_with_line.rb +0 -30
  258. data/lib/facet/kernel/with_accessor.rb +0 -94
  259. data/lib/facet/kernel/with_reader.rb +0 -2
  260. data/lib/facet/kernel/with_writer.rb +0 -2
  261. data/lib/facet/logger.rb +0 -0
  262. data/lib/facet/logger/format.rb +0 -28
  263. data/lib/facet/logger/format_message.rb +0 -1
  264. data/lib/facet/matchdata.rb +0 -3
  265. data/lib/facet/matchdata/match.rb +0 -37
  266. data/lib/facet/matchdata/matchset.rb +0 -2
  267. data/lib/facet/matchdata/matchtree.rb +0 -62
  268. data/lib/facet/module.rb +0 -40
  269. data/lib/facet/module/abstract.rb +0 -50
  270. data/lib/facet/module/alias_module_function.rb +0 -57
  271. data/lib/facet/module/ancestor.rb +0 -38
  272. data/lib/facet/module/attr.rb +0 -23
  273. data/lib/facet/module/attr_setter.rb +0 -48
  274. data/lib/facet/module/attr_tester.rb +0 -56
  275. data/lib/facet/module/basename.rb +0 -39
  276. data/lib/facet/module/by_name.rb +0 -68
  277. data/lib/facet/module/cattr_accessor.rb +0 -141
  278. data/lib/facet/module/cattr_reader.rb +0 -2
  279. data/lib/facet/module/cattr_writer.rb +0 -2
  280. data/lib/facet/module/clone_removing.rb +0 -2
  281. data/lib/facet/module/clone_renaming.rb +0 -2
  282. data/lib/facet/module/clone_using.rb +0 -87
  283. data/lib/facet/module/dirname.rb +0 -42
  284. data/lib/facet/module/equate_on.rb +0 -70
  285. data/lib/facet/module/generate_instance_method_name.rb +0 -47
  286. data/lib/facet/module/include_as.rb +0 -102
  287. data/lib/facet/module/initializer.rb +0 -65
  288. data/lib/facet/module/instance_methods.rb +0 -186
  289. data/lib/facet/module/integrate.rb +0 -51
  290. data/lib/facet/module/is.rb +0 -34
  291. data/lib/facet/module/memoize.rb +0 -95
  292. data/lib/facet/module/modspace.rb +0 -43
  293. data/lib/facet/module/namespace.rb +0 -61
  294. data/lib/facet/module/nesting.rb +0 -45
  295. data/lib/facet/module/redef.rb +0 -31
  296. data/lib/facet/module/redefine_method.rb +0 -57
  297. data/lib/facet/module/redirect.rb +0 -30
  298. data/lib/facet/module/redirect_method.rb +0 -64
  299. data/lib/facet/module/remove.rb +0 -29
  300. data/lib/facet/module/rename.rb +0 -31
  301. data/lib/facet/module/rename_method.rb +0 -38
  302. data/lib/facet/module/revisal.rb +0 -49
  303. data/lib/facet/module/shadow_all.rb +0 -17
  304. data/lib/facet/module/shadow_method.rb +0 -42
  305. data/lib/facet/module/sort_on.rb +0 -73
  306. data/lib/facet/module/undef.rb +0 -29
  307. data/lib/facet/module/wrap.rb +0 -30
  308. data/lib/facet/module/wrap_method.rb +0 -48
  309. data/lib/facet/nilclass.rb +0 -7
  310. data/lib/facet/nilclass/empty.rb +0 -32
  311. data/lib/facet/nilclass/include.rb +0 -32
  312. data/lib/facet/nilclass/length.rb +0 -2
  313. data/lib/facet/nilclass/op_fetch.rb +0 -37
  314. data/lib/facet/nilclass/size.rb +0 -44
  315. data/lib/facet/nilclass/to_f.rb +0 -32
  316. data/lib/facet/nilclass/to_h.rb +0 -33
  317. data/lib/facet/numeric.rb +0 -5
  318. data/lib/facet/numeric/ceil_multiple.rb +0 -40
  319. data/lib/facet/numeric/pred.rb +0 -2
  320. data/lib/facet/numeric/succ.rb +0 -69
  321. data/lib/facet/numeric/to_b.rb +0 -38
  322. data/lib/facet/ostruct.rb +0 -0
  323. data/lib/facet/ostruct/__merge__.rb +0 -52
  324. data/lib/facet/ostruct/__table__.rb +0 -17
  325. data/lib/facet/ostruct/__update__.rb +0 -45
  326. data/lib/facet/ostruct/op_fetch.rb +0 -40
  327. data/lib/facet/ostruct/op_store.rb +0 -42
  328. data/lib/facet/ostruct/to_h.rb +0 -8
  329. data/lib/facet/pathname.rb +0 -2
  330. data/lib/facet/pathname/ascend.rb +0 -22
  331. data/lib/facet/pathname/descend.rb +0 -20
  332. data/lib/facet/proc.rb +0 -3
  333. data/lib/facet/proc/compose.rb +0 -62
  334. data/lib/facet/proc/op_mul.rb +0 -2
  335. data/lib/facet/proc/to_method.rb +0 -74
  336. data/lib/facet/range.rb +0 -4
  337. data/lib/facet/range/to_r.rb +0 -32
  338. data/lib/facet/range/to_range.rb +0 -36
  339. data/lib/facet/range/umbrella.rb +0 -67
  340. data/lib/facet/range/within.rb +0 -44
  341. data/lib/facet/regexp.rb +0 -3
  342. data/lib/facet/regexp/arity.rb +0 -41
  343. data/lib/facet/regexp/to_re.rb +0 -38
  344. data/lib/facet/regexp/to_regexp.rb +0 -36
  345. data/lib/facet/string.rb +0 -86
  346. data/lib/facet/string/align_center.rb +0 -87
  347. data/lib/facet/string/align_left.rb +0 -2
  348. data/lib/facet/string/align_right.rb +0 -2
  349. data/lib/facet/string/at.rb +0 -8
  350. data/lib/facet/string/at_rand.rb +0 -65
  351. data/lib/facet/string/basename.rb +0 -48
  352. data/lib/facet/string/blank.rb +0 -36
  353. data/lib/facet/string/bracket.rb +0 -70
  354. data/lib/facet/string/brief.rb +0 -33
  355. data/lib/facet/string/bytes.rb +0 -19
  356. data/lib/facet/string/camelcase.rb +0 -58
  357. data/lib/facet/string/camelize.rb +0 -35
  358. data/lib/facet/string/capitalized.rb +0 -38
  359. data/lib/facet/string/chars.rb +0 -34
  360. data/lib/facet/string/cmp.rb +0 -43
  361. data/lib/facet/string/demodulize.rb +0 -40
  362. data/lib/facet/string/dequote.rb +0 -29
  363. data/lib/facet/string/downcase.rb +0 -37
  364. data/lib/facet/string/dresner.rb +0 -49
  365. data/lib/facet/string/each_char.rb +0 -35
  366. data/lib/facet/string/each_word.rb +0 -50
  367. data/lib/facet/string/ends_with.rb +0 -2
  368. data/lib/facet/string/first.rb +0 -94
  369. data/lib/facet/string/first_char.rb +0 -20
  370. data/lib/facet/string/fold.rb +0 -67
  371. data/lib/facet/string/format.rb +0 -17
  372. data/lib/facet/string/frequency.rb +0 -39
  373. data/lib/facet/string/humanize.rb +0 -31
  374. data/lib/facet/string/indent.rb +0 -68
  375. data/lib/facet/string/index_all.rb +0 -40
  376. data/lib/facet/string/last.rb +0 -94
  377. data/lib/facet/string/last_char.rb +0 -22
  378. data/lib/facet/string/line_wrap.rb +0 -77
  379. data/lib/facet/string/lines.rb +0 -33
  380. data/lib/facet/string/lowercase.rb +0 -32
  381. data/lib/facet/string/margin.rb +0 -138
  382. data/lib/facet/string/mscan.rb +0 -42
  383. data/lib/facet/string/natcmp.rb +0 -108
  384. data/lib/facet/string/nchar.rb +0 -45
  385. data/lib/facet/string/ordinal.rb +0 -16
  386. data/lib/facet/string/plural.rb +0 -2
  387. data/lib/facet/string/pop.rb +0 -54
  388. data/lib/facet/string/probability.rb +0 -34
  389. data/lib/facet/string/pull.rb +0 -17
  390. data/lib/facet/string/push.rb +0 -44
  391. data/lib/facet/string/quote.rb +0 -68
  392. data/lib/facet/string/rand_byte.rb +0 -55
  393. data/lib/facet/string/rand_index.rb +0 -29
  394. data/lib/facet/string/range.rb +0 -37
  395. data/lib/facet/string/range_all.rb +0 -48
  396. data/lib/facet/string/range_of_line.rb +0 -42
  397. data/lib/facet/string/regesc.rb +0 -32
  398. data/lib/facet/string/self/format.rb +0 -17
  399. data/lib/facet/string/self/interpolate.rb +0 -31
  400. data/lib/facet/string/self/patterns.rb +0 -51
  401. data/lib/facet/string/self/rand_letter.rb +0 -34
  402. data/lib/facet/string/self/random.rb +0 -36
  403. data/lib/facet/string/shatter.rb +0 -45
  404. data/lib/facet/string/shift.rb +0 -42
  405. data/lib/facet/string/shuffle.rb +0 -42
  406. data/lib/facet/string/similarity.rb +0 -108
  407. data/lib/facet/string/singular.rb +0 -117
  408. data/lib/facet/string/slap.rb +0 -44
  409. data/lib/facet/string/soundex.rb +0 -102
  410. data/lib/facet/string/starts_with.rb +0 -24
  411. data/lib/facet/string/succ.rb +0 -38
  412. data/lib/facet/string/tab.rb +0 -2
  413. data/lib/facet/string/tabto.rb +0 -2
  414. data/lib/facet/string/to_a.rb +0 -35
  415. data/lib/facet/string/to_arr.rb +0 -55
  416. data/lib/facet/string/to_b.rb +0 -64
  417. data/lib/facet/string/to_const.rb +0 -39
  418. data/lib/facet/string/to_date.rb +0 -35
  419. data/lib/facet/string/to_proc.rb +0 -54
  420. data/lib/facet/string/to_re.rb +0 -46
  421. data/lib/facet/string/to_rx.rb +0 -2
  422. data/lib/facet/string/to_time.rb +0 -34
  423. data/lib/facet/string/unbracket.rb +0 -46
  424. data/lib/facet/string/underscore.rb +0 -18
  425. data/lib/facet/string/unix_crypt.rb +0 -41
  426. data/lib/facet/string/unpack.rb +0 -45
  427. data/lib/facet/string/unshift.rb +0 -42
  428. data/lib/facet/string/upcase.rb +0 -45
  429. data/lib/facet/string/uppercase.rb +0 -2
  430. data/lib/facet/string/whitespace.rb +0 -27
  431. data/lib/facet/string/word_filter.rb +0 -61
  432. data/lib/facet/string/word_wrap.rb +0 -90
  433. data/lib/facet/string/words.rb +0 -45
  434. data/lib/facet/symbol.rb +0 -13
  435. data/lib/facet/symbol/camelcase.rb +0 -42
  436. data/lib/facet/symbol/camelize.rb +0 -33
  437. data/lib/facet/symbol/capitalize.rb +0 -31
  438. data/lib/facet/symbol/capitalized.rb +0 -33
  439. data/lib/facet/symbol/downcase.rb +0 -36
  440. data/lib/facet/symbol/not.rb +0 -40
  441. data/lib/facet/symbol/pad.rb +0 -43
  442. data/lib/facet/symbol/succ.rb +0 -42
  443. data/lib/facet/symbol/to_const.rb +0 -40
  444. data/lib/facet/symbol/to_proc.rb +0 -45
  445. data/lib/facet/symbol/to_str.rb +0 -39
  446. data/lib/facet/symbol/underscore.rb +0 -32
  447. data/lib/facet/symbol/upcase.rb +0 -37
  448. data/lib/facet/time.rb +0 -7
  449. data/lib/facet/time/change.rb +0 -51
  450. data/lib/facet/time/elapse.rb +0 -41
  451. data/lib/facet/time/self/days_extrema.rb +0 -22
  452. data/lib/facet/time/stamp.rb +0 -47
  453. data/lib/facet/time/to_date.rb +0 -37
  454. data/lib/facet/time/to_s.rb +0 -33
  455. data/lib/facet/time/to_time.rb +0 -36
  456. data/lib/facet/unboundmethod.rb +0 -1
  457. data/lib/facet/unboundmethod/name.rb +0 -8
  458. data/lib/facets.rb +0 -200
  459. data/lib/facets/english/bytes.rb +0 -212
  460. data/lib/facets/english/multipliers.rb +0 -192
  461. data/lib/facets/english/ormsupport.rb +0 -233
  462. data/lib/facets/english/time.rb +0 -327
  463. data/lib/facets/group/inflect.rb +0 -71
  464. data/lib/facets/group/nilasemptiness.rb +0 -34
  465. data/lib/facets/group/random.rb +0 -21
  466. data/lib/facets/group/stringasarray.rb +0 -16
  467. data/lib/facets/method/README +0 -1
  468. data/lib/facets/support/functor.rb +0 -49
  469. data/setup.rb +0 -1551
  470. data/test/FIXTURE/create_file +0 -1
  471. data/test/FIXTURE/filelist/testfile.txt +0 -0
  472. data/test/FIXTURE/filelist/testfile2.txt +0 -0
  473. data/test/FIXTURE/ls_r/A.txt +0 -0
  474. data/test/FIXTURE/ls_r/A/B.txt +0 -0
  475. data/test/FIXTURE/ls_r/A/B/C.txt +0 -0
  476. data/test/FIXTURE/open_as_string_file +0 -1
  477. data/test/FIXTURE/read_list_file +0 -6
  478. data/test/FIXTURE/test_file.txt +0 -25
  479. data/test/FIXTURE/test_file2.txt +0 -25
  480. data/test/lib/facet/array/test_at_rand.rb +0 -34
  481. data/test/lib/facet/array/test_delete_unless.rb +0 -28
  482. data/test/lib/facet/array/test_delete_values.rb +0 -28
  483. data/test/lib/facet/array/test_delete_values_at.rb +0 -31
  484. data/test/lib/facet/array/test_first.rb +0 -46
  485. data/test/lib/facet/array/test_head.rb +0 -42
  486. data/test/lib/facet/array/test_last_index.rb +0 -26
  487. data/test/lib/facet/array/test_merge.rb +0 -35
  488. data/test/lib/facet/array/test_mid.rb +0 -33
  489. data/test/lib/facet/array/test_middle.rb +0 -29
  490. data/test/lib/facet/array/test_op_fetch.rb +0 -27
  491. data/test/lib/facet/array/test_op_store.rb +0 -30
  492. data/test/lib/facet/array/test_pick.rb +0 -40
  493. data/test/lib/facet/array/test_pos.rb +0 -28
  494. data/test/lib/facet/array/test_pull.rb +0 -28
  495. data/test/lib/facet/array/test_rand_index.rb +0 -29
  496. data/test/lib/facet/array/test_rand_subset.rb +0 -29
  497. data/test/lib/facet/array/test_range.rb +0 -32
  498. data/test/lib/facet/array/test_rotate.rb +0 -36
  499. data/test/lib/facet/array/test_select.rb +0 -28
  500. data/test/lib/facet/array/test_shuffle.rb +0 -35
  501. data/test/lib/facet/array/test_slap.rb +0 -28
  502. data/test/lib/facet/array/test_thru.rb +0 -27
  503. data/test/lib/facet/array/test_to_b.rb +0 -27
  504. data/test/lib/facet/array/test_to_h.rb +0 -33
  505. data/test/lib/facet/array/test_to_hash.rb +0 -27
  506. data/test/lib/facet/binding/self/test_of_caller.rb +0 -35
  507. data/test/lib/facet/binding/test___LINE__.rb +0 -43
  508. data/test/lib/facet/binding/test_call_stack.rb +0 -34
  509. data/test/lib/facet/binding/test_called.rb +0 -30
  510. data/test/lib/facet/binding/test_caller.rb +0 -35
  511. data/test/lib/facet/binding/test_defined.rb +0 -34
  512. data/test/lib/facet/binding/test_eval.rb +0 -34
  513. data/test/lib/facet/binding/test_local_variables.rb +0 -34
  514. data/test/lib/facet/binding/test_method_name.rb +0 -34
  515. data/test/lib/facet/binding/test_op_fetch.rb +0 -34
  516. data/test/lib/facet/binding/test_op_store.rb +0 -35
  517. data/test/lib/facet/binding/test_self.rb +0 -34
  518. data/test/lib/facet/class/test_descendents.rb +0 -30
  519. data/test/lib/facet/class/test_remove_descendents.rb +0 -32
  520. data/test/lib/facet/comparable/test_at_least.rb +0 -34
  521. data/test/lib/facet/comparable/test_clip.rb +0 -44
  522. data/test/lib/facet/comparable/test_cmp.rb +0 -28
  523. data/test/lib/facet/continuation/self/test_create.rb +0 -26
  524. data/test/lib/facet/date/test_days_in_month.rb +0 -30
  525. data/test/lib/facet/date/test_days_of_month.rb +0 -30
  526. data/test/lib/facet/date/test_stamp.rb +0 -38
  527. data/test/lib/facet/date/test_to_date.rb +0 -30
  528. data/test/lib/facet/date/test_to_s.rb +0 -30
  529. data/test/lib/facet/date/test_to_time.rb +0 -30
  530. data/test/lib/facet/dir/self/test_ancestor.rb +0 -26
  531. data/test/lib/facet/dir/self/test_ascend.rb +0 -41
  532. data/test/lib/facet/dir/self/test_ls_r.rb +0 -52
  533. data/test/lib/facet/enumerable/self/test_combinations.rb +0 -43
  534. data/test/lib/facet/enumerable/self/test_cross.rb +0 -31
  535. data/test/lib/facet/enumerable/test_collect_with_index.rb +0 -27
  536. data/test/lib/facet/enumerable/test_commonality.rb +0 -31
  537. data/test/lib/facet/enumerable/test_compact_collect.rb +0 -27
  538. data/test/lib/facet/enumerable/test_cross.rb +0 -30
  539. data/test/lib/facet/enumerable/test_each_combination.rb +0 -29
  540. data/test/lib/facet/enumerable/test_each_pair.rb +0 -29
  541. data/test/lib/facet/enumerable/test_each_slice.rb +0 -74
  542. data/test/lib/facet/enumerable/test_each_unique_pair.rb +0 -29
  543. data/test/lib/facet/enumerable/test_entropy.rb +0 -26
  544. data/test/lib/facet/enumerable/test_every.rb +0 -35
  545. data/test/lib/facet/enumerable/test_ew.rb +0 -31
  546. data/test/lib/facet/enumerable/test_filter_collect.rb +0 -31
  547. data/test/lib/facet/enumerable/test_find_collisions.rb +0 -30
  548. data/test/lib/facet/enumerable/test_frequency.rb +0 -27
  549. data/test/lib/facet/enumerable/test_graph.rb +0 -30
  550. data/test/lib/facet/enumerable/test_ideal_entropy.rb +0 -27
  551. data/test/lib/facet/enumerable/test_none.rb +0 -33
  552. data/test/lib/facet/enumerable/test_occur.rb +0 -30
  553. data/test/lib/facet/enumerable/test_one.rb +0 -35
  554. data/test/lib/facet/enumerable/test_op_pow.rb +0 -27
  555. data/test/lib/facet/enumerable/test_partition_by.rb +0 -31
  556. data/test/lib/facet/enumerable/test_permute.rb +0 -29
  557. data/test/lib/facet/enumerable/test_probability.rb +0 -27
  558. data/test/lib/facet/enumerable/test_to_h.rb +0 -27
  559. data/test/lib/facet/enumerable/test_uniq_by.rb +0 -28
  560. data/test/lib/facet/file/self/test_create.rb +0 -39
  561. data/test/lib/facet/file/self/test_open_as_string.rb +0 -40
  562. data/test/lib/facet/file/self/test_read_list.rb +0 -37
  563. data/test/lib/facet/file/self/test_sanitize.rb +0 -46
  564. data/test/lib/facet/file/self/test_split_all.rb +0 -27
  565. data/test/lib/facet/fileutils/test_slice.rb +0 -96
  566. data/test/lib/facet/fileutils/test_wc.rb +0 -68
  567. data/test/lib/facet/fileutils/test_which.rb +0 -61
  568. data/test/lib/facet/float/test_approx.rb +0 -28
  569. data/test/lib/facet/float/test_round_at.rb +0 -46
  570. data/test/lib/facet/float/test_round_to.rb +0 -46
  571. data/test/lib/facet/hash/self/test_zipnew.rb +0 -28
  572. data/test/lib/facet/hash/test_alias.rb +0 -31
  573. data/test/lib/facet/hash/test_assert_has_keys.rb +0 -27
  574. data/test/lib/facet/hash/test_assert_has_only_keys.rb +0 -27
  575. data/test/lib/facet/hash/test_at.rb +0 -28
  576. data/test/lib/facet/hash/test_collate.rb +0 -35
  577. data/test/lib/facet/hash/test_each.rb +0 -36
  578. data/test/lib/facet/hash/test_each_with_index.rb +0 -29
  579. data/test/lib/facet/hash/test_each_with_key.rb +0 -29
  580. data/test/lib/facet/hash/test_graph.rb +0 -28
  581. data/test/lib/facet/hash/test_has_keys.rb +0 -27
  582. data/test/lib/facet/hash/test_has_only_keys.rb +0 -27
  583. data/test/lib/facet/hash/test_inverse.rb +0 -28
  584. data/test/lib/facet/hash/test_keys_to_s.rb +0 -34
  585. data/test/lib/facet/hash/test_keys_to_sym.rb +0 -34
  586. data/test/lib/facet/hash/test_op_fetch.rb +0 -111
  587. data/test/lib/facet/hash/test_op_lshift.rb +0 -29
  588. data/test/lib/facet/hash/test_rand_key.rb +0 -27
  589. data/test/lib/facet/hash/test_rand_pair.rb +0 -27
  590. data/test/lib/facet/hash/test_rand_value.rb +0 -27
  591. data/test/lib/facet/hash/test_replace_each.rb +0 -29
  592. data/test/lib/facet/hash/test_shuffle.rb +0 -32
  593. data/test/lib/facet/hash/test_slice.rb +0 -27
  594. data/test/lib/facet/hash/test_swap.rb +0 -27
  595. data/test/lib/facet/hash/test_swapkey.rb +0 -29
  596. data/test/lib/facet/hash/test_to_h.rb +0 -27
  597. data/test/lib/facet/hash/test_to_ostruct.rb +0 -30
  598. data/test/lib/facet/hash/test_to_ostruct_recurse.rb +0 -30
  599. data/test/lib/facet/hash/test_traverse.rb +0 -37
  600. data/test/lib/facet/hash/test_update_each.rb +0 -29
  601. data/test/lib/facet/hash/test_update_keys.rb +0 -28
  602. data/test/lib/facet/hash/test_update_values.rb +0 -28
  603. data/test/lib/facet/hash/test_weave.rb +0 -29
  604. data/test/lib/facet/integer/test_factorial.rb +0 -30
  605. data/test/lib/facet/integer/test_multiple.rb +0 -43
  606. data/test/lib/facet/integer/test_ordinal.rb +0 -29
  607. data/test/lib/facet/integer/test_times_collect.rb +0 -28
  608. data/test/lib/facet/kernel/test___class__.rb +0 -26
  609. data/test/lib/facet/kernel/test_as.rb +0 -42
  610. data/test/lib/facet/kernel/test_assign_from.rb +0 -31
  611. data/test/lib/facet/kernel/test_assign_with.rb +0 -31
  612. data/test/lib/facet/kernel/test_bool.rb +0 -41
  613. data/test/lib/facet/kernel/test_bug.rb +0 -26
  614. data/test/lib/facet/kernel/test_call_stack.rb +0 -26
  615. data/test/lib/facet/kernel/test_called.rb +0 -26
  616. data/test/lib/facet/kernel/test_constant.rb +0 -33
  617. data/test/lib/facet/kernel/test_copy.rb +0 -40
  618. data/test/lib/facet/kernel/test_deep_copy.rb +0 -40
  619. data/test/lib/facet/kernel/test_demo.rb +0 -28
  620. data/test/lib/facet/kernel/test_fn.rb +0 -26
  621. data/test/lib/facet/kernel/test_generate_method_name.rb +0 -26
  622. data/test/lib/facet/kernel/test_get_by_id.rb +0 -28
  623. data/test/lib/facet/kernel/test_here.rb +0 -26
  624. data/test/lib/facet/kernel/test_in.rb +0 -27
  625. data/test/lib/facet/kernel/test_maybe.rb +0 -26
  626. data/test/lib/facet/kernel/test_metaclass.rb +0 -34
  627. data/test/lib/facet/kernel/test_method.rb +0 -32
  628. data/test/lib/facet/kernel/test_method_name.rb +0 -31
  629. data/test/lib/facet/kernel/test_methods.rb +0 -50
  630. data/test/lib/facet/kernel/test_new.rb +0 -30
  631. data/test/lib/facet/kernel/test_object_class.rb +0 -26
  632. data/test/lib/facet/kernel/test_object_hexid.rb +0 -27
  633. data/test/lib/facet/kernel/test_require_all.rb +0 -26
  634. data/test/lib/facet/kernel/test_require_esc.rb +0 -27
  635. data/test/lib/facet/kernel/test_require_facet.rb +0 -27
  636. data/test/lib/facet/kernel/test_resc.rb +0 -27
  637. data/test/lib/facet/kernel/test_returning.rb +0 -30
  638. data/test/lib/facet/kernel/test_send_as.rb +0 -26
  639. data/test/lib/facet/kernel/test_set_from.rb +0 -33
  640. data/test/lib/facet/kernel/test_set_with.rb +0 -33
  641. data/test/lib/facet/kernel/test_silently.rb +0 -28
  642. data/test/lib/facet/kernel/test_singleton.rb +0 -40
  643. data/test/lib/facet/kernel/test_superior.rb +0 -30
  644. data/test/lib/facet/kernel/test_supermethod.rb +0 -33
  645. data/test/lib/facet/kernel/test_this.rb +0 -26
  646. data/test/lib/facet/kernel/test_to_b.rb +0 -28
  647. data/test/lib/facet/kernel/test_to_bool.rb +0 -28
  648. data/test/lib/facet/kernel/test_uri.rb +0 -30
  649. data/test/lib/facet/kernel/test_val.rb +0 -43
  650. data/test/lib/facet/kernel/test_with_accessor.rb +0 -51
  651. data/test/lib/facet/matchdata/test_match.rb +0 -29
  652. data/test/lib/facet/matchdata/test_matchtree.rb +0 -32
  653. data/test/lib/facet/module/test_abstract.rb +0 -36
  654. data/test/lib/facet/module/test_alias_module_function.rb +0 -34
  655. data/test/lib/facet/module/test_ancestor.rb +0 -26
  656. data/test/lib/facet/module/test_basename.rb +0 -26
  657. data/test/lib/facet/module/test_by_name.rb +0 -29
  658. data/test/lib/facet/module/test_cattr_accessor.rb +0 -55
  659. data/test/lib/facet/module/test_clone_using.rb +0 -55
  660. data/test/lib/facet/module/test_dirname.rb +0 -26
  661. data/test/lib/facet/module/test_equate_on.rb +0 -37
  662. data/test/lib/facet/module/test_generate_instance_method_name.rb +0 -33
  663. data/test/lib/facet/module/test_include_as.rb +0 -35
  664. data/test/lib/facet/module/test_initializer.rb +0 -32
  665. data/test/lib/facet/module/test_instance_methods.rb +0 -59
  666. data/test/lib/facet/module/test_integrate.rb +0 -35
  667. data/test/lib/facet/module/test_memoize.rb +0 -50
  668. data/test/lib/facet/module/test_modspace.rb +0 -27
  669. data/test/lib/facet/module/test_namespace.rb +0 -33
  670. data/test/lib/facet/module/test_nesting.rb +0 -36
  671. data/test/lib/facet/module/test_redef.rb +0 -30
  672. data/test/lib/facet/module/test_redefine_method.rb +0 -30
  673. data/test/lib/facet/module/test_redirect.rb +0 -30
  674. data/test/lib/facet/module/test_redirect_method.rb +0 -30
  675. data/test/lib/facet/module/test_remove.rb +0 -30
  676. data/test/lib/facet/module/test_rename.rb +0 -31
  677. data/test/lib/facet/module/test_rename_method.rb +0 -31
  678. data/test/lib/facet/module/test_revisal.rb +0 -35
  679. data/test/lib/facet/module/test_shadow_method.rb +0 -30
  680. data/test/lib/facet/module/test_sort_on.rb +0 -42
  681. data/test/lib/facet/module/test_undef.rb +0 -30
  682. data/test/lib/facet/module/test_wrap.rb +0 -30
  683. data/test/lib/facet/module/test_wrap_method.rb +0 -30
  684. data/test/lib/facet/nilclass/test_empty.rb +0 -26
  685. data/test/lib/facet/nilclass/test_include.rb +0 -26
  686. data/test/lib/facet/nilclass/test_op_fetch.rb +0 -28
  687. data/test/lib/facet/nilclass/test_size.rb +0 -30
  688. data/test/lib/facet/nilclass/test_to_f.rb +0 -26
  689. data/test/lib/facet/nilclass/test_to_h.rb +0 -26
  690. data/test/lib/facet/numeric/test_ceil_multiple.rb +0 -31
  691. data/test/lib/facet/numeric/test_succ.rb +0 -40
  692. data/test/lib/facet/numeric/test_to_b.rb +0 -27
  693. data/test/lib/facet/ostruct/test___merge__.rb +0 -38
  694. data/test/lib/facet/ostruct/test___update__.rb +0 -29
  695. data/test/lib/facet/ostruct/test_op_fetch.rb +0 -27
  696. data/test/lib/facet/ostruct/test_op_store.rb +0 -28
  697. data/test/lib/facet/proc/test_compose.rb +0 -36
  698. data/test/lib/facet/proc/test_to_method.rb +0 -31
  699. data/test/lib/facet/range/test_to_r.rb +0 -27
  700. data/test/lib/facet/range/test_to_range.rb +0 -27
  701. data/test/lib/facet/range/test_umbrella.rb +0 -34
  702. data/test/lib/facet/range/test_within.rb +0 -29
  703. data/test/lib/facet/regexp/test_arity.rb +0 -33
  704. data/test/lib/facet/regexp/test_to_re.rb +0 -27
  705. data/test/lib/facet/regexp/test_to_regexp.rb +0 -27
  706. data/test/lib/facet/string/self/test_interpolate.rb +0 -27
  707. data/test/lib/facet/string/self/test_patterns.rb +0 -28
  708. data/test/lib/facet/string/self/test_rand_letter.rb +0 -26
  709. data/test/lib/facet/string/test_align_center.rb +0 -34
  710. data/test/lib/facet/string/test_at_rand.rb +0 -35
  711. data/test/lib/facet/string/test_basename.rb +0 -41
  712. data/test/lib/facet/string/test_blank.rb +0 -27
  713. data/test/lib/facet/string/test_bracket.rb +0 -49
  714. data/test/lib/facet/string/test_camelcase.rb +0 -39
  715. data/test/lib/facet/string/test_camelize.rb +0 -26
  716. data/test/lib/facet/string/test_capitalized.rb +0 -26
  717. data/test/lib/facet/string/test_chars.rb +0 -27
  718. data/test/lib/facet/string/test_cmp.rb +0 -30
  719. data/test/lib/facet/string/test_demodulize.rb +0 -38
  720. data/test/lib/facet/string/test_downcase.rb +0 -26
  721. data/test/lib/facet/string/test_dresner.rb +0 -32
  722. data/test/lib/facet/string/test_each_char.rb +0 -29
  723. data/test/lib/facet/string/test_each_word.rb +0 -29
  724. data/test/lib/facet/string/test_first.rb +0 -43
  725. data/test/lib/facet/string/test_fold.rb +0 -34
  726. data/test/lib/facet/string/test_frequency.rb +0 -28
  727. data/test/lib/facet/string/test_humanize.rb +0 -26
  728. data/test/lib/facet/string/test_indent.rb +0 -40
  729. data/test/lib/facet/string/test_index_all.rb +0 -26
  730. data/test/lib/facet/string/test_last.rb +0 -46
  731. data/test/lib/facet/string/test_line_wrap.rb +0 -27
  732. data/test/lib/facet/string/test_lines.rb +0 -26
  733. data/test/lib/facet/string/test_lowercase.rb +0 -26
  734. data/test/lib/facet/string/test_margin.rb +0 -117
  735. data/test/lib/facet/string/test_mscan.rb +0 -30
  736. data/test/lib/facet/string/test_natcmp.rb +0 -30
  737. data/test/lib/facet/string/test_nchar.rb +0 -29
  738. data/test/lib/facet/string/test_pop.rb +0 -47
  739. data/test/lib/facet/string/test_probability.rb +0 -28
  740. data/test/lib/facet/string/test_push.rb +0 -40
  741. data/test/lib/facet/string/test_quote.rb +0 -49
  742. data/test/lib/facet/string/test_rand_byte.rb +0 -35
  743. data/test/lib/facet/string/test_rand_index.rb +0 -26
  744. data/test/lib/facet/string/test_range.rb +0 -27
  745. data/test/lib/facet/string/test_range_all.rb +0 -27
  746. data/test/lib/facet/string/test_range_of_line.rb +0 -28
  747. data/test/lib/facet/string/test_regesc.rb +0 -28
  748. data/test/lib/facet/string/test_shatter.rb +0 -29
  749. data/test/lib/facet/string/test_shift.rb +0 -40
  750. data/test/lib/facet/string/test_shuffle.rb +0 -27
  751. data/test/lib/facet/string/test_similarity.rb +0 -26
  752. data/test/lib/facet/string/test_singular.rb +0 -32
  753. data/test/lib/facet/string/test_slap.rb +0 -40
  754. data/test/lib/facet/string/test_soundex.rb +0 -41
  755. data/test/lib/facet/string/test_succ.rb +0 -29
  756. data/test/lib/facet/string/test_to_a.rb +0 -27
  757. data/test/lib/facet/string/test_to_arr.rb +0 -26
  758. data/test/lib/facet/string/test_to_b.rb +0 -41
  759. data/test/lib/facet/string/test_to_const.rb +0 -28
  760. data/test/lib/facet/string/test_to_date.rb +0 -30
  761. data/test/lib/facet/string/test_to_proc.rb +0 -33
  762. data/test/lib/facet/string/test_to_re.rb +0 -28
  763. data/test/lib/facet/string/test_to_time.rb +0 -30
  764. data/test/lib/facet/string/test_unix_crypt.rb +0 -30
  765. data/test/lib/facet/string/test_unpack.rb +0 -34
  766. data/test/lib/facet/string/test_unshift.rb +0 -39
  767. data/test/lib/facet/string/test_upcase.rb +0 -30
  768. data/test/lib/facet/string/test_whitespace.rb +0 -27
  769. data/test/lib/facet/string/test_word_filter.rb +0 -34
  770. data/test/lib/facet/string/test_word_wrap.rb +0 -51
  771. data/test/lib/facet/string/test_words.rb +0 -37
  772. data/test/lib/facet/symbol/test_camelcase.rb +0 -26
  773. data/test/lib/facet/symbol/test_camelize.rb +0 -27
  774. data/test/lib/facet/symbol/test_capitalize.rb +0 -26
  775. data/test/lib/facet/symbol/test_capitalized.rb +0 -27
  776. data/test/lib/facet/symbol/test_downcase.rb +0 -27
  777. data/test/lib/facet/symbol/test_not.rb +0 -29
  778. data/test/lib/facet/symbol/test_pad.rb +0 -27
  779. data/test/lib/facet/symbol/test_succ.rb +0 -28
  780. data/test/lib/facet/symbol/test_to_const.rb +0 -28
  781. data/test/lib/facet/symbol/test_to_proc.rb +0 -27
  782. data/test/lib/facet/symbol/test_to_str.rb +0 -28
  783. data/test/lib/facet/symbol/test_underscore.rb +0 -26
  784. data/test/lib/facet/symbol/test_upcase.rb +0 -27
  785. data/test/lib/facet/time/test_change.rb +0 -33
  786. data/test/lib/facet/time/test_elapse.rb +0 -27
  787. data/test/lib/facet/time/test_stamp.rb +0 -31
  788. data/test/lib/facet/time/test_to_date.rb +0 -31
  789. data/test/lib/facet/time/test_to_s.rb +0 -31
  790. data/test/lib/facet/time/test_to_time.rb +0 -31
  791. data/test/lib/facets/english/test_bytes.rb +0 -84
  792. data/test/lib/facets/english/test_multipliers.rb +0 -114
  793. data/test/lib/facets/english/test_time.rb +0 -73
  794. data/test/testdir.rb +0 -8
@@ -1,16 +0,0 @@
1
-
2
- # :title: String as Character Array
3
- #
4
- # The ideas here is to have string be polymorphic
5
- # as an array of characters. While not 100%
6
- # it is nearly so (getting there).
7
- #
8
- # "123".pop # => "12"
9
- #
10
-
11
- require 'string/at'
12
- require 'string/pop'
13
- require 'string/push'
14
- require 'string/shift'
15
- require 'string/unshift' # I hate this name
16
- require 'string/slap' # alias for it (better name?)
@@ -1 +0,0 @@
1
- If we can ever get a generic form of lib dir grouping then the method should go here.
@@ -1,49 +0,0 @@
1
-
2
- begin
3
-
4
- require 'calibre/functor.rb'
5
-
6
- rescue LoadError
7
-
8
- # Functor class provides a way to do psuedo-namspaces
9
- # This is useful for a number of methods.
10
- # This is basically the class in Calibre but is included
11
- # here to remove dependency.
12
-
13
- class Functor
14
-
15
- # remove all non-essential methods
16
- EXCLUDE = /^(__|instance|null$|inspect$|dup$)/
17
- class << self
18
- def hide(name)
19
- if method_defined?(name) and name !~ EXCLUDE
20
- undef_method( name )
21
- end
22
- end
23
- end
24
- instance_methods.each { |m| hide(m) }
25
-
26
- # primary functionality
27
- def initialize(*obj, &func)
28
- @obj = obj
29
- @func = func
30
- end
31
-
32
- def method_missing(op, *args)
33
- if @obj.empty?
34
- @func.call(op, *args)
35
- else
36
- @func.call(op, *(@obj + args))
37
- end
38
- end
39
-
40
- # prevent new methods from being added
41
- class << self
42
- def method_added( name )
43
- hide( name )
44
- end
45
- end
46
-
47
- end
48
-
49
- end
data/setup.rb DELETED
@@ -1,1551 +0,0 @@
1
- #
2
- # setup.rb
3
- #
4
- # Copyright (c) 2000-2005 Minero Aoki
5
- #
6
- # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- #
10
-
11
- unless Enumerable.method_defined?(:map) # Ruby 1.4.6
12
- module Enumerable
13
- alias map collect
14
- end
15
- end
16
-
17
- unless File.respond_to?(:read) # Ruby 1.6
18
- def File.read(fname)
19
- open(fname) {|f|
20
- return f.read
21
- }
22
- end
23
- end
24
-
25
- unless Errno.const_defined?(:ENOTEMPTY) # Windows?
26
- module Errno
27
- class ENOTEMPTY
28
- # We do not raise this exception, implementation is not needed.
29
- end
30
- end
31
- end
32
-
33
- def File.binread(fname)
34
- open(fname, 'rb') {|f|
35
- return f.read
36
- }
37
- end
38
-
39
- # for corrupted Windows' stat(2)
40
- def File.dir?(path)
41
- File.directory?((path[-1,1] == '/') ? path : path + '/')
42
- end
43
-
44
-
45
- class ConfigTable
46
-
47
- include Enumerable
48
-
49
- def initialize(rbconfig)
50
- @rbconfig = rbconfig
51
- @items = []
52
- @table = {}
53
- # options
54
- @install_prefix = nil
55
- @config_opt = nil
56
- @verbose = true
57
- @no_harm = false
58
- @libsrc_pattern = '*.rb'
59
- end
60
-
61
- attr_accessor :install_prefix
62
- attr_accessor :config_opt
63
-
64
- attr_writer :verbose
65
-
66
- def verbose?
67
- @verbose
68
- end
69
-
70
- attr_writer :no_harm
71
-
72
- def no_harm?
73
- @no_harm
74
- end
75
-
76
- attr_accessor :libsrc_pattern
77
-
78
- def [](key)
79
- lookup(key).resolve(self)
80
- end
81
-
82
- def []=(key, val)
83
- lookup(key).set val
84
- end
85
-
86
- def names
87
- @items.map {|i| i.name }
88
- end
89
-
90
- def each(&block)
91
- @items.each(&block)
92
- end
93
-
94
- def key?(name)
95
- @table.key?(name)
96
- end
97
-
98
- def lookup(name)
99
- @table[name] or setup_rb_error "no such config item: #{name}"
100
- end
101
-
102
- def add(item)
103
- @items.push item
104
- @table[item.name] = item
105
- end
106
-
107
- def remove(name)
108
- item = lookup(name)
109
- @items.delete_if {|i| i.name == name }
110
- @table.delete_if {|name, i| i.name == name }
111
- item
112
- end
113
-
114
- def load_script(path, inst = nil)
115
- if File.file?(path)
116
- MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path
117
- end
118
- end
119
-
120
- def savefile
121
- '.config'
122
- end
123
-
124
- def load_savefile
125
- begin
126
- File.foreach(savefile()) do |line|
127
- k, v = *line.split(/=/, 2)
128
- self[k] = v.strip
129
- end
130
- rescue Errno::ENOENT
131
- setup_rb_error $!.message + "\n#{File.basename($0)} config first"
132
- end
133
- end
134
-
135
- def save
136
- @items.each {|i| i.value }
137
- File.open(savefile(), 'w') {|f|
138
- @items.each do |i|
139
- f.printf "%s=%s\n", i.name, i.value if i.value? and i.value
140
- end
141
- }
142
- end
143
-
144
- def load_standard_entries
145
- standard_entries(@rbconfig).each do |ent|
146
- add ent
147
- end
148
- end
149
-
150
- def standard_entries(rbconfig)
151
- c = rbconfig
152
-
153
- rubypath = c['bindir'] + '/' + c['ruby_install_name']
154
-
155
- major = c['MAJOR'].to_i
156
- minor = c['MINOR'].to_i
157
- teeny = c['TEENY'].to_i
158
- version = "#{major}.#{minor}"
159
-
160
- # ruby ver. >= 1.4.4?
161
- newpath_p = ((major >= 2) or
162
- ((major == 1) and
163
- ((minor >= 5) or
164
- ((minor == 4) and (teeny >= 4)))))
165
-
166
- if c['rubylibdir']
167
- # V > 1.6.3
168
- libruby = "#{c['prefix']}/lib/ruby"
169
- librubyver = c['rubylibdir']
170
- librubyverarch = c['archdir']
171
- siteruby = c['sitedir']
172
- siterubyver = c['sitelibdir']
173
- siterubyverarch = c['sitearchdir']
174
- elsif newpath_p
175
- # 1.4.4 <= V <= 1.6.3
176
- libruby = "#{c['prefix']}/lib/ruby"
177
- librubyver = "#{c['prefix']}/lib/ruby/#{version}"
178
- librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
179
- siteruby = c['sitedir']
180
- siterubyver = "$siteruby/#{version}"
181
- siterubyverarch = "$siterubyver/#{c['arch']}"
182
- else
183
- # V < 1.4.4
184
- libruby = "#{c['prefix']}/lib/ruby"
185
- librubyver = "#{c['prefix']}/lib/ruby/#{version}"
186
- librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}"
187
- siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby"
188
- siterubyver = siteruby
189
- siterubyverarch = "$siterubyver/#{c['arch']}"
190
- end
191
- parameterize = lambda {|path|
192
- path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
193
- }
194
-
195
- if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
196
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
197
- else
198
- makeprog = 'make'
199
- end
200
-
201
- [
202
- ExecItem.new('installdirs', 'std/site/home',
203
- 'std: install under libruby; site: install under site_ruby; home: install under $HOME')\
204
- {|val, table|
205
- case val
206
- when 'std'
207
- table['rbdir'] = '$librubyver'
208
- table['sodir'] = '$librubyverarch'
209
- when 'site'
210
- table['rbdir'] = '$siterubyver'
211
- table['sodir'] = '$siterubyverarch'
212
- when 'home'
213
- setup_rb_error '$HOME was not set' unless ENV['HOME']
214
- table['prefix'] = ENV['HOME']
215
- table['rbdir'] = '$libdir/ruby'
216
- table['sodir'] = '$libdir/ruby'
217
- end
218
- },
219
- PathItem.new('prefix', 'path', c['prefix'],
220
- 'path prefix of target environment'),
221
- PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
222
- 'the directory for commands'),
223
- PathItem.new('libdir', 'path', parameterize.call(c['libdir']),
224
- 'the directory for libraries'),
225
- PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
226
- 'the directory for shared data'),
227
- PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
228
- 'the directory for man pages'),
229
- PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
230
- 'the directory for system configuration files'),
231
- PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']),
232
- 'the directory for local state data'),
233
- PathItem.new('libruby', 'path', libruby,
234
- 'the directory for ruby libraries'),
235
- PathItem.new('librubyver', 'path', librubyver,
236
- 'the directory for standard ruby libraries'),
237
- PathItem.new('librubyverarch', 'path', librubyverarch,
238
- 'the directory for standard ruby extensions'),
239
- PathItem.new('siteruby', 'path', siteruby,
240
- 'the directory for version-independent aux ruby libraries'),
241
- PathItem.new('siterubyver', 'path', siterubyver,
242
- 'the directory for aux ruby libraries'),
243
- PathItem.new('siterubyverarch', 'path', siterubyverarch,
244
- 'the directory for aux ruby binaries'),
245
- PathItem.new('rbdir', 'path', '$siterubyver',
246
- 'the directory for ruby scripts'),
247
- PathItem.new('sodir', 'path', '$siterubyverarch',
248
- 'the directory for ruby extentions'),
249
- PathItem.new('rubypath', 'path', rubypath,
250
- 'the path to set to #! line'),
251
- ProgramItem.new('rubyprog', 'name', rubypath,
252
- 'the ruby program using for installation'),
253
- ProgramItem.new('makeprog', 'name', makeprog,
254
- 'the make program to compile ruby extentions'),
255
- SelectItem.new('shebang', 'all/ruby/never', 'ruby',
256
- 'shebang line (#!) editing mode'),
257
- BoolItem.new('without-ext', 'yes/no', 'no',
258
- 'does not compile/install ruby extentions')
259
- ]
260
- end
261
- private :standard_entries
262
-
263
- def load_multipackage_entries
264
- multipackage_entries().each do |ent|
265
- add ent
266
- end
267
- end
268
-
269
- def multipackage_entries
270
- [
271
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
272
- 'package names that you want to install'),
273
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
274
- 'package names that you do not want to install')
275
- ]
276
- end
277
- private :multipackage_entries
278
-
279
- ALIASES = {
280
- 'std-ruby' => 'librubyver',
281
- 'stdruby' => 'librubyver',
282
- 'rubylibdir' => 'librubyver',
283
- 'archdir' => 'librubyverarch',
284
- 'site-ruby-common' => 'siteruby', # For backward compatibility
285
- 'site-ruby' => 'siterubyver', # For backward compatibility
286
- 'bin-dir' => 'bindir',
287
- 'bin-dir' => 'bindir',
288
- 'rb-dir' => 'rbdir',
289
- 'so-dir' => 'sodir',
290
- 'data-dir' => 'datadir',
291
- 'ruby-path' => 'rubypath',
292
- 'ruby-prog' => 'rubyprog',
293
- 'ruby' => 'rubyprog',
294
- 'make-prog' => 'makeprog',
295
- 'make' => 'makeprog'
296
- }
297
-
298
- def fixup
299
- ALIASES.each do |ali, name|
300
- @table[ali] = @table[name]
301
- end
302
- @items.freeze
303
- @table.freeze
304
- @options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/
305
- end
306
-
307
- def parse_opt(opt)
308
- m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}"
309
- m.to_a[1,2]
310
- end
311
-
312
- def dllext
313
- @rbconfig['DLEXT']
314
- end
315
-
316
- def value_config?(name)
317
- lookup(name).value?
318
- end
319
-
320
- class Item
321
- def initialize(name, template, default, desc)
322
- @name = name.freeze
323
- @template = template
324
- @value = default
325
- @default = default
326
- @description = desc
327
- end
328
-
329
- attr_reader :name
330
- attr_reader :description
331
-
332
- attr_accessor :default
333
- alias help_default default
334
-
335
- def help_opt
336
- "--#{@name}=#{@template}"
337
- end
338
-
339
- def value?
340
- true
341
- end
342
-
343
- def value
344
- @value
345
- end
346
-
347
- def resolve(table)
348
- @value.gsub(%r<\$([^/]+)>) { table[$1] }
349
- end
350
-
351
- def set(val)
352
- @value = check(val)
353
- end
354
-
355
- private
356
-
357
- def check(val)
358
- setup_rb_error "config: --#{name} requires argument" unless val
359
- val
360
- end
361
- end
362
-
363
- class BoolItem < Item
364
- def config_type
365
- 'bool'
366
- end
367
-
368
- def help_opt
369
- "--#{@name}"
370
- end
371
-
372
- private
373
-
374
- def check(val)
375
- return 'yes' unless val
376
- unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
377
- setup_rb_error "config: --#{@name} accepts only yes/no for argument"
378
- end
379
- (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
380
- end
381
- end
382
-
383
- class PathItem < Item
384
- def config_type
385
- 'path'
386
- end
387
-
388
- private
389
-
390
- def check(path)
391
- setup_rb_error "config: --#{@name} requires argument" unless path
392
- path[0,1] == '$' ? path : File.expand_path(path)
393
- end
394
- end
395
-
396
- class ProgramItem < Item
397
- def config_type
398
- 'program'
399
- end
400
- end
401
-
402
- class SelectItem < Item
403
- def initialize(name, selection, default, desc)
404
- super
405
- @ok = selection.split('/')
406
- end
407
-
408
- def config_type
409
- 'select'
410
- end
411
-
412
- private
413
-
414
- def check(val)
415
- unless @ok.include?(val.strip)
416
- setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
417
- end
418
- val.strip
419
- end
420
- end
421
-
422
- class ExecItem < Item
423
- def initialize(name, selection, desc, &block)
424
- super name, selection, nil, desc
425
- @ok = selection.split('/')
426
- @action = block
427
- end
428
-
429
- def config_type
430
- 'exec'
431
- end
432
-
433
- def value?
434
- false
435
- end
436
-
437
- def resolve(table)
438
- setup_rb_error "$#{name()} wrongly used as option value"
439
- end
440
-
441
- undef set
442
-
443
- def evaluate(val, table)
444
- v = val.strip.downcase
445
- unless @ok.include?(v)
446
- setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})"
447
- end
448
- @action.call v, table
449
- end
450
- end
451
-
452
- class PackageSelectionItem < Item
453
- def initialize(name, template, default, help_default, desc)
454
- super name, template, default, desc
455
- @help_default = help_default
456
- end
457
-
458
- attr_reader :help_default
459
-
460
- def config_type
461
- 'package'
462
- end
463
-
464
- private
465
-
466
- def check(val)
467
- unless File.dir?("packages/#{val}")
468
- setup_rb_error "config: no such package: #{val}"
469
- end
470
- val
471
- end
472
- end
473
-
474
- class MetaConfigEnvironment
475
- def intiailize(config, installer)
476
- @config = config
477
- @installer = installer
478
- end
479
-
480
- def config_names
481
- @config.names
482
- end
483
-
484
- def config?(name)
485
- @config.key?(name)
486
- end
487
-
488
- def bool_config?(name)
489
- @config.lookup(name).config_type == 'bool'
490
- end
491
-
492
- def path_config?(name)
493
- @config.lookup(name).config_type == 'path'
494
- end
495
-
496
- def value_config?(name)
497
- @config.lookup(name).config_type != 'exec'
498
- end
499
-
500
- def add_config(item)
501
- @config.add item
502
- end
503
-
504
- def add_bool_config(name, default, desc)
505
- @config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
506
- end
507
-
508
- def add_path_config(name, default, desc)
509
- @config.add PathItem.new(name, 'path', default, desc)
510
- end
511
-
512
- def set_config_default(name, default)
513
- @config.lookup(name).default = default
514
- end
515
-
516
- def remove_config(name)
517
- @config.remove(name)
518
- end
519
-
520
- # For only multipackage
521
- def packages
522
- raise '[setup.rb fatal] multi-package metaconfig API packages() called for single-package; contact application package vendor' unless @installer
523
- @installer.packages
524
- end
525
-
526
- # For only multipackage
527
- def declare_packages(list)
528
- raise '[setup.rb fatal] multi-package metaconfig API declare_packages() called for single-package; contact application package vendor' unless @installer
529
- @installer.packages = list
530
- end
531
- end
532
-
533
- end # class ConfigTable
534
-
535
-
536
- # This module requires: #verbose?, #no_harm?
537
- module FileOperations
538
-
539
- def mkdir_p(dirname, prefix = nil)
540
- dirname = prefix + File.expand_path(dirname) if prefix
541
- $stderr.puts "mkdir -p #{dirname}" if verbose?
542
- return if no_harm?
543
-
544
- # Does not check '/', it's too abnormal.
545
- dirs = File.expand_path(dirname).split(%r<(?=/)>)
546
- if /\A[a-z]:\z/i =~ dirs[0]
547
- disk = dirs.shift
548
- dirs[0] = disk + dirs[0]
549
- end
550
- dirs.each_index do |idx|
551
- path = dirs[0..idx].join('')
552
- Dir.mkdir path unless File.dir?(path)
553
- end
554
- end
555
-
556
- def rm_f(path)
557
- $stderr.puts "rm -f #{path}" if verbose?
558
- return if no_harm?
559
- force_remove_file path
560
- end
561
-
562
- def rm_rf(path)
563
- $stderr.puts "rm -rf #{path}" if verbose?
564
- return if no_harm?
565
- remove_tree path
566
- end
567
-
568
- def remove_tree(path)
569
- if File.symlink?(path)
570
- remove_file path
571
- elsif File.dir?(path)
572
- remove_tree0 path
573
- else
574
- force_remove_file path
575
- end
576
- end
577
-
578
- def remove_tree0(path)
579
- Dir.foreach(path) do |ent|
580
- next if ent == '.'
581
- next if ent == '..'
582
- entpath = "#{path}/#{ent}"
583
- if File.symlink?(entpath)
584
- remove_file entpath
585
- elsif File.dir?(entpath)
586
- remove_tree0 entpath
587
- else
588
- force_remove_file entpath
589
- end
590
- end
591
- begin
592
- Dir.rmdir path
593
- rescue Errno::ENOTEMPTY
594
- # directory may not be empty
595
- end
596
- end
597
-
598
- def move_file(src, dest)
599
- force_remove_file dest
600
- begin
601
- File.rename src, dest
602
- rescue
603
- File.open(dest, 'wb') {|f|
604
- f.write File.binread(src)
605
- }
606
- File.chmod File.stat(src).mode, dest
607
- File.unlink src
608
- end
609
- end
610
-
611
- def force_remove_file(path)
612
- begin
613
- remove_file path
614
- rescue
615
- end
616
- end
617
-
618
- def remove_file(path)
619
- File.chmod 0777, path
620
- File.unlink path
621
- end
622
-
623
- def install(from, dest, mode, prefix = nil)
624
- $stderr.puts "install #{from} #{dest}" if verbose?
625
- return if no_harm?
626
-
627
- realdest = prefix ? prefix + File.expand_path(dest) : dest
628
- realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
629
- str = File.binread(from)
630
- if diff?(str, realdest)
631
- verbose_off {
632
- rm_f realdest if File.exist?(realdest)
633
- }
634
- File.open(realdest, 'wb') {|f|
635
- f.write str
636
- }
637
- File.chmod mode, realdest
638
-
639
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
640
- if prefix
641
- f.puts realdest.sub(prefix, '')
642
- else
643
- f.puts realdest
644
- end
645
- }
646
- end
647
- end
648
-
649
- def diff?(new_content, path)
650
- return true unless File.exist?(path)
651
- new_content != File.binread(path)
652
- end
653
-
654
- def command(*args)
655
- $stderr.puts args.join(' ') if verbose?
656
- system(*args) or raise RuntimeError,
657
- "system(#{args.map{|a| a.inspect }.join(' ')}) failed"
658
- end
659
-
660
- def ruby(*args)
661
- command config('rubyprog'), *args
662
- end
663
-
664
- def make(task = nil)
665
- command(*[config('makeprog'), task].compact)
666
- end
667
-
668
- def extdir?(dir)
669
- File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb")
670
- end
671
-
672
- def files_of(dir)
673
- Dir.open(dir) {|d|
674
- return d.select {|ent| File.file?("#{dir}/#{ent}") }
675
- }
676
- end
677
-
678
- DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn )
679
-
680
- def directories_of(dir)
681
- Dir.open(dir) {|d|
682
- return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT
683
- }
684
- end
685
-
686
- end
687
-
688
-
689
- # This module requires: #srcdir_root, #objdir_root, #relpath
690
- module HookScriptAPI
691
-
692
- def get_config(key)
693
- @config[key]
694
- end
695
-
696
- alias config get_config
697
-
698
- # obsolete: use metaconfig to change configuration
699
- def set_config(key, val)
700
- @config[key] = val
701
- end
702
-
703
- #
704
- # srcdir/objdir (works only in the package directory)
705
- #
706
-
707
- def curr_srcdir
708
- "#{srcdir_root()}/#{relpath()}"
709
- end
710
-
711
- def curr_objdir
712
- "#{objdir_root()}/#{relpath()}"
713
- end
714
-
715
- def srcfile(path)
716
- "#{curr_srcdir()}/#{path}"
717
- end
718
-
719
- def srcexist?(path)
720
- File.exist?(srcfile(path))
721
- end
722
-
723
- def srcdirectory?(path)
724
- File.dir?(srcfile(path))
725
- end
726
-
727
- def srcfile?(path)
728
- File.file?(srcfile(path))
729
- end
730
-
731
- def srcentries(path = '.')
732
- Dir.open("#{curr_srcdir()}/#{path}") {|d|
733
- return d.to_a - %w(. ..)
734
- }
735
- end
736
-
737
- def srcfiles(path = '.')
738
- srcentries(path).select {|fname|
739
- File.file?(File.join(curr_srcdir(), path, fname))
740
- }
741
- end
742
-
743
- def srcdirectories(path = '.')
744
- srcentries(path).select {|fname|
745
- File.dir?(File.join(curr_srcdir(), path, fname))
746
- }
747
- end
748
-
749
- end
750
-
751
-
752
- class ToplevelInstaller
753
-
754
- Version = '3.4.0'
755
- Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
756
-
757
- TASKS = [
758
- [ 'all', 'do config, setup, then install' ],
759
- [ 'config', 'saves your configurations' ],
760
- [ 'show', 'shows current configuration' ],
761
- [ 'setup', 'compiles ruby extentions and others' ],
762
- [ 'install', 'installs files' ],
763
- [ 'test', 'run all tests in test/' ],
764
- [ 'clean', "does `make clean' for each extention" ],
765
- [ 'distclean',"does `make distclean' for each extention" ]
766
- ]
767
-
768
- def ToplevelInstaller.invoke
769
- config = ConfigTable.new(load_rbconfig())
770
- config.load_standard_entries
771
- config.load_multipackage_entries if multipackage?
772
- config.fixup
773
- klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller)
774
- klass.new(File.dirname($0), config).invoke
775
- end
776
-
777
- def ToplevelInstaller.multipackage?
778
- File.dir?(File.dirname($0) + '/packages')
779
- end
780
-
781
- def ToplevelInstaller.load_rbconfig
782
- if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
783
- ARGV.delete(arg)
784
- load File.expand_path(arg.split(/=/, 2)[1])
785
- $".push 'rbconfig.rb'
786
- else
787
- require 'rbconfig'
788
- end
789
- ::Config::CONFIG
790
- end
791
-
792
- def initialize(ardir_root, config)
793
- @ardir = File.expand_path(ardir_root)
794
- @config = config
795
- # cache
796
- @valid_task_re = nil
797
- end
798
-
799
- def config(key)
800
- @config[key]
801
- end
802
-
803
- def inspect
804
- "#<#{self.class} #{__id__()}>"
805
- end
806
-
807
- def invoke
808
- run_metaconfigs
809
- case task = parsearg_global()
810
- when nil, 'all'
811
- parsearg_config
812
- init_installers
813
- exec_config
814
- exec_setup
815
- exec_install
816
- else
817
- case task
818
- when 'config', 'test'
819
- ;
820
- when 'clean', 'distclean'
821
- @config.load_savefile if File.exist?(@config.savefile)
822
- else
823
- @config.load_savefile
824
- end
825
- __send__ "parsearg_#{task}"
826
- init_installers
827
- __send__ "exec_#{task}"
828
- end
829
- end
830
-
831
- def run_metaconfigs
832
- @config.load_script "#{@ardir}/metaconfig"
833
- end
834
-
835
- def init_installers
836
- @installer = Installer.new(@config, @ardir, File.expand_path('.'))
837
- end
838
-
839
- #
840
- # Hook Script API bases
841
- #
842
-
843
- def srcdir_root
844
- @ardir
845
- end
846
-
847
- def objdir_root
848
- '.'
849
- end
850
-
851
- def relpath
852
- '.'
853
- end
854
-
855
- #
856
- # Option Parsing
857
- #
858
-
859
- def parsearg_global
860
- while arg = ARGV.shift
861
- case arg
862
- when /\A\w+\z/
863
- setup_rb_error "invalid task: #{arg}" unless valid_task?(arg)
864
- return arg
865
- when '-q', '--quiet'
866
- @config.verbose = false
867
- when '--verbose'
868
- @config.verbose = true
869
- when '--help'
870
- print_usage $stdout
871
- exit 0
872
- when '--version'
873
- puts "#{File.basename($0)} version #{Version}"
874
- exit 0
875
- when '--copyright'
876
- puts Copyright
877
- exit 0
878
- else
879
- setup_rb_error "unknown global option '#{arg}'"
880
- end
881
- end
882
- nil
883
- end
884
-
885
- def valid_task?(t)
886
- valid_task_re() =~ t
887
- end
888
-
889
- def valid_task_re
890
- @valid_task_re ||= /\A(?:#{TASKS.map {|task,desc| task }.join('|')})\z/
891
- end
892
-
893
- def parsearg_no_options
894
- unless ARGV.empty?
895
- setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}"
896
- end
897
- end
898
-
899
- alias parsearg_show parsearg_no_options
900
- alias parsearg_setup parsearg_no_options
901
- alias parsearg_test parsearg_no_options
902
- alias parsearg_clean parsearg_no_options
903
- alias parsearg_distclean parsearg_no_options
904
-
905
- def parsearg_config
906
- evalopt = []
907
- set = []
908
- @config.config_opt = []
909
- while i = ARGV.shift
910
- if /\A--?\z/ =~ i
911
- @config.config_opt = ARGV.dup
912
- break
913
- end
914
- name, value = *@config.parse_opt(i)
915
- if @config.value_config?(name)
916
- @config[name] = value
917
- else
918
- evalopt.push [name, value]
919
- end
920
- set.push name
921
- end
922
- evalopt.each do |name, value|
923
- @config.lookup(name).evaluate value, @config
924
- end
925
- # Check if configuration is valid
926
- set.each do |n|
927
- @config[n] if @config.value_config?(n)
928
- end
929
- end
930
-
931
- def parsearg_install
932
- @config.no_harm = false
933
- @config.install_prefix = ''
934
- while a = ARGV.shift
935
- case a
936
- when '--no-harm'
937
- @config.no_harm = true
938
- when /\A--prefix=/
939
- path = a.split(/=/, 2)[1]
940
- path = File.expand_path(path) unless path[0,1] == '/'
941
- @config.install_prefix = path
942
- else
943
- setup_rb_error "install: unknown option #{a}"
944
- end
945
- end
946
- end
947
-
948
- def print_usage(out)
949
- out.puts 'Typical Installation Procedure:'
950
- out.puts " $ ruby #{File.basename $0} config"
951
- out.puts " $ ruby #{File.basename $0} setup"
952
- out.puts " # ruby #{File.basename $0} install (may require root privilege)"
953
- out.puts
954
- out.puts 'Detailed Usage:'
955
- out.puts " ruby #{File.basename $0} <global option>"
956
- out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
957
-
958
- fmt = " %-24s %s\n"
959
- out.puts
960
- out.puts 'Global options:'
961
- out.printf fmt, '-q,--quiet', 'suppress message outputs'
962
- out.printf fmt, ' --verbose', 'output messages verbosely'
963
- out.printf fmt, ' --help', 'print this message'
964
- out.printf fmt, ' --version', 'print version and quit'
965
- out.printf fmt, ' --copyright', 'print copyright and quit'
966
- out.puts
967
- out.puts 'Tasks:'
968
- TASKS.each do |name, desc|
969
- out.printf fmt, name, desc
970
- end
971
-
972
- fmt = " %-24s %s [%s]\n"
973
- out.puts
974
- out.puts 'Options for CONFIG or ALL:'
975
- @config.each do |item|
976
- out.printf fmt, item.help_opt, item.description, item.help_default
977
- end
978
- out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
979
- out.puts
980
- out.puts 'Options for INSTALL:'
981
- out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
982
- out.printf fmt, '--prefix=path', 'install path prefix', ''
983
- out.puts
984
- end
985
-
986
- #
987
- # Task Handlers
988
- #
989
-
990
- def exec_config
991
- @installer.exec_config
992
- @config.save # must be final
993
- end
994
-
995
- def exec_setup
996
- @installer.exec_setup
997
- end
998
-
999
- def exec_install
1000
- @installer.exec_install
1001
- end
1002
-
1003
- def exec_test
1004
- @installer.exec_test
1005
- end
1006
-
1007
- def exec_show
1008
- @config.each do |i|
1009
- printf "%-20s %s\n", i.name, i.value if i.value?
1010
- end
1011
- end
1012
-
1013
- def exec_clean
1014
- @installer.exec_clean
1015
- end
1016
-
1017
- def exec_distclean
1018
- @installer.exec_distclean
1019
- end
1020
-
1021
- end # class ToplevelInstaller
1022
-
1023
-
1024
- class ToplevelInstallerMulti < ToplevelInstaller
1025
-
1026
- include FileOperations
1027
-
1028
- def initialize(ardir_root, config)
1029
- super
1030
- @packages = directories_of("#{@ardir}/packages")
1031
- raise 'no package exists' if @packages.empty?
1032
- @root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
1033
- end
1034
-
1035
- def run_metaconfigs
1036
- @config.load_script "#{@ardir}/metaconfig", self
1037
- @packages.each do |name|
1038
- @config.load_script "#{@ardir}/packages/#{name}/metaconfig"
1039
- end
1040
- end
1041
-
1042
- attr_reader :packages
1043
-
1044
- def packages=(list)
1045
- raise 'package list is empty' if list.empty?
1046
- list.each do |name|
1047
- raise "directory packages/#{name} does not exist"\
1048
- unless File.dir?("#{@ardir}/packages/#{name}")
1049
- end
1050
- @packages = list
1051
- end
1052
-
1053
- def init_installers
1054
- @installers = {}
1055
- @packages.each do |pack|
1056
- @installers[pack] = Installer.new(@config,
1057
- "#{@ardir}/packages/#{pack}",
1058
- "packages/#{pack}")
1059
- end
1060
- with = extract_selection(config('with'))
1061
- without = extract_selection(config('without'))
1062
- @selected = @installers.keys.select {|name|
1063
- (with.empty? or with.include?(name)) \
1064
- and not without.include?(name)
1065
- }
1066
- end
1067
-
1068
- def extract_selection(list)
1069
- a = list.split(/,/)
1070
- a.each do |name|
1071
- setup_rb_error "no such package: #{name}" unless @installers.key?(name)
1072
- end
1073
- a
1074
- end
1075
-
1076
- def print_usage(f)
1077
- super
1078
- f.puts 'Inluded packages:'
1079
- f.puts ' ' + @packages.sort.join(' ')
1080
- f.puts
1081
- end
1082
-
1083
- #
1084
- # Task Handlers
1085
- #
1086
-
1087
- def exec_config
1088
- run_hook 'pre-config'
1089
- each_selected_installers {|inst| inst.exec_config }
1090
- run_hook 'post-config'
1091
- @config.save # must be final
1092
- end
1093
-
1094
- def exec_setup
1095
- run_hook 'pre-setup'
1096
- each_selected_installers {|inst| inst.exec_setup }
1097
- run_hook 'post-setup'
1098
- end
1099
-
1100
- def exec_install
1101
- run_hook 'pre-install'
1102
- each_selected_installers {|inst| inst.exec_install }
1103
- run_hook 'post-install'
1104
- end
1105
-
1106
- def exec_test
1107
- run_hook 'pre-test'
1108
- each_selected_installers {|inst| inst.exec_test }
1109
- run_hook 'post-test'
1110
- end
1111
-
1112
- def exec_clean
1113
- rm_f @config.savefile
1114
- run_hook 'pre-clean'
1115
- each_selected_installers {|inst| inst.exec_clean }
1116
- run_hook 'post-clean'
1117
- end
1118
-
1119
- def exec_distclean
1120
- rm_f @config.savefile
1121
- run_hook 'pre-distclean'
1122
- each_selected_installers {|inst| inst.exec_distclean }
1123
- run_hook 'post-distclean'
1124
- end
1125
-
1126
- #
1127
- # lib
1128
- #
1129
-
1130
- def each_selected_installers
1131
- Dir.mkdir 'packages' unless File.dir?('packages')
1132
- @selected.each do |pack|
1133
- $stderr.puts "Processing the package `#{pack}' ..." if verbose?
1134
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
1135
- Dir.chdir "packages/#{pack}"
1136
- yield @installers[pack]
1137
- Dir.chdir '../..'
1138
- end
1139
- end
1140
-
1141
- def run_hook(id)
1142
- @root_installer.run_hook id
1143
- end
1144
-
1145
- # module FileOperations requires this
1146
- def verbose?
1147
- @config.verbose?
1148
- end
1149
-
1150
- # module FileOperations requires this
1151
- def no_harm?
1152
- @config.no_harm?
1153
- end
1154
-
1155
- end # class ToplevelInstallerMulti
1156
-
1157
-
1158
- class Installer
1159
-
1160
- FILETYPES = %w( bin lib ext data conf man )
1161
-
1162
- include FileOperations
1163
- include HookScriptAPI
1164
-
1165
- def initialize(config, srcroot, objroot)
1166
- @config = config
1167
- @srcdir = File.expand_path(srcroot)
1168
- @objdir = File.expand_path(objroot)
1169
- @currdir = '.'
1170
- end
1171
-
1172
- def inspect
1173
- "#<#{self.class} #{File.basename(@srcdir)}>"
1174
- end
1175
-
1176
- #
1177
- # Hook Script API base methods
1178
- #
1179
-
1180
- def srcdir_root
1181
- @srcdir
1182
- end
1183
-
1184
- def objdir_root
1185
- @objdir
1186
- end
1187
-
1188
- def relpath
1189
- @currdir
1190
- end
1191
-
1192
- #
1193
- # Config Access
1194
- #
1195
-
1196
- # module FileOperations requires this
1197
- def verbose?
1198
- @config.verbose?
1199
- end
1200
-
1201
- # module FileOperations requires this
1202
- def no_harm?
1203
- @config.no_harm?
1204
- end
1205
-
1206
- def verbose_off
1207
- begin
1208
- save, @config.verbose = @config.verbose?, false
1209
- yield
1210
- ensure
1211
- @config.verbose = save
1212
- end
1213
- end
1214
-
1215
- #
1216
- # TASK config
1217
- #
1218
-
1219
- def exec_config
1220
- exec_task_traverse 'config'
1221
- end
1222
-
1223
- def config_dir_bin(rel)
1224
- end
1225
-
1226
- def config_dir_lib(rel)
1227
- end
1228
-
1229
- def config_dir_man(rel)
1230
- end
1231
-
1232
- def config_dir_ext(rel)
1233
- extconf if extdir?(curr_srcdir())
1234
- end
1235
-
1236
- def extconf
1237
- ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt
1238
- end
1239
-
1240
- def config_dir_data(rel)
1241
- end
1242
-
1243
- def config_dir_conf(rel)
1244
- end
1245
-
1246
- #
1247
- # TASK setup
1248
- #
1249
-
1250
- def exec_setup
1251
- exec_task_traverse 'setup'
1252
- end
1253
-
1254
- def setup_dir_bin(rel)
1255
- files_of(curr_srcdir()).each do |fname|
1256
- adjust_shebang "#{curr_srcdir()}/#{fname}"
1257
- end
1258
- end
1259
-
1260
- def adjust_shebang(path)
1261
- return if no_harm?
1262
- tmpfile = File.basename(path) + '.tmp'
1263
- begin
1264
- File.open(path, 'rb') {|r|
1265
- first = r.gets
1266
- return unless File.basename(first.sub(/\A\#!/, '').split[0].to_s) == 'ruby'
1267
- $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
1268
- File.open(tmpfile, 'wb') {|w|
1269
- w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
1270
- w.write r.read
1271
- }
1272
- }
1273
- move_file tmpfile, File.basename(path)
1274
- ensure
1275
- File.unlink tmpfile if File.exist?(tmpfile)
1276
- end
1277
- end
1278
-
1279
- def setup_dir_lib(rel)
1280
- end
1281
-
1282
- def setup_dir_man(rel)
1283
- end
1284
-
1285
- def setup_dir_ext(rel)
1286
- make if extdir?(curr_srcdir())
1287
- end
1288
-
1289
- def setup_dir_data(rel)
1290
- end
1291
-
1292
- def setup_dir_conf(rel)
1293
- end
1294
-
1295
- #
1296
- # TASK install
1297
- #
1298
-
1299
- def exec_install
1300
- rm_f 'InstalledFiles'
1301
- exec_task_traverse 'install'
1302
- end
1303
-
1304
- def install_dir_bin(rel)
1305
- install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755
1306
- end
1307
-
1308
- def install_dir_lib(rel)
1309
- install_files rubyscripts(), "#{config('rbdir')}/#{rel}", 0644
1310
- end
1311
-
1312
- def install_dir_ext(rel)
1313
- return unless extdir?(curr_srcdir())
1314
- install_files rubyextentions('.'),
1315
- "#{config('sodir')}/#{File.dirname(rel)}",
1316
- 0555
1317
- end
1318
-
1319
- def install_dir_data(rel)
1320
- install_files targetfiles(), "#{config('datadir')}/#{rel}", 0644
1321
- end
1322
-
1323
- def install_dir_conf(rel)
1324
- # FIXME: should not remove current config files
1325
- # (rename previous file to .old/.org)
1326
- install_files targetfiles(), "#{config('sysconfdir')}/#{rel}", 0644
1327
- end
1328
-
1329
- def install_dir_man(rel)
1330
- install_files targetfiles(), "#{config('mandir')}/#{rel}", 0644
1331
- end
1332
-
1333
- def install_files(list, dest, mode)
1334
- mkdir_p dest, @config.install_prefix
1335
- list.each do |fname|
1336
- install fname, dest, mode, @config.install_prefix
1337
- end
1338
- end
1339
-
1340
- def rubyscripts
1341
- glob_select(@config.libsrc_pattern, targetfiles())
1342
- end
1343
-
1344
- def rubyextentions(dir)
1345
- ents = glob_select("*.#{@config.dllext}", targetfiles())
1346
- if ents.empty?
1347
- setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
1348
- end
1349
- ents
1350
- end
1351
-
1352
- def targetfiles
1353
- mapdir(existfiles() - hookfiles())
1354
- end
1355
-
1356
- def mapdir(ents)
1357
- ents.map {|ent|
1358
- if File.exist?(ent)
1359
- then ent # objdir
1360
- else "#{curr_srcdir()}/#{ent}" # srcdir
1361
- end
1362
- }
1363
- end
1364
-
1365
- # picked up many entries from cvs-1.11.1/src/ignore.c
1366
- JUNK_FILES = %w(
1367
- core RCSLOG tags TAGS .make.state
1368
- .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
1369
- *~ *.old *.bak *.BAK *.orig *.rej _$* *$
1370
-
1371
- *.org *.in .*
1372
- )
1373
-
1374
- def existfiles
1375
- glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.')))
1376
- end
1377
-
1378
- def hookfiles
1379
- %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
1380
- %w( config setup install clean ).map {|t| sprintf(fmt, t) }
1381
- }.flatten
1382
- end
1383
-
1384
- def glob_select(pat, ents)
1385
- re = globs2re([pat])
1386
- ents.select {|ent| re =~ ent }
1387
- end
1388
-
1389
- def glob_reject(pats, ents)
1390
- re = globs2re(pats)
1391
- ents.reject {|ent| re =~ ent }
1392
- end
1393
-
1394
- GLOB2REGEX = {
1395
- '.' => '\.',
1396
- '$' => '\$',
1397
- '#' => '\#',
1398
- '*' => '.*'
1399
- }
1400
-
1401
- def globs2re(pats)
1402
- /\A(?:#{
1403
- pats.map {|pat| pat.gsub(/[\.\$\#\*]/) {|ch| GLOB2REGEX[ch] } }.join('|')
1404
- })\z/
1405
- end
1406
-
1407
- #
1408
- # TASK test
1409
- #
1410
-
1411
- TESTDIR = 'test'
1412
-
1413
- def exec_test
1414
- unless File.directory?('test')
1415
- $stderr.puts 'no test in this package' if verbose?
1416
- return
1417
- end
1418
- $stderr.puts 'Running tests...' if verbose?
1419
- require 'test/unit'
1420
- runner = Test::Unit::AutoRunner.new(true)
1421
- runner.to_run << TESTDIR
1422
- runner.run
1423
- end
1424
-
1425
- #
1426
- # TASK clean
1427
- #
1428
-
1429
- def exec_clean
1430
- exec_task_traverse 'clean'
1431
- rm_f @config.savefile
1432
- rm_f 'InstalledFiles'
1433
- end
1434
-
1435
- def clean_dir_bin(rel)
1436
- end
1437
-
1438
- def clean_dir_lib(rel)
1439
- end
1440
-
1441
- def clean_dir_ext(rel)
1442
- return unless extdir?(curr_srcdir())
1443
- make 'clean' if File.file?('Makefile')
1444
- end
1445
-
1446
- def clean_dir_data(rel)
1447
- end
1448
-
1449
- def clean_dir_conf(rel)
1450
- end
1451
-
1452
- #
1453
- # TASK distclean
1454
- #
1455
-
1456
- def exec_distclean
1457
- exec_task_traverse 'distclean'
1458
- rm_f @config.savefile
1459
- rm_f 'InstalledFiles'
1460
- end
1461
-
1462
- def distclean_dir_bin(rel)
1463
- end
1464
-
1465
- def distclean_dir_lib(rel)
1466
- end
1467
-
1468
- def distclean_dir_ext(rel)
1469
- return unless extdir?(curr_srcdir())
1470
- make 'distclean' if File.file?('Makefile')
1471
- end
1472
-
1473
- def distclean_dir_data(rel)
1474
- end
1475
-
1476
- def distclean_dir_conf(rel)
1477
- end
1478
-
1479
- #
1480
- # lib
1481
- #
1482
-
1483
- def exec_task_traverse(task)
1484
- run_hook "pre-#{task}"
1485
- FILETYPES.each do |type|
1486
- if config('without-ext') == 'yes' and type == 'ext'
1487
- $stderr.puts 'skipping ext/* by user option' if verbose?
1488
- next
1489
- end
1490
- traverse task, type, "#{task}_dir_#{type}"
1491
- end
1492
- run_hook "post-#{task}"
1493
- end
1494
-
1495
- def traverse(task, rel, mid)
1496
- dive_into(rel) {
1497
- run_hook "pre-#{task}"
1498
- __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
1499
- directories_of(curr_srcdir()).each do |d|
1500
- traverse task, "#{rel}/#{d}", mid
1501
- end
1502
- run_hook "post-#{task}"
1503
- }
1504
- end
1505
-
1506
- def dive_into(rel)
1507
- return unless File.dir?("#{@srcdir}/#{rel}")
1508
-
1509
- dir = File.basename(rel)
1510
- Dir.mkdir dir unless File.dir?(dir)
1511
- prevdir = Dir.pwd
1512
- Dir.chdir dir
1513
- $stderr.puts '---> ' + rel if verbose?
1514
- @currdir = rel
1515
- yield
1516
- Dir.chdir prevdir
1517
- $stderr.puts '<--- ' + rel if verbose?
1518
- @currdir = File.dirname(rel)
1519
- end
1520
-
1521
- def run_hook(id)
1522
- path = [ "#{curr_srcdir()}/#{id}",
1523
- "#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) }
1524
- return unless path
1525
- begin
1526
- instance_eval File.read(path), path, 1
1527
- rescue
1528
- raise if $DEBUG
1529
- setup_rb_error "hook #{path} failed:\n" + $!.message
1530
- end
1531
- end
1532
-
1533
- end # class Installer
1534
-
1535
-
1536
- class SetupError < StandardError; end
1537
-
1538
- def setup_rb_error(msg)
1539
- raise SetupError, msg
1540
- end
1541
-
1542
- if $0 == __FILE__
1543
- begin
1544
- ToplevelInstaller.invoke
1545
- rescue SetupError
1546
- raise if $DEBUG
1547
- $stderr.puts $!.message
1548
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
1549
- exit 1
1550
- end
1551
- end