facets 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. data/HISTORY.rdoc +34 -0
  2. data/{meta/profile → PROFILE} +15 -1
  3. data/README.rdoc +11 -17
  4. data/Rakefile +74 -31
  5. data/VERSION +1 -0
  6. data/lib/core-uncommon/facets/array/median.rb +17 -0
  7. data/lib/core-uncommon/facets/array/op_pow.rb +9 -0
  8. data/lib/{tour → core-uncommon}/facets/array/percentile.rb +3 -0
  9. data/lib/{tour → core-uncommon}/facets/class/preallocate.rb +3 -0
  10. data/lib/core-uncommon/facets/enumerable/has.rb +22 -0
  11. data/lib/core-uncommon/facets/enumerable/have.rb +1 -0
  12. data/lib/{tour → core-uncommon}/facets/integer/roman.rb +9 -0
  13. data/lib/{tour → core-uncommon}/facets/kernel/demo.rb +3 -0
  14. data/lib/{tour → core-uncommon}/facets/kernel/eigenclass.rb +3 -0
  15. data/lib/{tour → core-uncommon}/facets/kernel/instance_exec.rb +6 -0
  16. data/lib/{tour → core-uncommon}/facets/kernel/memo.rb +3 -0
  17. data/lib/{tour → core-uncommon}/facets/kernel/trap_chain.rb +3 -0
  18. data/lib/{tour → core-uncommon}/facets/kernel/y.rb +3 -0
  19. data/lib/{tour → core-uncommon}/facets/method/memoize.rb +3 -0
  20. data/lib/{tour → core-uncommon}/facets/module/attr_class_accessor.rb +6 -0
  21. data/lib/{tour → core-uncommon}/facets/module/attr_inheritor.rb +2 -0
  22. data/lib/{tour → core-uncommon}/facets/module/attr_tester.rb +8 -0
  23. data/lib/{tour → core-uncommon}/facets/module/attr_validator.rb +6 -0
  24. data/lib/{tour → core-uncommon}/facets/module/cattr.rb +24 -0
  25. data/lib/core-uncommon/facets/module/class_accessor.rb +33 -0
  26. data/lib/{tour → core-uncommon}/facets/module/class_extend.rb +3 -0
  27. data/lib/{tour → core-uncommon}/facets/module/class_inheritor.rb +3 -0
  28. data/lib/{tour → core-uncommon}/facets/module/copy_inheritor.rb +3 -0
  29. data/lib/{tour → core-uncommon}/facets/module/enclosure.rb +6 -0
  30. data/lib/{tour → core-uncommon}/facets/module/enclosures.rb +0 -0
  31. data/lib/{tour → core-uncommon}/facets/module/include_as.rb +0 -0
  32. data/lib/{tour → core-uncommon}/facets/module/instance_function.rb +2 -0
  33. data/lib/{tour → core-uncommon}/facets/module/memoize.rb +0 -0
  34. data/lib/{tour → core-uncommon}/facets/module/method_space.rb +5 -0
  35. data/lib/{tour → core-uncommon}/facets/module/module_load.rb +6 -0
  36. data/lib/{tour → core-uncommon}/facets/module/preextend.rb +3 -0
  37. data/lib/{tour → core-uncommon}/facets/module/prepend.rb +3 -0
  38. data/lib/{tour → core-uncommon}/facets/regexp/op_or.rb +2 -0
  39. data/lib/{tour → core-uncommon}/facets/string/crypt.rb +3 -0
  40. data/lib/{tour → core-uncommon}/facets/string/roman.rb +0 -0
  41. data/lib/core/facets.rb +19 -0
  42. data/lib/core/facets.yml +1144 -0
  43. data/lib/core/facets/applique/file_helpers.rb +4 -4
  44. data/lib/core/facets/array.rb +0 -1
  45. data/lib/core/facets/binding.rb +1 -1
  46. data/lib/core/facets/class.rb +1 -1
  47. data/lib/core/facets/comparable.rb +1 -1
  48. data/lib/core/facets/dir.rb +1 -1
  49. data/lib/core/facets/dir/recurse.rb +1 -1
  50. data/lib/core/facets/enumerable.rb +1 -1
  51. data/lib/core/facets/exception.rb +1 -1
  52. data/lib/core/facets/file.rb +1 -1
  53. data/lib/core/facets/file/create.rb +1 -1
  54. data/lib/core/facets/file/read_binary.rb +2 -2
  55. data/lib/core/facets/file/rewrite.rb +4 -4
  56. data/lib/core/facets/file/write.rb +1 -1
  57. data/lib/core/facets/file/writelines.rb +1 -1
  58. data/lib/core/facets/filetest.rb +1 -1
  59. data/lib/core/facets/filetest/absolute.rb +1 -0
  60. data/lib/core/facets/filetest/contains.rb +12 -0
  61. data/lib/core/facets/filetest/relative.rb +38 -0
  62. data/lib/core/facets/filetest/safe.rb +20 -0
  63. data/lib/core/facets/filetest/separator_pattern.rb +19 -0
  64. data/lib/core/facets/float.rb +1 -1
  65. data/lib/core/facets/hash.rb +1 -1
  66. data/lib/core/facets/integer.rb +1 -1
  67. data/lib/core/facets/kernel.rb +1 -1
  68. data/lib/core/facets/kernel/no.rb +1 -0
  69. data/lib/core/facets/kernel/object_hexid.rb +3 -1
  70. data/lib/core/facets/kernel/yes.rb +25 -0
  71. data/lib/core/facets/matchdata.rb +1 -1
  72. data/lib/core/facets/method.rb +1 -1
  73. data/lib/core/facets/module.rb +1 -1
  74. data/lib/core/facets/module/redefine_method.rb +4 -4
  75. data/lib/core/facets/nilclass.rb +1 -1
  76. data/lib/core/facets/numeric.rb +1 -1
  77. data/lib/core/facets/object.rb +1 -1
  78. data/lib/core/facets/object/replace.rb +2 -2
  79. data/lib/core/facets/objectspace.rb +1 -1
  80. data/lib/core/facets/proc.rb +1 -1
  81. data/lib/core/facets/process.rb +1 -1
  82. data/lib/core/facets/range.rb +1 -1
  83. data/lib/core/facets/regexp.rb +1 -1
  84. data/lib/core/facets/string.rb +1 -1
  85. data/lib/core/facets/string/file.rb +4 -2
  86. data/lib/core/facets/string/random_binary.rb +10 -0
  87. data/lib/core/facets/string/unquote.rb +1 -1
  88. data/lib/core/facets/struct.rb +1 -1
  89. data/lib/core/facets/symbol.rb +1 -1
  90. data/lib/core/facets/time.rb +1 -1
  91. data/lib/core/facets/unboundmethod.rb +1 -1
  92. data/lib/{more → standard}/facets/basicobject.rb +0 -0
  93. data/lib/{more → standard}/facets/cgi.rb +0 -0
  94. data/lib/{more → standard}/facets/continuation.rb +0 -0
  95. data/lib/{more → standard}/facets/date.rb +0 -0
  96. data/lib/standard/facets/digest.rb +2 -0
  97. data/lib/standard/facets/digest/base64digest.rb +45 -0
  98. data/lib/standard/facets/digest/salted_digest.rb +44 -0
  99. data/lib/{more → standard}/facets/erb.rb +0 -0
  100. data/lib/{more → standard}/facets/fileutils.rb +5 -0
  101. data/lib/standard/facets/fileutils/amass.rb +33 -0
  102. data/lib/{more → standard}/facets/fileutils/cp_rx.rb +3 -1
  103. data/lib/{more → standard}/facets/fileutils/head.rb +0 -0
  104. data/lib/standard/facets/fileutils/ln_r.rb +92 -0
  105. data/lib/standard/facets/fileutils/outofdate.rb +38 -0
  106. data/lib/{more → standard}/facets/fileutils/safe_ln.rb +0 -0
  107. data/lib/{more → standard}/facets/fileutils/slice.rb +14 -12
  108. data/lib/standard/facets/fileutils/stage.rb +66 -0
  109. data/lib/{more → standard}/facets/fileutils/tail.rb +0 -0
  110. data/lib/{more → standard}/facets/fileutils/wc.rb +0 -0
  111. data/lib/{more → standard}/facets/fileutils/whereis.rb +0 -0
  112. data/lib/{more → standard}/facets/fileutils/which.rb +2 -0
  113. data/lib/{more → standard}/facets/find.rb +0 -0
  114. data/lib/{more → standard}/facets/getoptlong.rb +0 -0
  115. data/lib/{more → standard}/facets/math.rb +1 -1
  116. data/lib/{more → standard}/facets/math/abs.rb +0 -0
  117. data/lib/{more → standard}/facets/math/acot.rb +0 -0
  118. data/lib/{more → standard}/facets/math/acoth.rb +0 -0
  119. data/lib/{more → standard}/facets/math/acsc.rb +0 -0
  120. data/lib/{more → standard}/facets/math/acsch.rb +0 -0
  121. data/lib/{more → standard}/facets/math/amd.rb +0 -0
  122. data/lib/{more → standard}/facets/math/approx_equal.rb +1 -1
  123. data/lib/{more → standard}/facets/math/asec.rb +0 -0
  124. data/lib/{more → standard}/facets/math/asech.rb +0 -0
  125. data/lib/{more → standard}/facets/math/atkinson_index.rb +0 -0
  126. data/lib/{more → standard}/facets/math/beta.rb +0 -0
  127. data/lib/{more → standard}/facets/math/cdf.rb +0 -0
  128. data/lib/{more → standard}/facets/math/ceil.rb +0 -0
  129. data/lib/{more → standard}/facets/math/cot.rb +0 -0
  130. data/lib/{more → standard}/facets/math/coth.rb +0 -0
  131. data/lib/{more → standard}/facets/math/csc.rb +0 -0
  132. data/lib/{more → standard}/facets/math/csch.rb +0 -0
  133. data/lib/{more → standard}/facets/math/delta.rb +2 -1
  134. data/lib/{more → standard}/facets/math/epsilon.rb +0 -0
  135. data/lib/{more → standard}/facets/math/exp10.rb +0 -0
  136. data/lib/{more → standard}/facets/math/exp2.rb +0 -0
  137. data/lib/{more → standard}/facets/math/factorial.rb +0 -0
  138. data/lib/{more → standard}/facets/math/floor.rb +0 -0
  139. data/lib/{more → standard}/facets/math/gamma.rb +0 -0
  140. data/lib/{more → standard}/facets/math/gcd.rb +0 -0
  141. data/lib/{more → standard}/facets/math/gini_coefficient.rb +0 -0
  142. data/lib/{more → standard}/facets/math/kldivergence.rb +0 -0
  143. data/lib/{more → standard}/facets/math/lcm.rb +0 -0
  144. data/lib/{more → standard}/facets/math/lgamma.rb +0 -0
  145. data/lib/{more → standard}/facets/math/linsolve.rb +0 -0
  146. data/lib/{more → standard}/facets/math/log2.rb +0 -0
  147. data/lib/{more → standard}/facets/math/max.rb +0 -0
  148. data/lib/{more → standard}/facets/math/mean.rb +0 -0
  149. data/lib/{more → standard}/facets/math/median.rb +0 -0
  150. data/lib/{more → standard}/facets/math/min.rb +0 -0
  151. data/lib/{more → standard}/facets/math/pow.rb +0 -0
  152. data/lib/{more → standard}/facets/math/pstd.rb +0 -0
  153. data/lib/{more → standard}/facets/math/pvariance.rb +0 -0
  154. data/lib/{more → standard}/facets/math/rmd.rb +0 -0
  155. data/lib/{more → standard}/facets/math/root.rb +0 -0
  156. data/lib/{more → standard}/facets/math/sec.rb +0 -0
  157. data/lib/{more → standard}/facets/math/sech.rb +0 -0
  158. data/lib/{more → standard}/facets/math/sign.rb +0 -0
  159. data/lib/{more → standard}/facets/math/sinc.rb +0 -0
  160. data/lib/{more → standard}/facets/math/sqr.rb +0 -0
  161. data/lib/{more → standard}/facets/math/sqsolve.rb +0 -0
  162. data/lib/{more → standard}/facets/math/std.rb +0 -0
  163. data/lib/{more → standard}/facets/math/stderr.rb +0 -0
  164. data/lib/{more → standard}/facets/math/sum.rb +0 -0
  165. data/lib/{more → standard}/facets/math/summed_sqdevs.rb +0 -0
  166. data/lib/{more → standard}/facets/math/theil_index.rb +0 -0
  167. data/lib/{more → standard}/facets/math/variance.rb +0 -0
  168. data/lib/standard/facets/net/http.rb +32 -0
  169. data/lib/{more → standard}/facets/ostruct.rb +0 -0
  170. data/lib/{more → standard}/facets/pathname.rb +1 -0
  171. data/lib/{more → standard}/facets/random.rb +2 -2
  172. data/lib/standard/facets/rbconfig.rb +78 -0
  173. data/lib/{more → standard}/facets/set.rb +0 -0
  174. data/lib/{more → standard}/facets/shellwords.rb +2 -0
  175. data/lib/standard/facets/strscan.rb +16 -0
  176. data/lib/{more → standard}/facets/thread.rb +0 -0
  177. data/lib/{more → standard}/facets/uri.rb +0 -0
  178. data/lib/{more → standard}/facets/yaml.rb +0 -0
  179. data/lib/{more → standard}/facets/zlib.rb +0 -0
  180. data/lib/{more → supplemental}/facets/argvector.rb +0 -0
  181. data/lib/{more → supplemental}/facets/atomicfile.rb +0 -0
  182. data/lib/{more → supplemental}/facets/interval.rb +0 -0
  183. data/lib/{more → supplemental}/facets/main.rb +0 -0
  184. data/lib/{more → supplemental}/facets/memoizable.rb +0 -0
  185. data/lib/{more → supplemental}/facets/metaid.rb +0 -0
  186. data/lib/{more → supplemental}/facets/multipliers.rb +0 -0
  187. data/lib/{more → supplemental}/facets/multiton.rb +0 -0
  188. data/lib/{more → supplemental}/facets/nullclass.rb +0 -0
  189. data/lib/{more → supplemental}/facets/opesc.rb +0 -0
  190. data/lib/{more → supplemental}/facets/platform.rb +156 -5
  191. data/lib/{more → supplemental}/facets/reference.rb +0 -0
  192. data/lib/{more → supplemental}/facets/timer.rb +0 -0
  193. data/lib/{more → supplemental}/facets/tuple.rb +0 -0
  194. data/qed/applique/file_helpers.rb +10 -0
  195. data/qed/{tour → core-uncommon}/module/cattr.rdoc +0 -0
  196. data/qed/{tour → core-uncommon}/module/class_extend.rdoc +0 -0
  197. data/qed/{tour → core-uncommon}/module/class_inheritor.rdoc +0 -0
  198. data/qed/{tour → core-uncommon}/module/copy_inheritor.rdoc +0 -0
  199. data/qed/{tour → core-uncommon}/module/method_space.rdoc +0 -0
  200. data/qed/{more → standard}/basic_object.rdoc +0 -0
  201. data/qed/{more → supplemental}/memoizable.rdoc +0 -0
  202. data/qed/{more → supplemental}/mulititon.rdoc +0 -0
  203. data/test/{tour → core-uncommon}/array/test_median.rb +0 -0
  204. data/test/{tour → core-uncommon}/array/test_percentile.rb +0 -0
  205. data/test/{tour → core-uncommon}/class/test_preallocate.rb +0 -0
  206. data/test/{tour → core-uncommon}/module/test_cattr.rb +0 -0
  207. data/test/{tour → core-uncommon}/module/test_class_extend.rb +0 -0
  208. data/test/{tour → core-uncommon}/module/test_class_inheritor.rb +0 -0
  209. data/test/{tour → core-uncommon}/module/test_copy_inheritor.rb +0 -0
  210. data/test/{tour → core-uncommon}/module/test_enclosure.rb +0 -0
  211. data/test/{tour → core-uncommon}/module/test_instance_function.rb +0 -0
  212. data/test/{tour → core-uncommon}/module/test_memoize.rb +0 -0
  213. data/test/{tour → core-uncommon}/module/test_method_space.rb +0 -0
  214. data/test/{tour → core-uncommon}/module/test_module_load.rb +0 -0
  215. data/test/{tour → core-uncommon}/module/test_preextend.rb +0 -0
  216. data/test/{tour → core-uncommon}/module/test_prepend.rb +0 -0
  217. data/test/core/dir/test_each_child.rb +1 -1
  218. data/test/core/dir/test_multiglob.rb +2 -2
  219. data/test/core/hash/test_zip.rb +12 -0
  220. data/test/core/{kernel → object}/test_dup.rb +51 -1
  221. data/test/core/{kernel → object}/test_object_state.rb +1 -1
  222. data/test/core/{kernel → object}/test_replace.rb +12 -12
  223. data/test/core/{kernel → object}/test_try_dup.rb +2 -2
  224. data/test/{more → standard}/test_date.rb +0 -0
  225. data/test/{more → standard}/test_ostruct.rb +0 -0
  226. data/test/{more → standard}/test_random.rb +0 -0
  227. data/test/{more → standard}/test_shellwords.rb +0 -0
  228. data/test/{more → standard}/test_thread.rb +0 -0
  229. data/test/{more → standard}/test_timer.rb +0 -0
  230. data/test/{more → standard}/test_uri.rb +0 -0
  231. data/test/{more → supplemental}/test_argvector.rb +0 -0
  232. data/test/{more → supplemental}/test_memoizable.rb +0 -0
  233. data/test/{more → supplemental}/test_multipliers.rb +0 -0
  234. data/test/{more → supplemental}/test_tuple.rb +0 -0
  235. metadata +224 -204
  236. data/lib/more/facets/rbconfig.rb +0 -150
  237. data/lib/tour/facets/array/median.rb +0 -14
  238. data/lib/tour/facets/array/op_pow.rb +0 -5
  239. data/lib/tour/facets/module/class_accessor.rb +0 -27
  240. data/meta/data.rb +0 -29
  241. data/meta/package +0 -10
  242. data/test/core/hash/test_zipnew.rb +0 -12
