facets 1.8.49 → 1.8.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (554) hide show
  1. data/PROJECT +4 -1
  2. data/Rakefile +25 -48
  3. data/VERSION +1 -1
  4. data/doc/AUTHORS +1 -0
  5. data/doc/CHANGES +6 -0
  6. data/lib/facets/core/kernel/tap.rb +33 -3
  7. data/lib/facets/more/command.rb +507 -271
  8. metadata +2 -548
  9. data/test/lib/facets/core/array/test_at_rand.rb +0 -34
  10. data/test/lib/facets/core/array/test_delete_unless.rb +0 -28
  11. data/test/lib/facets/core/array/test_delete_values.rb +0 -28
  12. data/test/lib/facets/core/array/test_delete_values_at.rb +0 -31
  13. data/test/lib/facets/core/array/test_first.rb +0 -46
  14. data/test/lib/facets/core/array/test_head.rb +0 -42
  15. data/test/lib/facets/core/array/test_last_index.rb +0 -26
  16. data/test/lib/facets/core/array/test_merge.rb +0 -35
  17. data/test/lib/facets/core/array/test_mid.rb +0 -33
  18. data/test/lib/facets/core/array/test_middle.rb +0 -29
  19. data/test/lib/facets/core/array/test_op_div.rb +0 -27
  20. data/test/lib/facets/core/array/test_op_fetch.rb +0 -35
  21. data/test/lib/facets/core/array/test_pad.rb +0 -48
  22. data/test/lib/facets/core/array/test_pick.rb +0 -40
  23. data/test/lib/facets/core/array/test_pos.rb +0 -28
  24. data/test/lib/facets/core/array/test_pot.rb +0 -28
  25. data/test/lib/facets/core/array/test_pull.rb +0 -28
  26. data/test/lib/facets/core/array/test_rand_index.rb +0 -29
  27. data/test/lib/facets/core/array/test_rand_subset.rb +0 -29
  28. data/test/lib/facets/core/array/test_range.rb +0 -32
  29. data/test/lib/facets/core/array/test_rotate.rb +0 -36
  30. data/test/lib/facets/core/array/test_select.rb +0 -28
  31. data/test/lib/facets/core/array/test_shuffle.rb +0 -35
  32. data/test/lib/facets/core/array/test_thru.rb +0 -27
  33. data/test/lib/facets/core/array/test_to_b.rb +0 -27
  34. data/test/lib/facets/core/array/test_to_h.rb +0 -33
  35. data/test/lib/facets/core/array/test_to_hash.rb +0 -27
  36. data/test/lib/facets/core/binding/self/test_of_caller.rb +0 -35
  37. data/test/lib/facets/core/binding/test___LINE__.rb +0 -43
  38. data/test/lib/facets/core/binding/test_call_stack.rb +0 -34
  39. data/test/lib/facets/core/binding/test_called.rb +0 -30
  40. data/test/lib/facets/core/binding/test_caller.rb +0 -35
  41. data/test/lib/facets/core/binding/test_defined.rb +0 -34
  42. data/test/lib/facets/core/binding/test_eval.rb +0 -34
  43. data/test/lib/facets/core/binding/test_local_variables.rb +0 -34
  44. data/test/lib/facets/core/binding/test_method_name.rb +0 -34
  45. data/test/lib/facets/core/binding/test_op_fetch.rb +0 -34
  46. data/test/lib/facets/core/binding/test_op_store.rb +0 -35
  47. data/test/lib/facets/core/binding/test_self.rb +0 -34
  48. data/test/lib/facets/core/class/test_cattr.rb +0 -63
  49. data/test/lib/facets/core/class/test_descendents.rb +0 -30
  50. data/test/lib/facets/core/class/test_method_name.rb +0 -26
  51. data/test/lib/facets/core/class/test_remove_descendents.rb +0 -32
  52. data/test/lib/facets/core/class/test_unix_path.rb +0 -26
  53. data/test/lib/facets/core/comparable/test_at_least.rb +0 -34
  54. data/test/lib/facets/core/comparable/test_clip.rb +0 -44
  55. data/test/lib/facets/core/comparable/test_cmp.rb +0 -28
  56. data/test/lib/facets/core/continuation/self/test_create.rb +0 -26
  57. data/test/lib/facets/core/date/test_days_in_month.rb +0 -30
  58. data/test/lib/facets/core/date/test_days_of_month.rb +0 -30
  59. data/test/lib/facets/core/date/test_stamp.rb +0 -38
  60. data/test/lib/facets/core/date/test_to_date.rb +0 -30
  61. data/test/lib/facets/core/date/test_to_s.rb +0 -30
  62. data/test/lib/facets/core/date/test_to_time.rb +0 -30
  63. data/test/lib/facets/core/dir/self/test_ancestor.rb +0 -26
  64. data/test/lib/facets/core/dir/self/test_ascend.rb +0 -41
  65. data/test/lib/facets/core/enumerable/self/test_combinations.rb +0 -46
  66. data/test/lib/facets/core/enumerable/test_cart.rb +0 -49
  67. data/test/lib/facets/core/enumerable/test_collect_with_index.rb +0 -27
  68. data/test/lib/facets/core/enumerable/test_commonality.rb +0 -31
  69. data/test/lib/facets/core/enumerable/test_compact_collect.rb +0 -27
  70. data/test/lib/facets/core/enumerable/test_count.rb +0 -38
  71. data/test/lib/facets/core/enumerable/test_each_by.rb +0 -71
  72. data/test/lib/facets/core/enumerable/test_each_combination.rb +0 -29
  73. data/test/lib/facets/core/enumerable/test_each_pair.rb +0 -29
  74. data/test/lib/facets/core/enumerable/test_each_slice.rb +0 -57
  75. data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +0 -29
  76. data/test/lib/facets/core/enumerable/test_eachn.rb +0 -34
  77. data/test/lib/facets/core/enumerable/test_elementwise.rb +0 -40
  78. data/test/lib/facets/core/enumerable/test_entropy.rb +0 -26
  79. data/test/lib/facets/core/enumerable/test_every.rb +0 -35
  80. data/test/lib/facets/core/enumerable/test_ew.rb +0 -31
  81. data/test/lib/facets/core/enumerable/test_filter_collect.rb +0 -31
  82. data/test/lib/facets/core/enumerable/test_find_collisions.rb +0 -30
  83. data/test/lib/facets/core/enumerable/test_frequency.rb +0 -27
  84. data/test/lib/facets/core/enumerable/test_graph.rb +0 -30
  85. data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +0 -27
  86. data/test/lib/facets/core/enumerable/test_none.rb +0 -33
  87. data/test/lib/facets/core/enumerable/test_occur.rb +0 -30
  88. data/test/lib/facets/core/enumerable/test_one.rb +0 -35
  89. data/test/lib/facets/core/enumerable/test_op_pow.rb +0 -27
  90. data/test/lib/facets/core/enumerable/test_op_tilde_self.rb +0 -40
  91. data/test/lib/facets/core/enumerable/test_partition_by.rb +0 -31
  92. data/test/lib/facets/core/enumerable/test_permutation.rb +0 -29
  93. data/test/lib/facets/core/enumerable/test_probability.rb +0 -27
  94. data/test/lib/facets/core/enumerable/test_to_h.rb +0 -27
  95. data/test/lib/facets/core/enumerable/test_uniq_by.rb +0 -28
  96. data/test/lib/facets/core/file/self/test_create.rb +0 -44
  97. data/test/lib/facets/core/file/self/test_open_as_string.rb +0 -50
  98. data/test/lib/facets/core/file/self/test_read_list.rb +0 -40
  99. data/test/lib/facets/core/file/self/test_sanitize.rb +0 -46
  100. data/test/lib/facets/core/file/self/test_split_all.rb +0 -27
  101. data/test/lib/facets/core/float/test_round_at.rb +0 -46
  102. data/test/lib/facets/core/float/test_round_to.rb +0 -46
  103. data/test/lib/facets/core/hash/self/test_zipnew.rb +0 -28
  104. data/test/lib/facets/core/hash/test_alias.rb +0 -31
  105. data/test/lib/facets/core/hash/test_assert_has_keys.rb +0 -27
  106. data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +0 -27
  107. data/test/lib/facets/core/hash/test_at.rb +0 -28
  108. data/test/lib/facets/core/hash/test_collate.rb +0 -35
  109. data/test/lib/facets/core/hash/test_each_with_index.rb +0 -29
  110. data/test/lib/facets/core/hash/test_each_with_key.rb +0 -29
  111. data/test/lib/facets/core/hash/test_graph.rb +0 -28
  112. data/test/lib/facets/core/hash/test_has_keys.rb +0 -27
  113. data/test/lib/facets/core/hash/test_has_only_keys.rb +0 -27
  114. data/test/lib/facets/core/hash/test_inverse.rb +0 -30
  115. data/test/lib/facets/core/hash/test_normalize_keys.rb +0 -34
  116. data/test/lib/facets/core/hash/test_op_fetch.rb +0 -111
  117. data/test/lib/facets/core/hash/test_op_lshift.rb +0 -29
  118. data/test/lib/facets/core/hash/test_rand_key.rb +0 -27
  119. data/test/lib/facets/core/hash/test_rand_pair.rb +0 -27
  120. data/test/lib/facets/core/hash/test_rand_value.rb +0 -27
  121. data/test/lib/facets/core/hash/test_rekey.rb +0 -52
  122. data/test/lib/facets/core/hash/test_replace_each.rb +0 -29
  123. data/test/lib/facets/core/hash/test_shuffle.rb +0 -32
  124. data/test/lib/facets/core/hash/test_slice.rb +0 -27
  125. data/test/lib/facets/core/hash/test_stringify_keys.rb +0 -34
  126. data/test/lib/facets/core/hash/test_swap.rb +0 -27
  127. data/test/lib/facets/core/hash/test_swapkey.rb +0 -29
  128. data/test/lib/facets/core/hash/test_symbolize_keys.rb +0 -34
  129. data/test/lib/facets/core/hash/test_to_h.rb +0 -27
  130. data/test/lib/facets/core/hash/test_to_ostruct.rb +0 -30
  131. data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +0 -44
  132. data/test/lib/facets/core/hash/test_traverse.rb +0 -37
  133. data/test/lib/facets/core/hash/test_update_each.rb +0 -29
  134. data/test/lib/facets/core/hash/test_update_keys.rb +0 -28
  135. data/test/lib/facets/core/hash/test_update_values.rb +0 -28
  136. data/test/lib/facets/core/hash/test_weave.rb +0 -29
  137. data/test/lib/facets/core/integer/test_factorial.rb +0 -30
  138. data/test/lib/facets/core/integer/test_multiple.rb +0 -43
  139. data/test/lib/facets/core/integer/test_of.rb +0 -28
  140. data/test/lib/facets/core/integer/test_ordinal.rb +0 -29
  141. data/test/lib/facets/core/integer/test_times_collect.rb +0 -28
  142. data/test/lib/facets/core/kernel/test___class__.rb +0 -26
  143. data/test/lib/facets/core/kernel/test_as.rb +0 -42
  144. data/test/lib/facets/core/kernel/test_assign_from.rb +0 -31
  145. data/test/lib/facets/core/kernel/test_assign_with.rb +0 -31
  146. data/test/lib/facets/core/kernel/test_bool.rb +0 -41
  147. data/test/lib/facets/core/kernel/test_bug.rb +0 -26
  148. data/test/lib/facets/core/kernel/test_call_stack.rb +0 -26
  149. data/test/lib/facets/core/kernel/test_called.rb +0 -26
  150. data/test/lib/facets/core/kernel/test_callee.rb +0 -26
  151. data/test/lib/facets/core/kernel/test_constant.rb +0 -33
  152. data/test/lib/facets/core/kernel/test_copy.rb +0 -40
  153. data/test/lib/facets/core/kernel/test_deep_copy.rb +0 -40
  154. data/test/lib/facets/core/kernel/test_demo.rb +0 -28
  155. data/test/lib/facets/core/kernel/test_fn.rb +0 -26
  156. data/test/lib/facets/core/kernel/test_get_by_id.rb +0 -28
  157. data/test/lib/facets/core/kernel/test_here.rb +0 -26
  158. data/test/lib/facets/core/kernel/test_in.rb +0 -27
  159. data/test/lib/facets/core/kernel/test_instance_class.rb +0 -27
  160. data/test/lib/facets/core/kernel/test_instance_exec.rb +0 -58
  161. data/test/lib/facets/core/kernel/test_maybe.rb +0 -26
  162. data/test/lib/facets/core/kernel/test_meta_class.rb +0 -27
  163. data/test/lib/facets/core/kernel/test_metaclass.rb +0 -27
  164. data/test/lib/facets/core/kernel/test_method.rb +0 -32
  165. data/test/lib/facets/core/kernel/test_methods.rb +0 -50
  166. data/test/lib/facets/core/kernel/test_new.rb +0 -30
  167. data/test/lib/facets/core/kernel/test_object_class.rb +0 -26
  168. data/test/lib/facets/core/kernel/test_object_hexid.rb +0 -27
  169. data/test/lib/facets/core/kernel/test_qua_class.rb +0 -27
  170. data/test/lib/facets/core/kernel/test_require_all.rb +0 -26
  171. data/test/lib/facets/core/kernel/test_require_esc.rb +0 -27
  172. data/test/lib/facets/core/kernel/test_resc.rb +0 -27
  173. data/test/lib/facets/core/kernel/test_send_as.rb +0 -26
  174. data/test/lib/facets/core/kernel/test_set_from.rb +0 -33
  175. data/test/lib/facets/core/kernel/test_set_with.rb +0 -42
  176. data/test/lib/facets/core/kernel/test_silently.rb +0 -28
  177. data/test/lib/facets/core/kernel/test_singleton.rb +0 -40
  178. data/test/lib/facets/core/kernel/test_singleton_class.rb +0 -27
  179. data/test/lib/facets/core/kernel/test_super_at.rb +0 -30
  180. data/test/lib/facets/core/kernel/test_supermethod.rb +0 -33
  181. data/test/lib/facets/core/kernel/test_this.rb +0 -26
  182. data/test/lib/facets/core/kernel/test_to_b.rb +0 -28
  183. data/test/lib/facets/core/kernel/test_to_bool.rb +0 -28
  184. data/test/lib/facets/core/kernel/test_to_data.rb +0 -61
  185. data/test/lib/facets/core/kernel/test_uri.rb +0 -30
  186. data/test/lib/facets/core/kernel/test_val.rb +0 -43
  187. data/test/lib/facets/core/kernel/test_with.rb +0 -30
  188. data/test/lib/facets/core/kernel/test_with_accessor.rb +0 -51
  189. data/test/lib/facets/core/matchdata/test_match.rb +0 -29
  190. data/test/lib/facets/core/matchdata/test_matchtree.rb +0 -37
  191. data/test/lib/facets/core/module/self/test_op_add.rb +0 -50
  192. data/test/lib/facets/core/module/test_abstract.rb +0 -36
  193. data/test/lib/facets/core/module/test_alias_method_chain.rb +0 -46
  194. data/test/lib/facets/core/module/test_alias_module_function.rb +0 -34
  195. data/test/lib/facets/core/module/test_ancestor.rb +0 -26
  196. data/test/lib/facets/core/module/test_attr_tester.rb +0 -39
  197. data/test/lib/facets/core/module/test_basename.rb +0 -26
  198. data/test/lib/facets/core/module/test_by_name.rb +0 -29
  199. data/test/lib/facets/core/module/test_class_extension.rb +0 -70
  200. data/test/lib/facets/core/module/test_clone_using.rb +0 -55
  201. data/test/lib/facets/core/module/test_dirname.rb +0 -26
  202. data/test/lib/facets/core/module/test_equate_on.rb +0 -37
  203. data/test/lib/facets/core/module/test_include_as.rb +0 -45
  204. data/test/lib/facets/core/module/test_initializer.rb +0 -32
  205. data/test/lib/facets/core/module/test_instance_methods.rb +0 -59
  206. data/test/lib/facets/core/module/test_integrate.rb +0 -35
  207. data/test/lib/facets/core/module/test_memoize.rb +0 -50
  208. data/test/lib/facets/core/module/test_modspace.rb +0 -27
  209. data/test/lib/facets/core/module/test_namespace.rb +0 -66
  210. data/test/lib/facets/core/module/test_nesting.rb +0 -36
  211. data/test/lib/facets/core/module/test_new.rb +0 -34
  212. data/test/lib/facets/core/module/test_nodef.rb +0 -30
  213. data/test/lib/facets/core/module/test_on_included.rb +0 -36
  214. data/test/lib/facets/core/module/test_redef.rb +0 -30
  215. data/test/lib/facets/core/module/test_redefine_method.rb +0 -30
  216. data/test/lib/facets/core/module/test_redirect.rb +0 -30
  217. data/test/lib/facets/core/module/test_redirect_method.rb +0 -30
  218. data/test/lib/facets/core/module/test_remove.rb +0 -30
  219. data/test/lib/facets/core/module/test_rename.rb +0 -31
  220. data/test/lib/facets/core/module/test_rename_method.rb +0 -31
  221. data/test/lib/facets/core/module/test_revisal.rb +0 -35
  222. data/test/lib/facets/core/module/test_shadow_method.rb +0 -30
  223. data/test/lib/facets/core/module/test_sort_on.rb +0 -42
  224. data/test/lib/facets/core/module/test_this.rb +0 -31
  225. data/test/lib/facets/core/module/test_wrap.rb +0 -30
  226. data/test/lib/facets/core/module/test_wrap_method.rb +0 -30
  227. data/test/lib/facets/core/nilclass/test_blank.rb +0 -26
  228. data/test/lib/facets/core/nilclass/test_empty.rb +0 -26
  229. data/test/lib/facets/core/nilclass/test_include.rb +0 -26
  230. data/test/lib/facets/core/nilclass/test_op_fetch.rb +0 -28
  231. data/test/lib/facets/core/nilclass/test_size.rb +0 -30
  232. data/test/lib/facets/core/nilclass/test_to_h.rb +0 -26
  233. data/test/lib/facets/core/numeric/test_approx.rb +0 -29
  234. data/test/lib/facets/core/numeric/test_ceil_multiple.rb +0 -31
  235. data/test/lib/facets/core/numeric/test_distance.rb +0 -28
  236. data/test/lib/facets/core/numeric/test_succ.rb +0 -40
  237. data/test/lib/facets/core/numeric/test_to_b.rb +0 -27
  238. data/test/lib/facets/core/ostruct/test___update__.rb +0 -45
  239. data/test/lib/facets/core/ostruct/test_instance_delegate.rb +0 -36
  240. data/test/lib/facets/core/ostruct/test_op_fetch.rb +0 -33
  241. data/test/lib/facets/core/proc/test_compose.rb +0 -29
  242. data/test/lib/facets/core/proc/test_op_mul.rb +0 -34
  243. data/test/lib/facets/core/proc/test_to_method.rb +0 -44
  244. data/test/lib/facets/core/range/test_to_r.rb +0 -27
  245. data/test/lib/facets/core/range/test_to_range.rb +0 -27
  246. data/test/lib/facets/core/range/test_umbrella.rb +0 -34
  247. data/test/lib/facets/core/range/test_within.rb +0 -29
  248. data/test/lib/facets/core/regexp/test_arity.rb +0 -33
  249. data/test/lib/facets/core/regexp/test_to_re.rb +0 -27
  250. data/test/lib/facets/core/regexp/test_to_regexp.rb +0 -27
  251. data/test/lib/facets/core/string/self/test_interpolate.rb +0 -27
  252. data/test/lib/facets/core/string/self/test_patterns.rb +0 -28
  253. data/test/lib/facets/core/string/self/test_rand_letter.rb +0 -26
  254. data/test/lib/facets/core/string/test_align_center.rb +0 -34
  255. data/test/lib/facets/core/string/test_at_rand.rb +0 -35
  256. data/test/lib/facets/core/string/test_basename.rb +0 -41
  257. data/test/lib/facets/core/string/test_blank.rb +0 -27
  258. data/test/lib/facets/core/string/test_bracket.rb +0 -49
  259. data/test/lib/facets/core/string/test_bytes.rb +0 -25
  260. data/test/lib/facets/core/string/test_camelcase.rb +0 -39
  261. data/test/lib/facets/core/string/test_camelize.rb +0 -26
  262. data/test/lib/facets/core/string/test_capitalize_all.rb +0 -26
  263. data/test/lib/facets/core/string/test_capitalized.rb +0 -26
  264. data/test/lib/facets/core/string/test_chars.rb +0 -27
  265. data/test/lib/facets/core/string/test_cleave.rb +0 -43
  266. data/test/lib/facets/core/string/test_cmp.rb +0 -30
  267. data/test/lib/facets/core/string/test_demodulize.rb +0 -38
  268. data/test/lib/facets/core/string/test_divide.rb +0 -29
  269. data/test/lib/facets/core/string/test_downcase.rb +0 -26
  270. data/test/lib/facets/core/string/test_dresner.rb +0 -32
  271. data/test/lib/facets/core/string/test_each_char.rb +0 -29
  272. data/test/lib/facets/core/string/test_each_word.rb +0 -29
  273. data/test/lib/facets/core/string/test_first.rb +0 -43
  274. data/test/lib/facets/core/string/test_fold.rb +0 -34
  275. data/test/lib/facets/core/string/test_humanize.rb +0 -26
  276. data/test/lib/facets/core/string/test_indent.rb +0 -40
  277. data/test/lib/facets/core/string/test_index_all.rb +0 -26
  278. data/test/lib/facets/core/string/test_last.rb +0 -46
  279. data/test/lib/facets/core/string/test_line_wrap.rb +0 -27
  280. data/test/lib/facets/core/string/test_lines.rb +0 -26
  281. data/test/lib/facets/core/string/test_lowercase.rb +0 -26
  282. data/test/lib/facets/core/string/test_margin.rb +0 -117
  283. data/test/lib/facets/core/string/test_methodize.rb +0 -27
  284. data/test/lib/facets/core/string/test_modulize.rb +0 -29
  285. data/test/lib/facets/core/string/test_mscan.rb +0 -30
  286. data/test/lib/facets/core/string/test_natcmp.rb +0 -30
  287. data/test/lib/facets/core/string/test_nchar.rb +0 -29
  288. data/test/lib/facets/core/string/test_pathize.rb +0 -29
  289. data/test/lib/facets/core/string/test_pop.rb +0 -47
  290. data/test/lib/facets/core/string/test_pot.rb +0 -39
  291. data/test/lib/facets/core/string/test_push.rb +0 -40
  292. data/test/lib/facets/core/string/test_quote.rb +0 -49
  293. data/test/lib/facets/core/string/test_rand_byte.rb +0 -35
  294. data/test/lib/facets/core/string/test_rand_index.rb +0 -26
  295. data/test/lib/facets/core/string/test_range.rb +0 -27
  296. data/test/lib/facets/core/string/test_range_all.rb +0 -27
  297. data/test/lib/facets/core/string/test_range_of_line.rb +0 -28
  298. data/test/lib/facets/core/string/test_regesc.rb +0 -28
  299. data/test/lib/facets/core/string/test_shatter.rb +0 -29
  300. data/test/lib/facets/core/string/test_shift.rb +0 -40
  301. data/test/lib/facets/core/string/test_shuffle.rb +0 -27
  302. data/test/lib/facets/core/string/test_similarity.rb +0 -26
  303. data/test/lib/facets/core/string/test_singular.rb +0 -86
  304. data/test/lib/facets/core/string/test_soundex.rb +0 -41
  305. data/test/lib/facets/core/string/test_succ.rb +0 -29
  306. data/test/lib/facets/core/string/test_to_a.rb +0 -27
  307. data/test/lib/facets/core/string/test_to_b.rb +0 -41
  308. data/test/lib/facets/core/string/test_to_const.rb +0 -28
  309. data/test/lib/facets/core/string/test_to_date.rb +0 -30
  310. data/test/lib/facets/core/string/test_to_proc.rb +0 -33
  311. data/test/lib/facets/core/string/test_to_re.rb +0 -28
  312. data/test/lib/facets/core/string/test_to_time.rb +0 -30
  313. data/test/lib/facets/core/string/test_unix_crypt.rb +0 -30
  314. data/test/lib/facets/core/string/test_unpack.rb +0 -34
  315. data/test/lib/facets/core/string/test_unshift.rb +0 -39
  316. data/test/lib/facets/core/string/test_upcase.rb +0 -30
  317. data/test/lib/facets/core/string/test_whitespace.rb +0 -27
  318. data/test/lib/facets/core/string/test_word_filter.rb +0 -34
  319. data/test/lib/facets/core/string/test_word_wrap.rb +0 -51
  320. data/test/lib/facets/core/string/test_words.rb +0 -37
  321. data/test/lib/facets/core/symbol/test_camelcase.rb +0 -26
  322. data/test/lib/facets/core/symbol/test_camelize.rb +0 -27
  323. data/test/lib/facets/core/symbol/test_capitalize.rb +0 -26
  324. data/test/lib/facets/core/symbol/test_capitalized.rb +0 -27
  325. data/test/lib/facets/core/symbol/test_downcase.rb +0 -27
  326. data/test/lib/facets/core/symbol/test_not.rb +0 -29
  327. data/test/lib/facets/core/symbol/test_pad.rb +0 -27
  328. data/test/lib/facets/core/symbol/test_succ.rb +0 -28
  329. data/test/lib/facets/core/symbol/test_to_const.rb +0 -28
  330. data/test/lib/facets/core/symbol/test_to_proc.rb +0 -33
  331. data/test/lib/facets/core/symbol/test_to_str.rb +0 -28
  332. data/test/lib/facets/core/symbol/test_underscore.rb +0 -26
  333. data/test/lib/facets/core/symbol/test_upcase.rb +0 -27
  334. data/test/lib/facets/core/time/test_change.rb +0 -33
  335. data/test/lib/facets/core/time/test_elapse.rb +0 -27
  336. data/test/lib/facets/core/time/test_stamp.rb +0 -39
  337. data/test/lib/facets/core/time/test_to_date.rb +0 -31
  338. data/test/lib/facets/core/time/test_to_s.rb +0 -31
  339. data/test/lib/facets/core/time/test_to_time.rb +0 -31
  340. data/test/lib/facets/more/test_ann.rb +0 -112
  341. data/test/lib/facets/more/test_ann_attr.rb +0 -39
  342. data/test/lib/facets/more/test_ansicode.rb +0 -36
  343. data/test/lib/facets/more/test_arguments.rb +0 -83
  344. data/test/lib/facets/more/test_association.rb +0 -51
  345. data/test/lib/facets/more/test_autoarray.rb +0 -32
  346. data/test/lib/facets/more/test_basicobject.rb +0 -67
  347. data/test/lib/facets/more/test_bbcode.rb +0 -34
  348. data/test/lib/facets/more/test_binaryreader.rb +0 -64
  349. data/test/lib/facets/more/test_bitmask.rb +0 -47
  350. data/test/lib/facets/more/test_buildingblock.rb +0 -48
  351. data/test/lib/facets/more/test_bytes.rb +0 -84
  352. data/test/lib/facets/more/test_classmethods.rb +0 -69
  353. data/test/lib/facets/more/test_command.rb +0 -69
  354. data/test/lib/facets/more/test_coroutine.rb +0 -60
  355. data/test/lib/facets/more/test_crypt.rb +0 -46
  356. data/test/lib/facets/more/test_cut.rb +0 -198
  357. data/test/lib/facets/more/test_dependency.rb +0 -82
  358. data/test/lib/facets/more/test_dictionary.rb +0 -107
  359. data/test/lib/facets/more/test_elementor.rb +0 -52
  360. data/test/lib/facets/more/test_enumerablepass.rb +0 -86
  361. data/test/lib/facets/more/test_floatstring.rb +0 -36
  362. data/test/lib/facets/more/test_functor.rb +0 -39
  363. data/test/lib/facets/more/test_htmlbuilder.rb +0 -38
  364. data/test/lib/facets/more/test_htmlfilter.rb +0 -86
  365. data/test/lib/facets/more/test_infinity.rb +0 -50
  366. data/test/lib/facets/more/test_inheritor.rb +0 -155
  367. data/test/lib/facets/more/test_instance_intercept.rb +0 -50
  368. data/test/lib/facets/more/test_interval.rb +0 -119
  369. data/test/lib/facets/more/test_json.rb +0 -232
  370. data/test/lib/facets/more/test_linkedlist.rb +0 -53
  371. data/test/lib/facets/more/test_lisp.rb +0 -47
  372. data/test/lib/facets/more/test_lisp_format.rb +0 -37
  373. data/test/lib/facets/more/test_lrucache.rb +0 -25
  374. data/test/lib/facets/more/test_mathconstants.rb +0 -18
  375. data/test/lib/facets/more/test_methodfilter.rb +0 -45
  376. data/test/lib/facets/more/test_methodprobe.rb +0 -53
  377. data/test/lib/facets/more/test_multipliers.rb +0 -114
  378. data/test/lib/facets/more/test_multiton.rb +0 -199
  379. data/test/lib/facets/more/test_nackclass.rb +0 -45
  380. data/test/lib/facets/more/test_nilcomparable.rb +0 -47
  381. data/test/lib/facets/more/test_opencascade.rb +0 -75
  382. data/test/lib/facets/more/test_openobject.rb +0 -126
  383. data/test/lib/facets/more/test_overload.rb +0 -54
  384. data/test/lib/facets/more/test_paramix.rb +0 -100
  385. data/test/lib/facets/more/test_pqueue.rb +0 -39
  386. data/test/lib/facets/more/test_preinitialize.rb +0 -49
  387. data/test/lib/facets/more/test_promoteself.rb +0 -45
  388. data/test/lib/facets/more/test_recorder.rb +0 -44
  389. data/test/lib/facets/more/test_snapshot.rb +0 -34
  390. data/test/lib/facets/more/test_statichash.rb +0 -31
  391. data/test/lib/facets/more/test_syncarray.rb +0 -28
  392. data/test/lib/facets/more/test_synchash.rb +0 -28
  393. data/test/lib/facets/more/test_tagiterator.rb +0 -93
  394. data/test/lib/facets/more/test_timer.rb +0 -66
  395. data/test/lib/facets/more/test_times.rb +0 -103
  396. data/test/lib/facets/more/test_tuple.rb +0 -64
  397. data/test/lib/facets/more/test_typecast.rb +0 -68
  398. data/test/lib/facets/more/test_uninheritable.rb +0 -42
  399. data/test/lib/facets/more/test_units.rb +0 -111
  400. data/test/lib/facets/more/test_xmlbuilder.rb +0 -54
  401. data/test/lib/facets/more/test_xmlhelper.rb +0 -40
  402. data/test/lib/facets/more/test_xoxo.rb +0 -288
  403. data/test/lib/facets/more/test_yamlstruct.rb +0 -37
  404. data/test/lib/facets/yore/enumerable/test_cross.rb +0 -44
  405. data/test/lib/facets/yore/kernel/test_require_facet.rb +0 -27
  406. data/test/lib/facets/yore/module/test_namespace.rb +0 -33
  407. data/test/lib/facets/yore/test_annattr.rb +0 -39
  408. data/test/lib/facets/yore/test_annotation.rb +0 -318
  409. data/work/README +0 -42
  410. data/work/TODO +0 -73
  411. data/work/bin/minitar +0 -3
  412. data/work/bin/minitar.rb +0 -814
  413. data/work/core/array/at_rand.rb +0 -95
  414. data/work/core/array/each_slice.rb +0 -23
  415. data/work/core/array/pick_values.rb +0 -32
  416. data/work/core/array/rand_indexes.rb +0 -33
  417. data/work/core/binding/class.rb +0 -11
  418. data/work/core/binding/delegate-binding.rb +0 -19
  419. data/work/core/binding/delegate.rb +0 -15
  420. data/work/core/binding/proc.rb +0 -6
  421. data/work/core/class/to_module.rb +0 -3
  422. data/work/core/enumerable/op_fetch.rb +0 -30
  423. data/work/core/fileutils/cptouch.rb +0 -20
  424. data/work/core/fileutils/nl_convert.rb +0 -133
  425. data/work/core/io/expect.rb +0 -127
  426. data/work/core/join_with.rb +0 -13
  427. data/work/core/kernel/call_line.rb +0 -15
  428. data/work/core/kernel/does.rb +0 -7
  429. data/work/core/kernel/message.rb +0 -6
  430. data/work/core/kernel/query.rb +0 -15
  431. data/work/core/kernel/taint.rb +0 -10
  432. data/work/core/logger/clean_logger.rb +0 -10
  433. data/work/core/module/attr-old.rb +0 -308
  434. data/work/core/module/attr.rb +0 -98
  435. data/work/core/module/attr_xxx.rb +0 -22
  436. data/work/core/module/by_regexp.rb +0 -21
  437. data/work/core/module/cast.rb +0 -64
  438. data/work/core/module/class_attribute_accessors.rb +0 -57
  439. data/work/core/module/inherit.rb +0 -99
  440. data/work/core/module/inherit0.rb +0 -59
  441. data/work/core/module/let.rb +0 -51
  442. data/work/core/module/meta_attr.rb +0 -60
  443. data/work/core/module/module_attribute_accessors.rb +0 -57
  444. data/work/core/module/permissions.rb +0 -32
  445. data/work/core/module/preserved.rb +0 -108
  446. data/work/core/module/sattr_accessor.rb +0 -1
  447. data/work/core/module/sattr_reader.rb +0 -1
  448. data/work/core/module/sattr_setter.rb +0 -1
  449. data/work/core/module/sattr_tester.rb +0 -1
  450. data/work/core/module/sattr_writer.rb +0 -1
  451. data/work/core/module/tc_attr.rb +0 -107
  452. data/work/core/module/to_module.rb +0 -37
  453. data/work/core/module/version.rb +0 -23
  454. data/work/core/string/frequency.rb +0 -40
  455. data/work/core/string/op_add.rb +0 -24
  456. data/work/core/string/op_div.rb +0 -15
  457. data/work/core/string/pred.rb +0 -217
  458. data/work/core/string/probability.rb +0 -35
  459. data/work/core/string/succ_distance.rb +0 -112
  460. data/work/core/string/to_arr.rb +0 -57
  461. data/work/core/string/to_ary.rb +0 -12
  462. data/work/core/string/word_wrap.rb +0 -62
  463. data/work/hash_open.rb +0 -23
  464. data/work/misc/calibre/ProjectInfo.annotation +0 -46
  465. data/work/misc/calibre/ProjectInfo.ansicode +0 -33
  466. data/work/misc/calibre/ProjectInfo.association +0 -34
  467. data/work/misc/calibre/ProjectInfo.basicobject +0 -36
  468. data/work/misc/calibre/ProjectInfo.bbcode +0 -34
  469. data/work/misc/calibre/ProjectInfo.binaryreader +0 -35
  470. data/work/misc/calibre/ProjectInfo.bitmask +0 -33
  471. data/work/misc/calibre/ProjectInfo.classinherit +0 -36
  472. data/work/misc/calibre/ProjectInfo.classmethods +0 -36
  473. data/work/misc/calibre/ProjectInfo.cloneable +0 -33
  474. data/work/misc/calibre/ProjectInfo.consoleapp +0 -35
  475. data/work/misc/calibre/ProjectInfo.coroutine +0 -37
  476. data/work/misc/calibre/ProjectInfo.crypt +0 -33
  477. data/work/misc/calibre/ProjectInfo.dictionary +0 -40
  478. data/work/misc/calibre/ProjectInfo.downloader +0 -39
  479. data/work/misc/calibre/ProjectInfo.enumerablepass +0 -35
  480. data/work/misc/calibre/ProjectInfo.expirable +0 -37
  481. data/work/misc/calibre/ProjectInfo.floatstring +0 -35
  482. data/work/misc/calibre/ProjectInfo.functor +0 -40
  483. data/work/misc/calibre/ProjectInfo.heap +0 -33
  484. data/work/misc/calibre/ProjectInfo.inheritor +0 -36
  485. data/work/misc/calibre/ProjectInfo.interval +0 -36
  486. data/work/misc/calibre/ProjectInfo.lisp +0 -38
  487. data/work/misc/calibre/ProjectInfo.lrucache +0 -34
  488. data/work/misc/calibre/ProjectInfo.mathconstants +0 -41
  489. data/work/misc/calibre/ProjectInfo.methodprobe +0 -38
  490. data/work/misc/calibre/ProjectInfo.mock +0 -34
  491. data/work/misc/calibre/ProjectInfo.multiton +0 -36
  492. data/work/misc/calibre/ProjectInfo.nackclass +0 -33
  493. data/work/misc/calibre/ProjectInfo.nilcomparable +0 -35
  494. data/work/misc/calibre/ProjectInfo.nullclass +0 -35
  495. data/work/misc/calibre/ProjectInfo.one +0 -37
  496. data/work/misc/calibre/ProjectInfo.openobject +0 -39
  497. data/work/misc/calibre/ProjectInfo.paramix +0 -38
  498. data/work/misc/calibre/ProjectInfo.pool +0 -33
  499. data/work/misc/calibre/ProjectInfo.progressbar +0 -37
  500. data/work/misc/calibre/ProjectInfo.reference +0 -36
  501. data/work/misc/calibre/ProjectInfo.semaphore +0 -36
  502. data/work/misc/calibre/ProjectInfo.stateparser +0 -39
  503. data/work/misc/calibre/ProjectInfo.statichash +0 -33
  504. data/work/misc/calibre/ProjectInfo.system +0 -34
  505. data/work/misc/calibre/ProjectInfo.tagiterator +0 -36
  506. data/work/misc/calibre/ProjectInfo.timer +0 -35
  507. data/work/misc/calibre/ProjectInfo.tracepoint +0 -37
  508. data/work/misc/calibre/ProjectInfo.tuple +0 -36
  509. data/work/misc/calibre/ProjectInfo.uniheritable +0 -34
  510. data/work/misc/calibre/ProjectInfo.units +0 -34
  511. data/work/misc/calibre/ProjectInfo.yamlstruct +0 -34
  512. data/work/more/annotation-rw.rb +0 -217
  513. data/work/more/aobject.rb +0 -132
  514. data/work/more/autohash.rb +0 -67
  515. data/work/more/cache.rb +0 -189
  516. data/work/more/class_inheritable_attributes.rb +0 -120
  517. data/work/more/commandrunner.rb +0 -101
  518. data/work/more/daemon.rb +0 -70
  519. data/work/more/debugger.rb +0 -167
  520. data/work/more/detach.rb +0 -423
  521. data/work/more/enumtype.rb +0 -115
  522. data/work/more/ioreactor.rb +0 -671
  523. data/work/more/logger_sing.rb +0 -207
  524. data/work/more/must.rb +0 -37
  525. data/work/more/old-tkxml.rb +0 -189
  526. data/work/more/pairhash.rb +0 -55
  527. data/work/more/password.rb +0 -80
  528. data/work/more/print_exception.rb +0 -35
  529. data/work/more/rand.rb +0 -412
  530. data/work/more/range.rb +0 -383
  531. data/work/more/sanitize.rb +0 -48
  532. data/work/more/superstruct.rb +0 -735
  533. data/work/more/tag.rb +0 -31
  534. data/work/more/timer.rb +0 -164
  535. data/work/op_rshift.rb +0 -87
  536. data/work/openobject-temp.rb +0 -45
  537. data/work/pore/autorequire.rb +0 -83
  538. data/work/pore/basefactory.rb +0 -40
  539. data/work/pore/hash/each.rb +0 -76
  540. data/work/pore/merge3.rb +0 -765
  541. data/work/pore/superann.rb +0 -134
  542. data/work/pore/sys.rb +0 -186
  543. data/work/pore/utils.rb +0 -518
  544. data/work/yore/HashAquisition.rb +0 -36
  545. data/work/yore/Rakefile.old +0 -181
  546. data/work/yore/Reapfile +0 -63
  547. data/work/yore/annotation.rb +0 -489
  548. data/work/yore/annotation2.rb +0 -466
  549. data/work/yore/commandutils.rb +0 -379
  550. data/work/yore/openobject.rb +0 -298
  551. data/work/yore/reap.rb +0 -184
  552. data/work/yore/reap.yml +0 -47
  553. data/work/yore/taskable-old.rb +0 -519
  554. data/work/yore/taskable.rb +0 -482
