facets 2.9.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.rdoc +34 -0
- data/{meta/profile → PROFILE} +15 -1
- data/README.rdoc +11 -17
- data/Rakefile +74 -31
- data/VERSION +1 -0
- data/lib/core-uncommon/facets/array/median.rb +17 -0
- data/lib/core-uncommon/facets/array/op_pow.rb +9 -0
- data/lib/{tour → core-uncommon}/facets/array/percentile.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/class/preallocate.rb +3 -0
- data/lib/core-uncommon/facets/enumerable/has.rb +22 -0
- data/lib/core-uncommon/facets/enumerable/have.rb +1 -0
- data/lib/{tour → core-uncommon}/facets/integer/roman.rb +9 -0
- data/lib/{tour → core-uncommon}/facets/kernel/demo.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/kernel/eigenclass.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/kernel/instance_exec.rb +6 -0
- data/lib/{tour → core-uncommon}/facets/kernel/memo.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/kernel/trap_chain.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/kernel/y.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/method/memoize.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/module/attr_class_accessor.rb +6 -0
- data/lib/{tour → core-uncommon}/facets/module/attr_inheritor.rb +2 -0
- data/lib/{tour → core-uncommon}/facets/module/attr_tester.rb +8 -0
- data/lib/{tour → core-uncommon}/facets/module/attr_validator.rb +6 -0
- data/lib/{tour → core-uncommon}/facets/module/cattr.rb +24 -0
- data/lib/core-uncommon/facets/module/class_accessor.rb +33 -0
- data/lib/{tour → core-uncommon}/facets/module/class_extend.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/module/class_inheritor.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/module/copy_inheritor.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/module/enclosure.rb +6 -0
- data/lib/{tour → core-uncommon}/facets/module/enclosures.rb +0 -0
- data/lib/{tour → core-uncommon}/facets/module/include_as.rb +0 -0
- data/lib/{tour → core-uncommon}/facets/module/instance_function.rb +2 -0
- data/lib/{tour → core-uncommon}/facets/module/memoize.rb +0 -0
- data/lib/{tour → core-uncommon}/facets/module/method_space.rb +5 -0
- data/lib/{tour → core-uncommon}/facets/module/module_load.rb +6 -0
- data/lib/{tour → core-uncommon}/facets/module/preextend.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/module/prepend.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/regexp/op_or.rb +2 -0
- data/lib/{tour → core-uncommon}/facets/string/crypt.rb +3 -0
- data/lib/{tour → core-uncommon}/facets/string/roman.rb +0 -0
- data/lib/core/facets.rb +19 -0
- data/lib/core/facets.yml +1144 -0
- data/lib/core/facets/applique/file_helpers.rb +4 -4
- data/lib/core/facets/array.rb +0 -1
- data/lib/core/facets/binding.rb +1 -1
- data/lib/core/facets/class.rb +1 -1
- data/lib/core/facets/comparable.rb +1 -1
- data/lib/core/facets/dir.rb +1 -1
- data/lib/core/facets/dir/recurse.rb +1 -1
- data/lib/core/facets/enumerable.rb +1 -1
- data/lib/core/facets/exception.rb +1 -1
- data/lib/core/facets/file.rb +1 -1
- data/lib/core/facets/file/create.rb +1 -1
- data/lib/core/facets/file/read_binary.rb +2 -2
- data/lib/core/facets/file/rewrite.rb +4 -4
- data/lib/core/facets/file/write.rb +1 -1
- data/lib/core/facets/file/writelines.rb +1 -1
- data/lib/core/facets/filetest.rb +1 -1
- data/lib/core/facets/filetest/absolute.rb +1 -0
- data/lib/core/facets/filetest/contains.rb +12 -0
- data/lib/core/facets/filetest/relative.rb +38 -0
- data/lib/core/facets/filetest/safe.rb +20 -0
- data/lib/core/facets/filetest/separator_pattern.rb +19 -0
- data/lib/core/facets/float.rb +1 -1
- data/lib/core/facets/hash.rb +1 -1
- data/lib/core/facets/integer.rb +1 -1
- data/lib/core/facets/kernel.rb +1 -1
- data/lib/core/facets/kernel/no.rb +1 -0
- data/lib/core/facets/kernel/object_hexid.rb +3 -1
- data/lib/core/facets/kernel/yes.rb +25 -0
- data/lib/core/facets/matchdata.rb +1 -1
- data/lib/core/facets/method.rb +1 -1
- data/lib/core/facets/module.rb +1 -1
- data/lib/core/facets/module/redefine_method.rb +4 -4
- data/lib/core/facets/nilclass.rb +1 -1
- data/lib/core/facets/numeric.rb +1 -1
- data/lib/core/facets/object.rb +1 -1
- data/lib/core/facets/object/replace.rb +2 -2
- data/lib/core/facets/objectspace.rb +1 -1
- data/lib/core/facets/proc.rb +1 -1
- data/lib/core/facets/process.rb +1 -1
- data/lib/core/facets/range.rb +1 -1
- data/lib/core/facets/regexp.rb +1 -1
- data/lib/core/facets/string.rb +1 -1
- data/lib/core/facets/string/file.rb +4 -2
- data/lib/core/facets/string/random_binary.rb +10 -0
- data/lib/core/facets/string/unquote.rb +1 -1
- data/lib/core/facets/struct.rb +1 -1
- data/lib/core/facets/symbol.rb +1 -1
- data/lib/core/facets/time.rb +1 -1
- data/lib/core/facets/unboundmethod.rb +1 -1
- data/lib/{more → standard}/facets/basicobject.rb +0 -0
- data/lib/{more → standard}/facets/cgi.rb +0 -0
- data/lib/{more → standard}/facets/continuation.rb +0 -0
- data/lib/{more → standard}/facets/date.rb +0 -0
- data/lib/standard/facets/digest.rb +2 -0
- data/lib/standard/facets/digest/base64digest.rb +45 -0
- data/lib/standard/facets/digest/salted_digest.rb +44 -0
- data/lib/{more → standard}/facets/erb.rb +0 -0
- data/lib/{more → standard}/facets/fileutils.rb +5 -0
- data/lib/standard/facets/fileutils/amass.rb +33 -0
- data/lib/{more → standard}/facets/fileutils/cp_rx.rb +3 -1
- data/lib/{more → standard}/facets/fileutils/head.rb +0 -0
- data/lib/standard/facets/fileutils/ln_r.rb +92 -0
- data/lib/standard/facets/fileutils/outofdate.rb +38 -0
- data/lib/{more → standard}/facets/fileutils/safe_ln.rb +0 -0
- data/lib/{more → standard}/facets/fileutils/slice.rb +14 -12
- data/lib/standard/facets/fileutils/stage.rb +66 -0
- data/lib/{more → standard}/facets/fileutils/tail.rb +0 -0
- data/lib/{more → standard}/facets/fileutils/wc.rb +0 -0
- data/lib/{more → standard}/facets/fileutils/whereis.rb +0 -0
- data/lib/{more → standard}/facets/fileutils/which.rb +2 -0
- data/lib/{more → standard}/facets/find.rb +0 -0
- data/lib/{more → standard}/facets/getoptlong.rb +0 -0
- data/lib/{more → standard}/facets/math.rb +1 -1
- data/lib/{more → standard}/facets/math/abs.rb +0 -0
- data/lib/{more → standard}/facets/math/acot.rb +0 -0
- data/lib/{more → standard}/facets/math/acoth.rb +0 -0
- data/lib/{more → standard}/facets/math/acsc.rb +0 -0
- data/lib/{more → standard}/facets/math/acsch.rb +0 -0
- data/lib/{more → standard}/facets/math/amd.rb +0 -0
- data/lib/{more → standard}/facets/math/approx_equal.rb +1 -1
- data/lib/{more → standard}/facets/math/asec.rb +0 -0
- data/lib/{more → standard}/facets/math/asech.rb +0 -0
- data/lib/{more → standard}/facets/math/atkinson_index.rb +0 -0
- data/lib/{more → standard}/facets/math/beta.rb +0 -0
- data/lib/{more → standard}/facets/math/cdf.rb +0 -0
- data/lib/{more → standard}/facets/math/ceil.rb +0 -0
- data/lib/{more → standard}/facets/math/cot.rb +0 -0
- data/lib/{more → standard}/facets/math/coth.rb +0 -0
- data/lib/{more → standard}/facets/math/csc.rb +0 -0
- data/lib/{more → standard}/facets/math/csch.rb +0 -0
- data/lib/{more → standard}/facets/math/delta.rb +2 -1
- data/lib/{more → standard}/facets/math/epsilon.rb +0 -0
- data/lib/{more → standard}/facets/math/exp10.rb +0 -0
- data/lib/{more → standard}/facets/math/exp2.rb +0 -0
- data/lib/{more → standard}/facets/math/factorial.rb +0 -0
- data/lib/{more → standard}/facets/math/floor.rb +0 -0
- data/lib/{more → standard}/facets/math/gamma.rb +0 -0
- data/lib/{more → standard}/facets/math/gcd.rb +0 -0
- data/lib/{more → standard}/facets/math/gini_coefficient.rb +0 -0
- data/lib/{more → standard}/facets/math/kldivergence.rb +0 -0
- data/lib/{more → standard}/facets/math/lcm.rb +0 -0
- data/lib/{more → standard}/facets/math/lgamma.rb +0 -0
- data/lib/{more → standard}/facets/math/linsolve.rb +0 -0
- data/lib/{more → standard}/facets/math/log2.rb +0 -0
- data/lib/{more → standard}/facets/math/max.rb +0 -0
- data/lib/{more → standard}/facets/math/mean.rb +0 -0
- data/lib/{more → standard}/facets/math/median.rb +0 -0
- data/lib/{more → standard}/facets/math/min.rb +0 -0
- data/lib/{more → standard}/facets/math/pow.rb +0 -0
- data/lib/{more → standard}/facets/math/pstd.rb +0 -0
- data/lib/{more → standard}/facets/math/pvariance.rb +0 -0
- data/lib/{more → standard}/facets/math/rmd.rb +0 -0
- data/lib/{more → standard}/facets/math/root.rb +0 -0
- data/lib/{more → standard}/facets/math/sec.rb +0 -0
- data/lib/{more → standard}/facets/math/sech.rb +0 -0
- data/lib/{more → standard}/facets/math/sign.rb +0 -0
- data/lib/{more → standard}/facets/math/sinc.rb +0 -0
- data/lib/{more → standard}/facets/math/sqr.rb +0 -0
- data/lib/{more → standard}/facets/math/sqsolve.rb +0 -0
- data/lib/{more → standard}/facets/math/std.rb +0 -0
- data/lib/{more → standard}/facets/math/stderr.rb +0 -0
- data/lib/{more → standard}/facets/math/sum.rb +0 -0
- data/lib/{more → standard}/facets/math/summed_sqdevs.rb +0 -0
- data/lib/{more → standard}/facets/math/theil_index.rb +0 -0
- data/lib/{more → standard}/facets/math/variance.rb +0 -0
- data/lib/standard/facets/net/http.rb +32 -0
- data/lib/{more → standard}/facets/ostruct.rb +0 -0
- data/lib/{more → standard}/facets/pathname.rb +1 -0
- data/lib/{more → standard}/facets/random.rb +2 -2
- data/lib/standard/facets/rbconfig.rb +78 -0
- data/lib/{more → standard}/facets/set.rb +0 -0
- data/lib/{more → standard}/facets/shellwords.rb +2 -0
- data/lib/standard/facets/strscan.rb +16 -0
- data/lib/{more → standard}/facets/thread.rb +0 -0
- data/lib/{more → standard}/facets/uri.rb +0 -0
- data/lib/{more → standard}/facets/yaml.rb +0 -0
- data/lib/{more → standard}/facets/zlib.rb +0 -0
- data/lib/{more → supplemental}/facets/argvector.rb +0 -0
- data/lib/{more → supplemental}/facets/atomicfile.rb +0 -0
- data/lib/{more → supplemental}/facets/interval.rb +0 -0
- data/lib/{more → supplemental}/facets/main.rb +0 -0
- data/lib/{more → supplemental}/facets/memoizable.rb +0 -0
- data/lib/{more → supplemental}/facets/metaid.rb +0 -0
- data/lib/{more → supplemental}/facets/multipliers.rb +0 -0
- data/lib/{more → supplemental}/facets/multiton.rb +0 -0
- data/lib/{more → supplemental}/facets/nullclass.rb +0 -0
- data/lib/{more → supplemental}/facets/opesc.rb +0 -0
- data/lib/{more → supplemental}/facets/platform.rb +156 -5
- data/lib/{more → supplemental}/facets/reference.rb +0 -0
- data/lib/{more → supplemental}/facets/timer.rb +0 -0
- data/lib/{more → supplemental}/facets/tuple.rb +0 -0
- data/qed/applique/file_helpers.rb +10 -0
- data/qed/{tour → core-uncommon}/module/cattr.rdoc +0 -0
- data/qed/{tour → core-uncommon}/module/class_extend.rdoc +0 -0
- data/qed/{tour → core-uncommon}/module/class_inheritor.rdoc +0 -0
- data/qed/{tour → core-uncommon}/module/copy_inheritor.rdoc +0 -0
- data/qed/{tour → core-uncommon}/module/method_space.rdoc +0 -0
- data/qed/{more → standard}/basic_object.rdoc +0 -0
- data/qed/{more → supplemental}/memoizable.rdoc +0 -0
- data/qed/{more → supplemental}/mulititon.rdoc +0 -0
- data/test/{tour → core-uncommon}/array/test_median.rb +0 -0
- data/test/{tour → core-uncommon}/array/test_percentile.rb +0 -0
- data/test/{tour → core-uncommon}/class/test_preallocate.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_cattr.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_class_extend.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_class_inheritor.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_copy_inheritor.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_enclosure.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_instance_function.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_memoize.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_method_space.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_module_load.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_preextend.rb +0 -0
- data/test/{tour → core-uncommon}/module/test_prepend.rb +0 -0
- data/test/core/dir/test_each_child.rb +1 -1
- data/test/core/dir/test_multiglob.rb +2 -2
- data/test/core/hash/test_zip.rb +12 -0
- data/test/core/{kernel → object}/test_dup.rb +51 -1
- data/test/core/{kernel → object}/test_object_state.rb +1 -1
- data/test/core/{kernel → object}/test_replace.rb +12 -12
- data/test/core/{kernel → object}/test_try_dup.rb +2 -2
- data/test/{more → standard}/test_date.rb +0 -0
- data/test/{more → standard}/test_ostruct.rb +0 -0
- data/test/{more → standard}/test_random.rb +0 -0
- data/test/{more → standard}/test_shellwords.rb +0 -0
- data/test/{more → standard}/test_thread.rb +0 -0
- data/test/{more → standard}/test_timer.rb +0 -0
- data/test/{more → standard}/test_uri.rb +0 -0
- data/test/{more → supplemental}/test_argvector.rb +0 -0
- data/test/{more → supplemental}/test_memoizable.rb +0 -0
- data/test/{more → supplemental}/test_multipliers.rb +0 -0
- data/test/{more → supplemental}/test_tuple.rb +0 -0
- metadata +224 -204
- data/lib/more/facets/rbconfig.rb +0 -150
- data/lib/tour/facets/array/median.rb +0 -14
- data/lib/tour/facets/array/op_pow.rb +0 -5
- data/lib/tour/facets/module/class_accessor.rb +0 -27
- data/meta/data.rb +0 -29
- data/meta/package +0 -10
- data/test/core/hash/test_zipnew.rb +0 -12
data/HISTORY.rdoc
CHANGED
@@ -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.
|
data/{meta/profile → PROFILE}
RENAMED
@@ -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
|
-
|
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
|
+
|
data/README.rdoc
CHANGED
@@ -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
|
-
|
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.
|
99
|
-
require statement for a core extensions
|
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
|
167
|
-
|
168
|
-
|
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}/
|
19
|
-
system "rdoc -a -S -t'Facets
|
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/
|
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} -
|
35
|
+
sh "lemon #{lemon_flags} -I#{PATH} #{tests}"
|
33
36
|
else
|
34
|
-
sh "lemon #{lemon_flags} -
|
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} -
|
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}
|
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
|
49
|
-
task "test:
|
50
|
-
sh "lemon #{lemon_flags} -
|
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
|
54
|
-
task "test:
|
55
|
-
sh "lemon #{lemon_flags} -
|
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
|
65
|
-
task 'test:
|
72
|
+
desc "run uncommon unit tests with ActiveSupport loaded"
|
73
|
+
task 'test:uncommon:activesupport' => [:include_activesupport, 'test:uncommon']
|
66
74
|
|
67
|
-
desc "run
|
68
|
-
task 'test:
|
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/
|
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/
|
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/
|
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/
|
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/
|
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
|
195
|
+
desc "show supplemental test coverage"
|
180
196
|
task "cov:tour" do
|
181
|
-
sh "lemon -Ilib/
|
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} -
|
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} -
|
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} -
|
248
|
+
sh "qed #{qed_flags} -I#{PATH} qed/core-uncommon"
|
233
249
|
end
|
234
250
|
|
235
|
-
desc "run
|
236
|
-
task 'qed:
|
237
|
-
sh "qed #{qed_flags} -
|
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
|
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
|