@@ -1,5 +1,39 @@
1
1
  = Facets Release History
2
2
 
3
+ == 2.9.1 / 2011-01-30
4
+
5
+ Primary this release fixes a couple of small issues. In addition a handful of
6
+ additonal methods have been added.
7
+
8
+ Changes:
9
+
10
+ * New Features:
11
+
12
+ * Add FileTest#absolute? and #relative?
13
+ * Add FileTest#contains?
14
+ * Add FileTest#safe?
15
+ * Add FileUtils#amass
16
+ * Add FileUtils#outofdate
17
+ * Add FileUtils#stage
18
+ * Add Kernel#yes? and Kernel#no?
19
+ * Add Enumerable#has? (TOUR library)
20
+ * Add Digest#salted_digest, etc.
21
+ * Add Digest#base64digest (1.9.2 method)
22
+ * Add String#random_binary
23
+
24
+ * Improved Features
25
+
26
+ * Better OS detection in Platform class and RBConfig module
27
+ * Moved CPU byte order methods from RBConfig to Platform class
28
+ * General improvements to Platform class API
29
+
30
+ * Bug Fixes
31
+
32
+ * Module#redefine_method need not check pre-existence of method
33
+ * Fix string/unquote.rb recursive require
34
+ * Kernel#object_hexid varies on CPU arch, bot Ruby version.
35
+
36
+
3
37
  == 2.9.0 / 2010-09-01
