kyanite 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/0_rake_test.bat +2 -1
- data/1_rake_install_gem.bat +1 -1
- data/4_ruby_script_console.bat +2 -1
- data/Div +0 -0
- data/History.txt +2 -0
- data/License.txt +0 -0
- data/Manifest.txt +2 -14
- data/README.txt +4 -0
- data/Rakefile.rb +32 -30
- data/init.rb +0 -0
- data/lib/kyanite.rb +3 -3
- data/lib/kyanite/array.rb +0 -0
- data/lib/kyanite/array/array.rb +5 -31
- data/lib/kyanite/array/array2.rb +0 -0
- data/lib/kyanite/array/matrix2.rb +0 -0
- data/lib/kyanite/array_of_enumerables.rb +0 -0
- data/lib/kyanite/array_of_numerics.rb +0 -0
- data/lib/kyanite/array_of_strings.rb +0 -0
- data/lib/kyanite/basics.rb +0 -0
- data/lib/kyanite/dictionary.rb +2 -3
- data/lib/kyanite/enumerable.rb +0 -0
- data/lib/kyanite/enumerable/enumerable_enumerables.rb +1 -0
- data/lib/kyanite/enumerable/enumerable_numerics.rb +1 -1
- data/lib/kyanite/enumerable/enumerable_strings.rb +1 -0
- data/lib/kyanite/enumerable/structure.rb +5 -1
- data/lib/kyanite/general.rb +0 -0
- data/lib/kyanite/general/callerutils.rb +0 -0
- data/lib/kyanite/general/classutils.rb +4 -4
- data/lib/kyanite/general/kernel.rb +9 -12
- data/lib/kyanite/general/nil.rb +3 -1
- data/lib/kyanite/general/object.rb +2 -5
- data/lib/kyanite/general/true_false.rb +0 -0
- data/lib/kyanite/general/undoable.rb +0 -0
- data/lib/kyanite/hash.rb +8 -13
- data/lib/kyanite/matrix2.rb +0 -0
- data/lib/kyanite/nil.rb +0 -0
- data/lib/kyanite/numeric.rb +0 -0
- data/lib/kyanite/numeric/float.rb +0 -0
- data/lib/kyanite/numeric/integer.rb +0 -0
- data/lib/kyanite/numeric/numeric.rb +0 -0
- data/lib/kyanite/operation.rb +0 -0
- data/lib/kyanite/operation/call_tracker.rb +0 -0
- data/lib/kyanite/operation/rake.rb +0 -0
- data/lib/kyanite/operation/regexp.rb +0 -0
- data/lib/kyanite/operation/unit_test.rb +2 -5
- data/lib/kyanite/optimizer.rb +0 -1
- data/lib/kyanite/rake.rb +0 -0
- data/lib/kyanite/range.rb +0 -0
- data/lib/kyanite/set.rb +0 -1
- data/lib/kyanite/string.rb +1 -1
- data/lib/kyanite/string/cast.rb +0 -0
- data/lib/kyanite/string/chars.rb +24 -28
- data/lib/kyanite/string/chars_const.rb +12 -12
- data/lib/kyanite/string/diff.rb +0 -0
- data/lib/kyanite/string/div.rb +0 -0
- data/lib/kyanite/string/include.rb +0 -0
- data/lib/kyanite/string/list.rb +0 -0
- data/lib/kyanite/string/nested.rb +0 -0
- data/lib/kyanite/string/random.rb +1 -0
- data/lib/kyanite/string/split.rb +0 -0
- data/lib/kyanite/symbol.rb +0 -0
- data/lib/kyanite/tree.rb +51 -16
- data/lib/kyanite/undoable.rb +0 -0
- data/lib/kyanite/unit_test.rb +0 -0
- data/script/{console → console.rb} +0 -0
- data/smart_load_path.rb +6 -0
- data/test/_start_all.rb +3 -0
- data/test/array/test_array.rb +2 -9
- data/test/array/test_matrix2.rb +1 -5
- data/test/enumerable/test_enumerable_enumerables.rb +1 -4
- data/test/enumerable/test_enumerable_numerics.rb +35 -38
- data/test/enumerable/test_enumerable_strings.rb +1 -4
- data/test/enumerable/test_structure.rb +1 -4
- data/test/general/test_classutils.rb +1 -4
- data/test/general/test_nil.rb +1 -4
- data/test/general/test_object.rb +1 -3
- data/test/general/test_true_false.rb +1 -4
- data/test/numeric/test_numeric_integer.rb +1 -3
- data/test/string/test_cast.rb +2 -4
- data/test/string/test_chars.rb +19 -20
- data/test/string/test_diff.rb +2 -4
- data/test/string/test_list.rb +3 -4
- data/test/string/test_nested.rb +2 -4
- data/test/string/test_split.rb +2 -4
- data/test/test_dictionary.rb +2 -3
- data/test/test_hash.rb +2 -3
- data/test/test_optimizer.rb +2 -3
- data/test/test_range.rb +2 -3
- data/test/test_set.rb +17 -16
- data/test/test_tree.rb +9 -7
- metadata +105 -89
- data/config/website.yml +0 -2
- data/lib/kyanite/smart_load_path.rb +0 -2
- data/lib/kyanite/string/mgsub.rb +0 -39
- data/script/console.cmd +0 -1
- data/script/destroy +0 -14
- data/script/destroy.cmd +0 -1
- data/script/generate +0 -14
- data/script/generate.cmd +0 -1
- data/script/txt2html +0 -82
- data/script/txt2html.cmd +0 -1
- data/tasks/deployment.rake +0 -92
- data/tasks/documentation.rake +0 -28
- data/tasks/environment.rake +0 -7
data/.gemtest
ADDED
File without changes
|
data/0_rake_test.bat
CHANGED
data/1_rake_install_gem.bat
CHANGED
data/4_ruby_script_console.bat
CHANGED
data/Div
CHANGED
File without changes
|
data/History.txt
CHANGED
data/License.txt
CHANGED
File without changes
|
data/Manifest.txt
CHANGED
@@ -8,8 +8,8 @@ License.txt
|
|
8
8
|
Manifest.txt
|
9
9
|
README.txt
|
10
10
|
Rakefile.rb
|
11
|
-
config/website.yml
|
12
11
|
init.rb
|
12
|
+
smart_load_path.rb
|
13
13
|
lib/kyanite.rb
|
14
14
|
lib/kyanite/array.rb
|
15
15
|
lib/kyanite/array/array.rb
|
@@ -49,7 +49,6 @@ lib/kyanite/optimizer.rb
|
|
49
49
|
lib/kyanite/rake.rb
|
50
50
|
lib/kyanite/range.rb
|
51
51
|
lib/kyanite/set.rb
|
52
|
-
lib/kyanite/smart_load_path.rb
|
53
52
|
lib/kyanite/string.rb
|
54
53
|
lib/kyanite/string/cast.rb
|
55
54
|
lib/kyanite/string/chars.rb
|
@@ -58,7 +57,6 @@ lib/kyanite/string/diff.rb
|
|
58
57
|
lib/kyanite/string/div.rb
|
59
58
|
lib/kyanite/string/include.rb
|
60
59
|
lib/kyanite/string/list.rb
|
61
|
-
lib/kyanite/string/mgsub.rb
|
62
60
|
lib/kyanite/string/nested.rb
|
63
61
|
lib/kyanite/string/random.rb
|
64
62
|
lib/kyanite/string/split.rb
|
@@ -66,17 +64,7 @@ lib/kyanite/symbol.rb
|
|
66
64
|
lib/kyanite/tree.rb
|
67
65
|
lib/kyanite/undoable.rb
|
68
66
|
lib/kyanite/unit_test.rb
|
69
|
-
script/console
|
70
|
-
script/console.cmd
|
71
|
-
script/destroy
|
72
|
-
script/destroy.cmd
|
73
|
-
script/generate
|
74
|
-
script/generate.cmd
|
75
|
-
script/txt2html
|
76
|
-
script/txt2html.cmd
|
77
|
-
tasks/deployment.rake
|
78
|
-
tasks/documentation.rake
|
79
|
-
tasks/environment.rake
|
67
|
+
script/console.rb
|
80
68
|
test/_start_all.rb
|
81
69
|
test/array/test_array.rb
|
82
70
|
test/array/test_matrix2.rb
|
data/README.txt
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
2
|
= *Kyanite*
|
3
3
|
|
4
|
+
http://kyanite.rubyforge.org
|
5
|
+
|
4
6
|
[ | *Kyanite* | Object | Array | Set | Enumerable | Hash | ] | *Kyanite* | TrueClass | FalseClass | NilClass | Div |
|
5
7
|
---
|
6
8
|
|
@@ -8,6 +10,8 @@
|
|
8
10
|
== Features
|
9
11
|
Kyanite is a general toolbox like Facets or ActiveSupport.
|
10
12
|
* Transparent nil Handling, see NilClass
|
13
|
+
* Beautiful Rake, see Div
|
14
|
+
* Comfortable UnitTests, see Div
|
11
15
|
|
12
16
|
|
13
17
|
== Usage
|
data/Rakefile.rb
CHANGED
@@ -1,33 +1,35 @@
|
|
1
1
|
|
2
2
|
# ----------------------------------------------------------------------------------------------
|
3
|
-
#
|
3
|
+
# Deploy
|
4
4
|
#
|
5
5
|
|
6
|
-
|
6
|
+
require 'rubygems'
|
7
|
+
require 'hoe'
|
7
8
|
require File.dirname(__FILE__) + '/lib/kyanite'
|
9
|
+
# %w[rubygems rake rake/clean fileutils].each { |f| require f }
|
8
10
|
|
9
|
-
# Generate all the Rake tasks
|
10
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
11
|
-
$hoe = Hoe.new('kyanite', Kyanite::VERSION) do |p|
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
$hoe = Hoe.spec 'kyanite' do | p |
|
13
|
+
|
14
|
+
# self.rubyforge_name = 'yourgemx' # if different than 'yourgem'
|
15
|
+
|
16
|
+
p.developer('Bjoern Klippstein', 'klippstein@klippstein.com')
|
17
|
+
p.remote_rdoc_dir = '' # Release to root only one project
|
18
|
+
p.extra_deps = [ ['activesupport', '>= 3.2.8'],
|
19
|
+
['facets', '>= 2.9.3'],
|
20
|
+
['rubytree', '>= 0.8.3'] ]
|
21
|
+
|
22
|
+
# p.author = 'Bjoern Klippstein'
|
23
|
+
# p.email = 'bjoernklippstein@gmail.com'
|
15
24
|
# p.url = 'http://rapidrubyonrails.de'
|
16
|
-
p.url = 'http://kyanite.rubyforge.org'
|
25
|
+
# p.url = 'http://kyanite.rubyforge.org'
|
17
26
|
|
18
|
-
p.rubyforge_name = p.name
|
19
|
-
p.summary = 'General toolbox like Facets or ActiveSupport.'
|
20
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
21
|
-
|
22
|
-
p.
|
23
|
-
|
24
|
-
['rubytree', '>= 0.5.2'] ]
|
25
|
-
p.extra_dev_deps = [ ['newgem', ">= #{::Newgem::VERSION}"] ]
|
26
|
-
|
27
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
28
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
29
|
-
|
30
|
-
p.rsync_args = "-av --delete --exclude=statsvn/"
|
27
|
+
# p.rubyforge_name = p.name
|
28
|
+
# p.summary = 'General toolbox like Facets or ActiveSupport.'
|
29
|
+
# p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
30
|
+
# p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
31
|
+
# path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
32
|
+
# p.rsync_args = "-av --delete --exclude=statsvn/"
|
31
33
|
end
|
32
34
|
|
33
35
|
|
@@ -37,13 +39,13 @@ end
|
|
37
39
|
# Kyanite
|
38
40
|
#
|
39
41
|
|
40
|
-
$rake_tasks_ausblenden = %w{ audit bundles:tm deps:email deps:fetch deps:list manifest manifest:refresh
|
41
|
-
announce clobber clobber_docs clobber_package clobber_rdoc check_manifest
|
42
|
-
config_hoe debug_gem email features gem gemspec generate_key install_gem install_gem_no_doc
|
43
|
-
local_deploy multi package repackage post_blog ridocs
|
44
|
-
rdoc redocs rerdoc release
|
45
|
-
website website_generate website_upload }
|
46
|
-
require 'kyanite/rake'
|
42
|
+
# $rake_tasks_ausblenden = %w{ audit bundles:tm deps:email deps:fetch deps:list manifest manifest:refresh
|
43
|
+
# announce clobber clobber_docs clobber_package clobber_rdoc check_manifest
|
44
|
+
# config_hoe debug_gem email features gem gemspec generate_key install_gem install_gem_no_doc
|
45
|
+
# local_deploy multi package repackage post_blog ridocs
|
46
|
+
# rdoc redocs rerdoc release
|
47
|
+
# website website_generate website_upload }
|
48
|
+
# require 'kyanite/rake'
|
47
49
|
|
48
50
|
|
49
51
|
|
@@ -52,8 +54,8 @@ require 'kyanite/rake'
|
|
52
54
|
# Local Tasks
|
53
55
|
#
|
54
56
|
|
55
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
56
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
57
|
+
# require 'newgem/tasks' # load /tasks/*.rake
|
58
|
+
# Dir['tasks/**/*.rake'].each { |t| load t }
|
57
59
|
|
58
60
|
|
59
61
|
# TODO - want other tests/tasks run by default? Add them to the list
|
data/init.rb
CHANGED
File without changes
|
data/lib/kyanite.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
+
# ruby encoding: utf-8
|
1
2
|
|
2
3
|
# Required alle Kyanite-Libs
|
3
4
|
# -- eine Auswahl der wichtigsten Kyanite-Libs required man mit
|
4
5
|
# require 'kyanite/basics'
|
5
6
|
|
6
|
-
$KCODE = 'UTF8'
|
7
7
|
|
8
8
|
if $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
9
|
-
|
9
|
+
puts 'Path schon aktuell'
|
10
10
|
else
|
11
11
|
$:.unshift(File.dirname(__FILE__))
|
12
12
|
end
|
@@ -57,7 +57,7 @@ end
|
|
57
57
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
58
58
|
#
|
59
59
|
module Kyanite
|
60
|
-
VERSION = '0.
|
60
|
+
VERSION = '0.5.0'
|
61
61
|
end
|
62
62
|
|
63
63
|
|
data/lib/kyanite/array.rb
CHANGED
File without changes
|
data/lib/kyanite/array/array.rb
CHANGED
@@ -4,7 +4,9 @@ require 'facets/array/rotate' # Methoden rotate, rotate!
|
|
4
4
|
require 'facets/array/select' # Methode select!
|
5
5
|
require 'facets/to_hash' # Methode to_h (in der Facets-Bibliothek falsch einsortiert?)
|
6
6
|
|
7
|
-
require 'kyanite/enumerable'
|
7
|
+
require 'kyanite/enumerable/enumerable_enumerables'
|
8
|
+
require 'kyanite/enumerable/enumerable_numerics'
|
9
|
+
require 'kyanite/enumerable/enumerable_strings'
|
8
10
|
require 'kyanite/general/object' # Methode respond
|
9
11
|
require 'kyanite/general/classutils' # <=> für Class
|
10
12
|
require 'kyanite/symbol' # size
|
@@ -91,37 +93,7 @@ class Array
|
|
91
93
|
|
92
94
|
|
93
95
|
|
94
|
-
# ==================================================================================
|
95
|
-
# divide
|
96
|
-
#
|
97
|
-
|
98
96
|
|
99
|
-
|
100
|
-
# Set#divide doesn't work well recursively because Set can't handle Sets of Sets properly
|
101
|
-
#
|
102
|
-
#
|
103
|
-
# Test und Beispiel siehe TestKyaniteArray#test_divide
|
104
|
-
#
|
105
|
-
def divide(&func)
|
106
|
-
require 'tsort'
|
107
|
-
class << dig = {} # :nodoc:
|
108
|
-
include TSort
|
109
|
-
alias tsort_each_node each_key
|
110
|
-
def tsort_each_child(node, &block)
|
111
|
-
fetch(node).each(&block)
|
112
|
-
end #def
|
113
|
-
end #class
|
114
|
-
|
115
|
-
each { |u|
|
116
|
-
dig[u] = a = []
|
117
|
-
each{ |v| func.call(u, v) and a << v }
|
118
|
-
}
|
119
|
-
|
120
|
-
result = []
|
121
|
-
dig.each_strongly_connected_component { |css| result << (self.class.new(css)) }
|
122
|
-
result
|
123
|
-
end #def
|
124
|
-
|
125
97
|
|
126
98
|
|
127
99
|
|
@@ -147,6 +119,8 @@ end # class Array
|
|
147
119
|
|
148
120
|
|
149
121
|
|
122
|
+
|
123
|
+
|
150
124
|
class NilClass
|
151
125
|
def shift_complement; nil; end
|
152
126
|
end
|
data/lib/kyanite/array/array2.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/kyanite/basics.rb
CHANGED
File without changes
|
data/lib/kyanite/dictionary.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require 'facets/dictionary'
|
2
|
+
require 'hashery' # old: 'facets/dictionary'
|
3
3
|
require 'kyanite/enumerable' # is_collection?
|
4
4
|
|
5
5
|
|
@@ -14,7 +14,7 @@ require 'kyanite/enumerable' # is_collection?
|
|
14
14
|
# [ ] See TestKyaniteDictionary for tests and examples.
|
15
15
|
#
|
16
16
|
#
|
17
|
-
class Dictionary
|
17
|
+
class Dictionary < Hashery::Dictionary
|
18
18
|
|
19
19
|
def fetch_by_index(index)
|
20
20
|
@hash[order[index]]
|
@@ -107,7 +107,6 @@ end
|
|
107
107
|
#
|
108
108
|
if $0 == __FILE__
|
109
109
|
|
110
|
-
require 'perception'
|
111
110
|
test = Dictionary[ 'a', 1, 'b', 2, 'c', 3 ]
|
112
111
|
see test
|
113
112
|
see
|
data/lib/kyanite/enumerable.rb
CHANGED
File without changes
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# ruby encoding: utf-8
|
1
2
|
|
2
3
|
# [ | Kyanite | Object | Array | Set | *Enumerable* | Hash | ] | Enumerable | *EnumerableNumerics* | EnumerableStrings | EnumerableEnumerables |
|
3
4
|
# ---
|
@@ -156,7 +157,6 @@ end
|
|
156
157
|
# Ausprobieren
|
157
158
|
#
|
158
159
|
if $0 == __FILE__
|
159
|
-
require 'perception'
|
160
160
|
class Array
|
161
161
|
include EnumerableNumerics
|
162
162
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# ruby encoding: utf-8
|
2
|
+
|
3
|
+
require 'kyanite/general/object'
|
4
|
+
require 'kyanite/array/array'
|
1
5
|
|
2
6
|
|
3
7
|
|
@@ -174,7 +178,7 @@ if $0 == __FILE__
|
|
174
178
|
class Array
|
175
179
|
include Enumerable
|
176
180
|
end
|
177
|
-
|
181
|
+
|
178
182
|
|
179
183
|
test = [ ]
|
180
184
|
see test.contentclass(:precision => :all)
|
data/lib/kyanite/general.rb
CHANGED
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
require 'facets/kernel/singleton_class' # Easy access to an object‘s "special" class, otherwise known as it‘s eigen or meta class.
|
4
|
-
require 'facets/class/
|
4
|
+
require 'facets/class/descendants' # Methode descendants
|
5
5
|
|
6
6
|
|
7
7
|
# [ | Kyanite | *Object* | Array | Set | Enumerable | Hash | ] | *Object* | String | Symbol | Numeric |
|
@@ -23,8 +23,8 @@ class Class
|
|
23
23
|
# Unscharfer Vergleich zweier Klassen, z.B. für Tests
|
24
24
|
def =~(other)
|
25
25
|
return true if self == other
|
26
|
-
return true if self.
|
27
|
-
return true if other.
|
26
|
+
return true if self.descendants.include?(other)
|
27
|
+
return true if other.descendants.include?(self)
|
28
28
|
return false
|
29
29
|
end
|
30
30
|
|
@@ -60,7 +60,7 @@ class Symbol
|
|
60
60
|
# [ ] Siehe String#to_classname
|
61
61
|
# [ ] Tests and examples see TestKyaniteClassutils
|
62
62
|
#
|
63
|
-
|
63
|
+
def to_classname
|
64
64
|
self.to_s.to_classname
|
65
65
|
end
|
66
66
|
|
@@ -7,7 +7,8 @@ unless defined? WINDOWS
|
|
7
7
|
end
|
8
8
|
|
9
9
|
unless defined? RUBYDIR
|
10
|
-
RUBYDIR =
|
10
|
+
RUBYDIR = RbConfig::CONFIG['prefix']
|
11
|
+
# puts "rubydir=" + RUBYDIR
|
11
12
|
end
|
12
13
|
|
13
14
|
|
@@ -60,16 +61,18 @@ module KKernel
|
|
60
61
|
end
|
61
62
|
|
62
63
|
|
63
|
-
|
64
64
|
# [ ] Vereinfacht die require-Statements in den Tests.
|
65
65
|
# [ ] Wird in allen Kyanite-Tests angewendet, Verwendung siehe dort.
|
66
66
|
#
|
67
67
|
def smart_load_path(__file__ = nil)
|
68
68
|
__file__ = caller[0] unless __file__
|
69
69
|
dir_caller =File.dirname(__file__)
|
70
|
+
|
71
|
+
puts "dircaller " + dir_caller
|
72
|
+
|
70
73
|
patharray = dir_caller.split('/')
|
71
74
|
patharray = dir_caller.split("\\") if patharray.size == 1
|
72
|
-
libpath = File.join(patharray)
|
75
|
+
# libpath = File.join(patharray)
|
73
76
|
patharray.size.times do |i|
|
74
77
|
break if File.directory?( File.join(patharray, 'lib') )
|
75
78
|
patharray << '..'
|
@@ -82,16 +85,10 @@ module KKernel
|
|
82
85
|
return true
|
83
86
|
end
|
84
87
|
|
85
|
-
end #def
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
end #def
|
91
89
|
|
92
90
|
|
93
|
-
|
94
|
-
end # class
|
91
|
+
end # module
|
95
92
|
|
96
93
|
class Object
|
97
94
|
include KKernel
|
@@ -102,7 +99,7 @@ end
|
|
102
99
|
# Ausprobieren
|
103
100
|
#
|
104
101
|
if $0 == __FILE__
|
105
|
-
|
102
|
+
|
106
103
|
# pp RUBYDIR
|
107
104
|
|
108
105
|
smart_load_path(__FILE__)
|