@@ -1,42 +0,0 @@
1
- = Important
2
-
3
- Facets is a GENERAL PURPOSE library. It is vital that is stay that way!
4
-
5
- Under no circumstances should something be added to Facets specific to
6
- a particular use case or application. While a lib might serve the needs
7
- of such, the lib itself must have general applicability. Although not a
8
- sure test in either "direction", a good rule of thumb for such a
9
- condition is whether a lib has an external dependency --it should not.
10
-
11
- = The Work Folder
12
-
13
- This directory contains alpha code and is generally considered
14
- expiremental. It is provided as a means for common development
15
- and potential inspiration.
16
-
17
- Some of these, or variations there-of, will eventually become
18
- part of the main lib, many will not.
19
-
20
- Notice this development directory reflects the main lib directory
21
- in structure with the exception of an extra folder called 'reference'.
22
- This folder holds material gathered from outside sources that have
23
- not sifted through yet, but could yield some useful code in the future.
24
-
25
- The directores break down like so:
26
-
27
- core /
28
- work on core extensions
29
-
30
- more/
31
- work on more additions
32
-
33
- pore/
34
- stuff from outside world that might be useful
35
- or have useful bits.
36
-
37
- yore/
38
- stuff that either used to be in Facets but was
39
- removed or was considered for inclusion but
40
- wasn't and kept temporarily for reference.
41
- Basically, these are on the verge of the trashcan.
42
-
data/work/TODO DELETED
@@ -1,73 +0,0 @@
1
-
2
- = Facets' To Do List
3
-
4
- IT IS ALWAYS A GOOD IDEA TO WRITE A TEST!
5
- AND ITS ALWAYS A FINE THING TO IMPROVE DOCUMENTATION!
6
-
7
- * Move methods to facets/method and link back to facet/ but prefer library alias
8
- instead. (Rolls)
9
-
10
- * hash/invert: What about letting Hash#invert take a block that specifies
11
- what to do when a collision occurs?
12
-
13
- * hash/at_rand: allow for a _number_ of values, keys and pairs to be returned.
14
-
15
- * > Yep. Gone. But I may replace with a version that deletes only the first
16
- > matching element. Thoughts?
17
- If you don't want to do that I would rather add an option hash to .delete and
18
- use :once => true or something similar. (More expressive)
19
-
20
- * numeric/bound_by: Numeric includes Comparable. Maybe drop this, but
21
- might it be reasonable for Numeric but no other comparables?
22
-
23
- * nil/[]: Why should nil respond to [], but not to .each? I don't think
24
- nil should be treated as a container.
25
- nil/length: See above.
26
-
27
- * nil/method_missing: I'm not so sure about this. There is a lot of
28
- libraries depending on nil raising exceptions on failed method access. I
29
- also think that this could make programming errors very hard to find.
30
-
31
- * fileutils/head&tail: Hm, I think the block forms ought to be equivalent to
32
- tail -f and so on. Then the block forms should also return all lines by default
33
- instead of only the first 10.
34
-
35
- * fileutils/which: Should probably be based on fileutils/where_is as they have
36
- lots of common code. The two methods should probably also use RUBY_PLATFORM instead
37
- of checking for ALT_SEPARATOR.
38
-
39
- * module/memoize: Should the main memoize method be defined as it is?
40
- (see bottom of file).
41
-
42
- * kernel/demo: It can be implemented as demo "1+1"  using Binding.of_caller.
43
- Using only the block is possibly with SCRIPT_LINES__ or File access and is quite ugly.
44
-
45
- * hash/weave: Document how does it compare to Hash#merge?
46
-
47
- * Perhaps work on alernative require mechinism. Currently there is none.
48
- Here some pseudo docs for it:
49
-
50
- and an alternative interface to requiring the extension methods.
51
- With the Facets module you can require a facet method like so:
52
-
53
- Facets.require Time, :stamp
54
-
55
- One of the advantages of this approach is that Facets' can search the class hierarchy
56
- for a method. For example if you wanted to use #each_permutation on an Array.
57
-
58
- Facets.require 'array/each_permutation'
59
-
60
- Even though #each_permutation is a method of Enumerable this will still work
61
- because Enumerable is a superclass of Array.
62
-
63
- Also it allows for the use operators without special recourse.
64
- For instance, the Proc compostion operator can be require simply.
65
-
66
- Facets.require 'proc/*'
67
-
68
- If you're wondering why you have to specify the Facets module in #use,
69
- it is becuase #use is a generalized method. Anyone can easily take advantage
70
- of this functionality by utilizing Facets' Module-Package system (package.rb).
71
- See the API Documentation for further details of putting this to use in your
72
- programs.
73
-
@@ -1,3 +0,0 @@
1
- #! /usr/bin/ruby1.8
2
-
3
- load 'ratchets/command/minitar.rb'
@@ -1,814 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #--
3
- # Archive::Tar::Baby 0.5.1
4
- # Copyright � 2004 Mauricio Julio Fern�ndez Pradier and Austin Ziegler
5
- # This is free software with ABSOLUTELY NO WARRANTY.
6
- #
7
- # This program is based on and incorporates parts of RPA::Package from
8
- # rpa-base (lib/rpa/package.rb and lib/rpa/util.rb) by Mauricio and has been
9
- # adapted to be more generic by Austin.
10
- #
11
- # This file contains an adaptation of Ruby/ProgressBar by Satoru
12
- # Takabayashi <satoru@namazu.org>, copyright � 2001 - 2004.
13
- #
14
- # It is licensed under the GNU General Public Licence or Ruby's licence.
15
- #
16
- # $Id: command.rb,v 1.4 2004/09/22 17:47:43 austin Exp $
17
- #++
18
-
19
- require 'zlib'
20
-
21
- # TODO: add
22
- # TODO: delete ???
23
-
24
- require 'optparse'
25
- require 'ostruct'
26
- require 'fileutils'
27
-
28
- module Archive::Tar::Minitar::Command
29
- class ProgressBar
30
- VERSION = "0.8"
31
-
32
- attr_accessor :total
33
- attr_accessor :title
34
-
35
- def initialize (title, total, out = STDERR)
36
- @title = title
37
- @total = total
38
- @out = out
39
- @bar_width = 80
40
- @bar_mark = "o"
41
- @current = 0
42
- @previous = 0
43
- @is_finished = false
44
- @start_time = Time.now
45
- @previous_time = @start_time
46
- @title_width = 14
47
- @format = "%-#{@title_width}s %3d%% %s %s"
48
- @format_arguments = [:title, :percentage, :bar, :stat]
49
- show
50
- end
51
-
52
- private
53
- def convert_bytes (bytes)
54
- if bytes < 1024
55
- sprintf("%6dB", bytes)
56
- elsif bytes < 1024 * 1000 # 1000kb
57
- sprintf("%5.1fKB", bytes.to_f / 1024)
58
- elsif bytes < 1024 * 1024 * 1000 # 1000mb
59
- sprintf("%5.1fMB", bytes.to_f / 1024 / 1024)
60
- else
61
- sprintf("%5.1fGB", bytes.to_f / 1024 / 1024 / 1024)
62
- end
63
- end
64
-
65
- def transfer_rate
66
- bytes_per_second = @current.to_f / (Time.now - @start_time)
67
- sprintf("%s/s", convert_bytes(bytes_per_second))
68
- end
69
-
70
- def bytes
71
- convert_bytes(@current)
72
- end
73
-
74
- def format_time (t)
75
- t = t.to_i
76
- sec = t % 60
77
- min = (t / 60) % 60
78
- hour = t / 3600
79
- sprintf("%02d:%02d:%02d", hour, min, sec);
80
- end
81
-
82
- # ETA stands for Estimated Time of Arrival.
83
- def eta
84
- if @current == 0
85
- "ETA: --:--:--"
86
- else
87
- elapsed = Time.now - @start_time
88
- eta = elapsed * @total / @current - elapsed;
89
- sprintf("ETA: %s", format_time(eta))
90
- end
91
- end
92
-
93
- def elapsed
94
- elapsed = Time.now - @start_time
95
- sprintf("Time: %s", format_time(elapsed))
96
- end
97
-
98
- def stat
99
- if @is_finished then elapsed else eta end
100
- end
101
-
102
- def stat_for_file_transfer
103
- if @is_finished then
104
- sprintf("%s %s %s", bytes, transfer_rate, elapsed)
105
- else
106
- sprintf("%s %s %s", bytes, transfer_rate, eta)
107
- end
108
- end
109
-
110
- def eol
111
- if @is_finished then "\n" else "\r" end
112
- end
113
-
114
- def bar
115
- len = percentage * @bar_width / 100
116
- sprintf("|%s%s|", @bar_mark * len, " " * (@bar_width - len))
117
- end
118
-
119
- def percentage(value = nil)
120
- if @total.zero?
121
- 100
122
- else
123
- (value || @current) * 100 / @total
124
- end
125
- end
126
-
127
- def title
128
- @title[0,(@title_width - 1)] + ":"
129
- end
130
-
131
- def get_width
132
- # FIXME: I don't know how portable it is.
133
- default_width = 80
134
- # begin
135
- # tiocgwinsz = 0x5413
136
- # data = [0, 0, 0, 0].pack("SSSS")
137
- # if @out.ioctl(tiocgwinsz, data) >= 0 then
138
- # rows, cols, xpixels, ypixels = data.unpack("SSSS")
139
- # if cols >= 0 then cols else default_width end
140
- # else
141
- # default_width
142
- # end
143
- # rescue Exception
144
- # default_width
145
- # end
146
- end
147
-
148
- def show
149
- arguments = @format_arguments.map {|method| send(method) }
150
- line = sprintf(@format, *arguments)
151
-
152
- width = get_width
153
- if line.length == width - 1
154
- @out.print(line + eol)
155
- elsif line.length >= width
156
- @bar_width = [@bar_width - (line.length - width + 1), 0].max
157
- if @bar_width == 0 then @out.print(line + eol) else show end
158
- else # line.length < width - 1
159
- @bar_width += width - line.length + 1
160
- show
161
- end
162
- @previous_time = Time.now
163
- end
164
-
165
- def show_progress
166
- if @total.zero?
167
- cur_percentage = 100
168
- prev_percentage = 0
169
- else
170
- cur_percentage = (@current * 100 / @total).to_i
171
- prev_percentage = (@previous * 100 / @total).to_i
172
- end
173
-
174
- if cur_percentage > prev_percentage ||
175
- Time.now - @previous_time >= 1 ||
176
- @is_finished
177
- show
178
- end
179
- end
180
-
181
- public
182
- def file_transfer_mode
183
- @format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer]
184
- end
185
-
186
- def format= (format)
187
- @format = format
188
- end
189
-
190
- def format_arguments= (arguments)
191
- @format_arguments = arguments
192
- end
193
-
194
- def finish
195
- @current = @total
196
- @is_finished = true
197
- show_progress
198
- end
199
-
200
- def halt
201
- @is_finished = true
202
- show_progress
203
- end
204
-
205
- def set (count)
206
- if count < 0 || count > @total
207
- raise "invalid count: #{count} (total: #{@total})"
208
- end
209
- @current = count
210
- show_progress
211
- @previous = @current
212
- end
213
-
214
- def inc (step = 1)
215
- @current += step
216
- @current = @total if @current > @total
217
- show_progress
218
- @previous = @current
219
- end
220
-
221
- def inspect
222
- "(ProgressBar: #{@current}/#{@total})"
223
- end
224
- end
225
-
226
- class CommandPattern
227
- class AbstractCommandError < Exception; end
228
- class UnknownCommandError < RuntimeError; end
229
- class CommandAlreadyExists < RuntimeError; end
230
-
231
- class << self
232
- def add(command)
233
- command = command.new if command.kind_of?(Class)
234
-
235
- @commands ||= {}
236
- if @commands.has_key?(command.name)
237
- raise CommandAlreadyExists
238
- else
239
- @commands[command.name] = command
240
- end
241
-
242
- if command.respond_to?(:altname)
243
- unless @commands.has_key?(command.altname)
244
- @commands[command.altname] = command
245
- end
246
- end
247
- end
248
-
249
- def <<(command)
250
- add(command)
251
- end
252
-
253
- attr_accessor :default
254
- def default=(command) #:nodoc:
255
- if command.kind_of?(CommandPattern)
256
- @default = command
257
- elsif command.kind_of?(Class)
258
- @default = command.new
259
- elsif @commands.has_key?(command)
260
- @default = @commands[command]
261
- else
262
- raise UnknownCommandError
263
- end
264
- end
265
-
266
- def command?(command)
267
- @commands.has_key?(command)
268
- end
269
-
270
- def command(command)
271
- if command?(command)
272
- @commands[command]
273
- else
274
- @default
275
- end
276
- end
277
-
278
- def [](cmd)
279
- self.command(cmd)
280
- end
281
-
282
- def default_ioe(ioe = {})
283
- ioe[:input] ||= $stdin
284
- ioe[:output] ||= $stdout
285
- ioe[:error] ||= $stderr
286
- ioe
287
- end
288
- end
289
-
290
- def [](args, opts = {}, ioe = {})
291
- call(args, opts, ioe)
292
- end
293
-
294
- def name
295
- raise AbstractCommandError
296
- end
297
-
298
- def call(args, opts = {}, ioe = {})
299
- raise AbstractCommandError
300
- end
301
-
302
- def help
303
- raise AbstractCommandError
304
- end
305
- end
306
-
307
- class CommandHelp < CommandPattern
308
- def name
309
- "help"
310
- end
311
-
312
- def call(args, opts = {}, ioe = {})
313
- ioe = CommandPattern.default_ioe(ioe)
314
-
315
- help_on = args.shift
316
-
317
- if CommandPattern.command?(help_on)
318
- ioe[:output] << CommandPattern[help_on].help
319
- elsif help_on == "commands"
320
- ioe[:output] << <<-EOH
321
- The commands known to minitar are:
322
-
323
- minitar create Creates a new tarfile.
324
- minitar extract Extracts files from a tarfile.
325
- minitar list Lists files in the tarfile.
326
-
327
- All commands accept the options --verbose and --progress, which are
328
- mutually exclusive. In "minitar list", --progress means the same as
329
- --verbose.
330
-
331
- --verbose, -V Performs the requested command verbosely.
332
- --progress, -P Shows a progress bar, if appropriate, for the action
333
- being performed.
334
-
335
- EOH
336
- else
337
- ioe[:output] << "Unknown command: #{help_on}\n" unless help_on.nil? or help_on.empty?
338
- ioe[:output] << self.help
339
- end
340
-
341
- 0
342
- end
343
-
344
- def help
345
- help = <<-EOH
346
- This is a basic help message containing pointers to more information on
347
- how to use this command-line tool. Try:
348
-
349
- minitar help commands list all 'minitar' commands
350
- minitar help <COMMAND> show help on <COMMAND>
351
- (e.g., 'minitar help create')
352
- EOH
353
- end
354
- # minitar add Adds a file to an existing tarfile.
355
- # minitar delete Deletes a file from an existing tarfile.
356
- end
357
-
358
- class CommandCreate < CommandPattern
359
- def name
360
- "create"
361
- end
362
-
363
- def altname
364
- "cr"
365
- end
366
-
367
- def call(args, opts = {}, ioe = {})
368
- argv = []
369
-
370
- while (arg = args.shift)
371
- case arg
372
- when '--compress', '-z'
373
- opts[:compress] = true
374
- else
375
- argv << arg
376
- end
377
- end
378
-
379
- if argv.size < 2
380
- ioe[:output] << "Not enough arguments.\n\n"
381
- CommandPattern["help"][["create"]]
382
- return 255
383
- end
384
-
385
- output = argv.shift
386
- if '-' == output
387
- opts[:name] = "STDOUT"
388
- output = ioe[:output]
389
- opts[:output] = ioe[:error]
390
- else
391
- opts[:name] = output
392
- output = File.open(output, "wb")
393
- opts[:output] = ioe[:output]
394
- end
395
-
396
- if opts[:name] =~ /\.tar\.gz$|\.tgz$/ or opts[:compress]
397
- output = Zlib::GzipWriter.new(output)
398
- end
399
-
400
- files = []
401
- if argv.include?("--")
402
- # Read stdin for the list of files.
403
- files = ""
404
- files << ioe[:input].read while not ioe[:input].eof?
405
- files = files.split(/\r\n|\n|\r/)
406
- args.delete("--")
407
- end
408
-
409
- files << argv.to_a
410
- files.flatten!
411
-
412
- if opts[:verbose]
413
- watcher = lambda do |action, name, stats|
414
- opts[:output] << "#{name}\n" if action == :dir or action == :file_done
415
- end
416
- finisher = lambda { opts[:output] << "\n" }
417
- elsif opts[:progress]
418
- progress = ProgressBar.new(opts[:name], 1)
419
- watcher = lambda do |action, name, stats|
420
- case action
421
- when :file_start, :dir
422
- progress.title = File.basename(name)
423
- if action == :dir
424
- progress.total += 1
425
- progress.inc
426
- else
427
- progress.total += stats[:size]
428
- end
429
- when :file_progress
430
- progress.inc(stats[:currinc])
431
- end
432
- end
433
- finisher = lambda do
434
- progress.title = opts[:name]
435
- progress.finish
436
- end
437
- else
438
- watcher = nil
439
- finisher = lambda { }
440
- end
441
-
442
- Archive::Tar::Minitar.pack(files, output, &watcher)
443
- finisher.call
444
- 0
445
- ensure
446
- output.close if output and not output.closed?
447
- end
448
-
449
- def help
450
- help = <<-EOH
451
- minitar create [OPTIONS] <tarfile|-> <file|directory|-->+
452
-
453
- Creates a new tarfile. If the tarfile is named .tar.gz or .tgz, then it
454
- will be compressed automatically. If the tarfile is "-", then it will be
455
- output to standard output (stdout) so that minitar may be piped.
456
-
457
- The files or directories that will be packed into the tarfile are
458
- specified after the name of the tarfile itself. Directories will be
459
- processed recursively. If the token "--" is found in the list of files
460
- to be packed, additional filenames will be read from standard input
461
- (stdin). If any file is not found, the packaging will be halted.
462
-
463
- create Options:
464
- --compress, -z Compresses the tarfile with gzip.
465
-
466
- EOH
467
- end
468
- end
469
-
470
- class CommandExtract < CommandPattern
471
- def name
472
- "extract"
473
- end
474
-
475
- def altname
476
- "ex"
477
- end
478
-
479
- def call(args, opts = {}, ioe = {})
480
- argv = []
481
- output = nil
482
- dest = "."
483
- files = []
484
-
485
- while (arg = args.shift)
486
- case arg
487
- when '--uncompress', '-z'
488
- opts[:uncompress] = true
489
- when '--pipe'
490
- opts[:output] = ioe[:error]
491
- output = ioe[:output]
492
- when '--output', '-o'
493
- dest = args.shift
494
- else
495
- argv << arg
496
- end
497
- end
498
-
499
- if argv.size < 1
500
- ioe[:output] << "Not enough arguments.\n\n"
501
- CommandPattern["help"][["extract"]]
502
- return 255
503
- end
504
-
505
- input = argv.shift
506
- if '-' == input
507
- opts[:name] = "STDIN"
508
- input = ioe[:input]
509
- else
510
- opts[:name] = input
511
- input = File.open(input, "rb")
512
- end
513
-
514
- if opts[:name] =~ /\.tar\.gz$|\.tgz$/ or opts[:uncompress]
515
- input = Zlib::GzipReader.new(input)
516
- end
517
-
518
- files << argv.to_a
519
- files.flatten!
520
-
521
- if opts[:verbose]
522
- watcher = lambda do |action, name, stats|
523
- opts[:output] << "#{name}\n" if action == :dir or action == :file_done
524
- end
525
- finisher = lambda { opts[:output] << "\n" }
526
- elsif opts[:progress]
527
- progress = ProgressBar.new(opts[:name], 1)
528
- watcher = lambda do |action, name, stats|
529
- case action
530
- when :file_start, :dir
531
- progress.title = File.basename(name)
532
- if action == :dir
533
- progress.total += 1
534
- progress.inc
535
- else
536
- progress.total += stats[:entry].size
537
- end
538
- when :file_progress
539
- progress.inc(stats[:currinc])
540
- end
541
- end
542
- finisher = lambda do
543
- progress.title = opts[:name]
544
- progress.finish
545
- end
546
- else
547
- watcher = nil
548
- finisher = lambda { }
549
- end
550
-
551
- if output.nil?
552
- Archive::Tar::Minitar.unpack(input, dest, files, &watcher)
553
- finisher.call
554
- else
555
- Archive::Tar::Minitar::Input.open(input) do |inp|
556
- inp.each do |entry|
557
- stats = {
558
- :mode => entry.mode,
559
- :mtime => entry.mtime,
560
- :size => entry.size,
561
- :gid => entry.gid,
562
- :uid => entry.uid,
563
- :current => 0,
564
- :currinc => 0,
565
- :entry => entry
566
- }
567
-
568
- if files.empty? or files.include?(entry.full_name)
569
- if entry.directory?
570
- puts "Directory: #{entry.full_name}"
571
- watcher[:dir, dest, stats] unless watcher.nil?
572
- else
573
- puts "File: #{entry.full_name}"
574
- watcher[:file_start, destfile, stats] unless watcher.nil?
575
- loop do
576
- data = entry.read(4096)
577
- break unless data
578
- stats[:currinc] = output.write(data)
579
- stats[:current] += stats[:currinc]
580
-
581
- watcher[:file_progress, name, stats] unless watcher.nil?
582
- end
583
- watcher[:file_done, name, stats] unless watcher.nil?
584
- end
585
- end
586
- end
587
- end
588
- end
589
-
590
- 0
591
- end
592
-
593
- def help
594
- help = <<-EOH
595
- minitar extract [OPTIONS] <tarfile|-> [<file>+]
596
-
597
- Extracts files from an existing tarfile. If the tarfile is named .tar.gz
598
- or .tgz, then it will be uncompressed automatically. If the tarfile is
599
- "-", then it will be read from standard input (stdin) so that minitar
600
- may be piped.
601
-
602
- The files or directories that will be extracted from the tarfile are
603
- specified after the name of the tarfile itself. Directories will be
604
- processed recursively. Files must be specified in full. A file
605
- "foo/bar/baz.txt" cannot simply be specified by specifying "baz.txt".
606
- Any file not found will simply be skipped and an error will be reported.
607
-
608
- extract Options:
609
- --uncompress, -z Uncompresses the tarfile with gzip.
610
- --pipe Emits the extracted files to STDOUT for piping.
611
- --output, -o Extracts the files to the specified directory.
612
-
613
- EOH
614
- end
615
- end
616
-
617
- class CommandList < CommandPattern
618
- def name
619
- "list"
620
- end
621
-
622
- def altname
623
- "ls"
624
- end
625
-
626
- def modestr(mode)
627
- s = "---"
628
- s[0] = ?r if (mode & 4) == 4
629
- s[1] = ?w if (mode & 2) == 2
630
- s[2] = ?x if (mode & 1) == 1
631
- s
632
- end
633
-
634
- def call(args, opts = {}, ioe = {})
635
- argv = []
636
- output = nil
637
- dest = "."
638
- files = []
639
- opts[:field] = "name"
640
-
641
- while (arg = args.shift)
642
- case arg
643
- when '--sort', '-S'
644
- opts[:sort] = true
645
- opts[:field] = args.shift
646
- when '--reverse', '-R'
647
- opts[:reverse] = true
648
- opts[:sort] = true
649
- when '--uncompress', '-z'
650
- opts[:uncompress] = true
651
- when '-l'
652
- opts[:verbose] = true
653
- else
654
- argv << arg
655
- end
656
- end
657
-
658
- if argv.size < 1
659
- ioe[:output] << "Not enough arguments.\n\n"
660
- CommandPattern["help"][["list"]]
661
- return 255
662
- end
663
-
664
- input = argv.shift
665
- if '-' == input
666
- opts[:name] = "STDIN"
667
- input = ioe[:input]
668
- else
669
- opts[:name] = input
670
- input = File.open(input, "rb")
671
- end
672
-
673
- if opts[:name] =~ /\.tar\.gz$|\.tgz$/ or opts[:uncompress]
674
- input = Zlib::GzipReader.new(input)
675
- end
676
-
677
- files << argv.to_a
678
- files.flatten!
679
-
680
- if opts[:verbose] or opts[:progress]
681
- format = "%10s %4d %8s %8s %8d %12s %s"
682
- datefmt = "%b %d %Y"
683
- timefmt = "%b %d %H:%M"
684
- fields = %w(permissions inodes user group size date fullname)
685
- else
686
- format = "%s"
687
- fields = %w(fullname)
688
- end
689
-
690
- opts[:field] = opts[:field].intern
691
- opts[:field] = :full_name if opts[:field] == :name
692
-
693
- output = []
694
-
695
- Archive::Tar::Minitar::Input.open(input) do |inp|
696
- today = Time.now
697
- oneyear = Time.mktime(today.year - 1, today.month, today.day)
698
- inp.each do |entry|
699
- value = format % fields.map do |ff|
700
- case ff
701
- when "permissions"
702
- s = entry.directory? ? "d" : "-"
703
- s << modestr(entry.mode / 0100)
704
- s << modestr(entry.mode / 0010)
705
- s << modestr(entry.mode)
706
- when "inodes"
707
- entry.size / 512
708
- when "user"
709
- entry.uname || entry.uid || 0
710
- when "group"
711
- entry.gname || entry.gid || 0
712
- when "size"
713
- entry.size
714
- when "date"
715
- if Time.at(entry.mtime) > (oneyear)
716
- Time.at(entry.mtime).strftime(timefmt)
717
- else
718
- Time.at(entry.mtime).strftime(datefmt)
719
- end
720
- when "fullname"
721
- entry.full_name
722
- end
723
- end
724
-
725
- if opts[:sort]
726
- output << [entry.send(opts[:field]), value]
727
- else
728
- ioe[:output] << value << "\n"
729
- end
730
-
731
- end
732
- end
733
-
734
- if opts[:sort]
735
- output = output.sort { |a, b| a[0] <=> b[0] }
736
- if opts[:reverse]
737
- output.reverse_each { |oo| ioe[:output] << oo[1] << "\n" }
738
- else
739
- output.each { |oo| ioe[:output] << oo[1] << "\n" }
740
- end
741
- end
742
-
743
- 0
744
- end
745
-
746
- def help
747
- help = <<-EOH
748
- minitar list [OPTIONS] <tarfile|-> [<file>+]
749
-
750
- Lists files in an existing tarfile. If the tarfile is named .tar.gz or
751
- .tgz, then it will be uncompressed automatically. If the tarfile is "-",
752
- then it will be read from standard input (stdin) so that minitar may be
753
- piped.
754
-
755
- If --verbose or --progress is specified, then the file list will be
756
- similar to that produced by the Unix command "ls -l".
757
-
758
- list Options:
759
- --uncompress, -z Uncompresses the tarfile with gzip.
760
- --sort [<FIELD>], -S Sorts the list of files by the specified
761
- field. The sort defaults to the filename.
762
- --reverse, -R Reverses the sort.
763
- -l Lists the files in detail.
764
-
765
- Sort Fields:
766
- name, mtime, size
767
-
768
- EOH
769
- end
770
- end
771
-
772
- CommandPattern << CommandHelp
773
- CommandPattern << CommandCreate
774
- CommandPattern << CommandExtract
775
- CommandPattern << CommandList
776
- # CommandPattern << CommandAdd
777
- # CommandPattern << CommandDelete
778
-
779
- def self.run(argv, input = $stdin, output = $stdout, error = $stderr)
780
- ioe = {
781
- :input => input,
782
- :output => output,
783
- :error => error,
784
- }
785
- opts = { }
786
-
787
- if argv.include?("--version")
788
- output << <<-EOB
789
- minitar #{Archive::Tar::Minitar::VERSION}
790
- Copyright 2004 Mauricio Julio Fern�ndez Pradier and Austin Ziegler
791
- This is free software with ABSOLUTELY NO WARRANTY.
792
-
793
- see http://rubyforge.org/projects/ruwiki for more information
794
- EOB
795
- end
796
-
797
- if argv.include?("--verbose") or argv.include?("-V")
798
- opts[:verbose] = true
799
- argv.delete("--verbose")
800
- argv.delete("-V")
801
- end
802
-
803
- if argv.include?("--progress") or argv.include?("-P")
804
- opts[:progress] = true
805
- opts[:verbose] = false
806
- argv.delete("--progress")
807
- argv.delete("-P")
808
- end
809
-
810
- command = CommandPattern[(argv.shift or "").downcase]
811
- command ||= CommandPattern["help"]
812
- return command[argv, opts, ioe]
813
- end
814
- end