4
38
 
5
39
  This release is fairly extensive as it was originally intended to be v3.0.
@@ -15,10 +15,24 @@ description:
15
15
  control of requirements. In addition, Facets includes a few additional
16
16
  classes and mixins suitable to wide variety of applications.
17
17
 
18
+ requires:
19
+ - syckle (build)
20
+ - lemon (test)
21
+ - qed (test)
22
+
18
23
  resources:
19
24
  home: http://rubyworks.github.com/facets
20
25
  code: http://github.com/rubyworks/facets
21
26
  docs: http://rubyworks.github.com/facets/learn.html
22
27
  wiki: http://wiki.github.com/rubyworks/facets
23
28
  talk: http://groups.google.com/group/facets-universal
24
- repo: git@github.com:rubyworks/facets.git
29
+
30
+ repositories:
31
+ public: git@github.com:rubyworks/facets.git
32
+
33
+ loadpath:
34
+ - lib/core
35
+ - lib/core-uncommon
36
+ - lib/standard
37
+ - lib/supplemental
38
+
@@ -1,9 +1,5 @@
1
1
  = Ruby Facets
2
2
 
3
- * home: http://rubyworks.github.com/facets
4
- * code: http://github.com/rubyworks/facets
5
- * talk: http://groups.google.com/group/facets-universal
6
-
7
3
  "ALL YOUR BASE ARE BELONG TO RUBY"
8
4
 
9
5
 
@@ -83,20 +79,18 @@ At the heart of Ruby Facets is the CORE extensions library. CORE provides
83
79
  a sizable collection of generally useful methods, along with a few supporting
84
80
  classes, that extend the functionality of Ruby's core classes and modules.
85
81
 
86
- By definition CORE contains anything that will load automatically when
87
- issuing:
88
-
89
- require 'facets'
90
-
91
- If you plan to use more then a few of Facets core method it is recommended that
92
- you require the main facility.
82
+ With the exception of a few *uncommon* extensions, CORE contains anything that
83
+ will load automatically when issuing:
93
84
 
94
85
  require 'facets'
95
86
 
96
- This loads all the CORE functionality at once.
87
+ This loads all the CORE functionality at once. If you plan to use more then a
88
+ handful of Facets core methods it is recommended that you require the library in
89
+ this way.
97
90
 
98
- Of course you can use the CORE library piecemeal if you prefer. The general
99
- require statement for a core extensions library is:
91
+ Of course you can use the CORE library piecemeal if you prefer. And for uncommon
92
+ extension this must be done. The general require statement for a core extensions
93
+ library is:
100
94
 
101
95
  require 'facets/<class|module>/<method-lib>'
102
96
 
@@ -163,9 +157,9 @@ file systems. Also, if a method ends in '=', '?' or '!' it is simply removed.
163
157
 
164
158
  === MORE Library
165
159
 
166
- On top of the extensive Core library, Facet provides a small collection
167
- of additional modules and classes, as well as extended versions of
168
- modules and classes in Ruby's Standard library.
160
+ On top of the extensive CORE library, Facets provides extensions for Ruby's
161
+ standard library, as well as very small collection of additional modules and
162
+ classes to supplement it.
169
163
 
170
164
  Use the More library like you would any other 3rd party library.
171
165
  The only difference between Facets More library and other libraries
data/Rakefile CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'fileutils'
4
4
 
5
+ PATH = "lib/core:lib/core-uncommon:lib/standard:lib/supplemental"
6
+
5
7
  #
6
8
  # GENERATE RDOCS
7
9
  # ----------------------------------------------------------------------------
@@ -15,8 +17,9 @@ task "rdoc" do
15
17
  FileUtils.rm_r(APIOUT)
16
18
 
17
19
  system "rdoc -a -S -t'Facets Core API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/core' README.rdoc lib/facets/core"
18
- system "rdoc -a -S -t'Facets More API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/more' README.rdoc lib/facets/more"
19
- system "rdoc -a -S -t'Facets Tour API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/tour' README.rdoc lib/facets/tour"
20
+ system "rdoc -a -S -t'Facets More API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/core-uncommon' README.rdoc lib/facets/core-uncommon"
21
+ system "rdoc -a -S -t'Facets Standard API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/standard' README.rdoc lib/facets/standard"
22
+ system "rdoc -a -S -t'Facets Supplemental API' -T #{TEMPLATE} -m README.rdoc --op '#{APIOUT}/supplemental' README.rdoc lib/facets/supplemental"
20
23
  end
21
24
 
22
25
  #
@@ -24,35 +27,40 @@ end
24
27
  # ----------------------------------------------------------------------------
25
28
 
26
29
  task "default" do
27
- sh "lemon #{lemon_flags} -Ilib/core:lib/more:lib/tour test/core test/more test/tour"
30
+ sh "lemon #{lemon_flags} -Ilib/core:lib/core-uncommon:lib/standard:lib/supplemental test/core test/core-uncommon test/standard test/supplemental"
28
31
  end
29
32
 
30
33
  task "test" do
31
34
  if tests = ENV['TESTS']
32
- sh "lemon #{lemon_flags} -Ilib/core:lib/more:lib/tour #{tests}"
35
+ sh "lemon #{lemon_flags} -I#{PATH} #{tests}"
33
36
  else
34
- sh "lemon #{lemon_flags} -Ilib/core:lib/more:lib/tour test/core test/more test/tour"
37
+ sh "lemon #{lemon_flags} -I#{PATH} test/core test/core-uncommon test/standard test/supplemental"
35
38
  end
36
39
  end
37
40
 
38
41
  desc "run all unit tests"
39
42
  task "test:all" do
40
- sh "lemon #{lemon_flags} -Ilib/core:lib/more:lib/tour test/core test/more test/tour"
43
+ sh "lemon #{lemon_flags} -I#{PATH} test/core test/core-uncommon test/standard test/supplemental"
41
44
  end
42
45
 
43
46
  desc "run core unit tests"
44
47
  task "test:core" do
45
- sh "lemon#{lemon_flags} -Ilib/core test/core"
48
+ sh "lemon#{lemon_flags} -I#{PATH} test/core"
49
+ end
50
+
51
+ desc "run uncommon unit tests"
52
+ task "test:uncommon" do
53
+ sh "lemon #{lemon_flags} -I#{PATH} test/core-uncommon"
46
54
  end
47
55
 
48
- desc "run more unit tests"
49
- task "test:more" do
50
- sh "lemon #{lemon_flags} -Ilib/core:lib/more test/more"
56
+ desc "run standard unit tests"
57
+ task "test:standard" do
58
+ sh "lemon #{lemon_flags} -I#{PATH} test/standard"
51
59
  end
52
60
 
53
- desc "run tour unit tests"
54
- task "test:tour" do
55
- sh "lemon #{lemon_flags} -Ilib/core:lib/tour test/tour"
61
+ desc "run supplemental unit tests"
62
+ task "test:supplemental" do
63
+ sh "lemon #{lemon_flags} -I#{PATH} test/supplemental"
56
64
  end
57
65
 
58
66
  desc "run all unit tests with ActiveSupport loaded"
@@ -61,11 +69,14 @@ task 'test:all:activesupport' => [:include_activesupport, 'test:all']
61
69
  desc "run core unit tests with ActiveSupport loaded"
62
70
  task 'test:core:activesupport' => [:include_activesupport, 'test:core']
63
71
 
64
- desc "run more unit tests with ActiveSupport loaded"
65
- task 'test:more:activesupport' => [:include_activesupport, 'test:more']
72
+ desc "run uncommon unit tests with ActiveSupport loaded"
73
+ task 'test:uncommon:activesupport' => [:include_activesupport, 'test:uncommon']
66
74
 
67
- desc "run tour unit tests with ActiveSupport loaded"
68
- task 'test:more:activesupport' => [:include_activesupport, 'test:tour']
75
+ desc "run standard unit tests with ActiveSupport loaded"
76
+ task 'test:standard:activesupport' => [:include_activesupport, 'test:standard']
77
+
78
+ desc "run supplemental unit tests with ActiveSupport loaded"
79
+ task 'test:supplemental:activesupport' => [:include_activesupport, 'test:supplemental']
69
80
 
70
81
  task 'include_activesupport' do
71
82
  require 'activesupport'
@@ -84,7 +95,7 @@ end
84
95
  #
85
96
  # unless live
86
97
  # # $LOAD_PATH.unshift(File.expand_path('lib/core'))
87
- # # $LOAD_PATH.unshift(File.expand_path('lib/more'))
98
+ # # $LOAD_PATH.unshift(File.expand_path('lib/core-uncommon'))
88
99
  # paths.each do |path|
89
100
  # $LOAD_PATH.unshift(File.expand_path(path))
90
101
  # end
@@ -113,7 +124,7 @@ end
113
124
  #end
114
125
 
115
126
  #def prepare_tests_all
116
- # add_loadpath('lib/core','lib/more', 'lib/tour')
127
+ # add_loadpath('lib/core','lib/core-uncommon', 'lib/tour')
117
128
  # files = get_tests
118
129
  # run_tests(files)
119
130
  #end
@@ -129,7 +140,7 @@ end
129
140
  #
130
141
  # unless live
131
142
  # $LOAD_PATH.unshift(File.expand_path('lib/core'))
132
- # $LOAD_PATH.unshift(File.expand_path('lib/more'))
143
+ # $LOAD_PATH.unshift(File.expand_path('lib/core-uncommon'))
133
144
  # end
134
145
  #
135
146
  # puts "RUBY VERSION: #{RUBY_VERSION}"
@@ -163,7 +174,7 @@ end
163
174
 
164
175
  desc "show test coverage"
165
176
  task "cov" do
166
- sh "lemon -Ilib/core:lib/more:lib/tour -c test/core test/more test/tour"
177
+ sh "lemon -Ilib/core:lib/core-uncommon:lib/tour -c test/core test/core-uncommon test/tour"
167
178
  end
168
179
 
169
180
  desc "show core test coverage"
@@ -173,12 +184,17 @@ end
173
184
 
174
185
  desc "show more test coverage"
175
186
  task "cov:more" do
176
- sh "lemon -Ilib/more -c test/more"
187
+ sh "lemon -Ilib/core-uncommon -c test/core-uncommon"
188
+ end
189
+
190
+ desc "show standard test coverage"
191
+ task "cov:tour" do
192
+ sh "lemon -Ilib/standard -c test/standard"
177
193
  end
178
194
 
179
- desc "show tour test coverage"
195
+ desc "show supplemental test coverage"
180
196
  task "cov:tour" do
181
- sh "lemon -Ilib/tour -c test/tour"
197
+ sh "lemon -Ilib/supplemental -c test/supplemental"
182
198
  end
183
199
 
184
200
  desc "show core coverage by file name"
@@ -219,25 +235,30 @@ end
219
235
 
220
236
  desc "run qed docs"
221
237
  task 'qed' do
222
- sh "qed #{qed_flags} -Ilib/core:lib/more:lib/tour qed/core qed/more qed/tour"
238
+ sh "qed #{qed_flags} -I#{PATH} qed/core qed/core-uncommon qed/standard qed/supplemental"
223
239
  end
224
240
 
225
241
  desc "run core qed docs"
226
242
  task 'qed:core' do
227
- sh "qed #{qed_flags} -Ilib/core qed/core"
243
+ sh "qed #{qed_flags} -I#{PATH} qed/core"
228
244
  end
229
245
 
230
246
  desc "run more qed docs"
231
247
  task 'qed:more' do
232
- sh "qed #{qed_flags} -Ilib/core:lib/more qed/more"
248
+ sh "qed #{qed_flags} -I#{PATH} qed/core-uncommon"
233
249
  end
234
250
 
235
- desc "run tour qed docs"
236
- task 'qed:tour' do
237
- sh "qed #{qed_flags} -Ilib/core:lib/tour qed/tour"
251
+ desc "run standard qed docs"
252
+ task 'qed:standard' do
253
+ sh "qed #{qed_flags} -I#{PATH} qed/standard"
238
254
  end
239
255
 
240
- desc "run core qed docs"
256
+ desc "run supplemental qed docs"
257
+ task 'qed:supplemental' do
258
+ sh "qed #{qed_flags} -I#{PATH} qed/supplemental"
259
+ end
260
+
261
+ desc "run core qed from code base"
241
262
  task 'qed:code' do
242
263
  sh "qed #{qed_flags} -c -Ilib/core lib/core"
243
264
  end
@@ -315,3 +336,25 @@ task :uninstall do
315
336
  puts "or 'gem install setup'."
316
337
  end
317
338
  end
339
+
340
+
341
+ #
342
+ # CHECK CHERRY PICKING
343
+ # ----------------------------------------------------------------------------
344
+
345
+ namespace :check do
346
+
347
+ desc 'check cherry pickability'
348
+ task 'cherry' do
349
+ files = Dir['lib/**/*.rb']
350
+ files.each do |file|
351
+ out = `ruby -Ilib #{file}`
352
+ if out != ''
353
+ puts file
354
+ puts out
355
+ end
356
+ end
357
+ end
358
+
359
+ end
360
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.9.1
@@ -0,0 +1,17 @@
1
+ require 'facets/array/percentile'
2
+
3
+ class Array
4
+
5
+ # Returns the median for the array; nil if array is empty.
6
+ #
7
+ # NOTE: This is not (presently) a common core extension and is not
8
+ # loaded automatically when using <code>require 'facets'</code>.
9
+ #--
10
+ # TODO: Does Array#median belong in a math-oriented library?
11
+ #++
12
+ def median
13
+ percentile(50)
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,9 @@
1
+ require 'facets/array/product'
2
+
3
+ class Array
4
+ # Array#** is an alias for Array#product.
5
+ #
6
+ # NOTE: This is not (presently) a common core extension and is not
7
+ # loaded automatically when using <code>require 'facets'</code>.
8
+ alias_method :**, :product
9
+ end
@@ -7,6 +7,9 @@ class Array
7
7
  #
8
8
  # Algorithm from NIST[http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm]
9
9
  #
10
+ # NOTE: This is not (presently) a common core extension and is not
11
+ # loaded automatically when using <code>require 'facets'</code>.
12
+ #
10
13
  # CREDT: ?
11
14
 
12
15
  def percentile(p)
@@ -26,6 +26,9 @@ class Class
26
26
  # of the class heirarchy instead. For this reason, this method has been
27
27
  # named #preallocate, rather than #prepend.
28
28
  #
29
+ # NOTE: This is not (presently) a common core extension and is not
30
+ # loaded automatically when using <code>require 'facets'</code>.
31
+ #
29
32
  # CREDIT: Trans
30
33
 
31
34
  def preallocate(aspect)
@@ -0,0 +1,22 @@
1
+ module Enumerable
2
+
3
+ # The same as #include?() but equality is tested using ===.
4
+ #
5
+ # [1, 2, "a"].has?(2) #=> true
6
+ # [1, 2, "a"].has?(String) #=> true
7
+ # [1, 2, "a"].has?(3) #=> false
8
+ #
9
+ # NOTE: This is not (presently) a common core extension and is not
10
+ # loaded automatically when using <code>require 'facets'</code>.
11
+ #
12
+ # TODO: Perhaps #matches? would be a better name?
13
+ #
14
+ # CREDIT: Lavir the Whiolet
15
+ def has?(what)
16
+ any? { |x| what === x }
17
+ end
18
+
19
+ # Alias for #has?
20
+ alias have? has?
21
+
22
+ end
@@ -0,0 +1 @@
1
+ require 'facets/enumerable/has'
@@ -21,6 +21,9 @@ class Integer
21
21
  ] unless const_defined?(:ROMAN_VALUES)
22
22
 
23
23
  # Converts this integer to a roman numeral.
24
+ #
25
+ # NOTE: This is not (presently) a common core extension and is not
26
+ # loaded automatically when using <code>require 'facets'</code>.
24
27
  def roman
25
28
  int = self
26
29
  #return nil if integer > ROMAN_MAX
@@ -45,6 +48,9 @@ class String
45
48
 
46
49
  # Considers string a Roman numeral numeral,
47
50
  # and converts it to the corresponding integer.
51
+ #
52
+ # NOTE: This is not (presently) a common core extension and is not
53
+ # loaded automatically when using <code>require 'facets'</code>.
48
54
  def roman
49
55
  roman = upcase
50
56
  raise unless roman?
@@ -60,6 +66,9 @@ class String
60
66
  end
61
67
 
62
68
  # Returns true iif the subject is a valid Roman numeral.
69
+ #
70
+ # NOTE: This is not (presently) a common core extension and is not
71
+ # loaded automatically when using <code>require 'facets'</code>.
63
72
  def roman?
64
73
  ROMAN =~ upcase
65
74
  end
@@ -15,6 +15,9 @@ module Kernel
15
15
  #
16
16
  # TODO: Is there a way to do this without the eval string in block?
17
17
  # Preferably just a block and no string.
18
+ #
19
+ # NOTE: This is not (presently) a common core extension and is not
20
+ # loaded automatically when using <code>require 'facets'</code>.
18
21
 
19
22
  def demo(out=$stdout,&block)
20
23
  out << sprintf("%-25s#=> %s\n", expr = block.call, eval(expr, block.binding).inspect)
@@ -8,6 +8,9 @@ module Kernel
8
8
  # unclasped and bearing north toward chilled shrimp.
9
9
  # I know what my Hallowe’en pumpkin is going to say.
10
10
  #
11
+ # NOTE: This is not (presently) a common core extension and is not
12
+ # loaded automatically when using <code>require 'facets'</code>.
13
+ #
11
14
  # CREDIT: WhyTheLuckyStiff
12
15
 
13
16
  def eigenclass