potrubi 0.0.3 → 0.0.4
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/lib/potrubi.rb +1 -1
- data/lib/potrubi/bootstrap.rb +1 -1
- data/lib/potrubi/core.rb +3 -3
- data/lib/potrubi/dsl.rb +86 -0
- data/lib/potrubi/dsl/accessor.rb +76 -0
- data/lib/potrubi/dsl/cache_2d.rb +811 -0
- data/lib/potrubi/dsl/contract.rb +731 -0
- data/lib/potrubi/dsl/super.rb +517 -0
- data/lib/potrubi/klass/syntax/alias.rb +150 -0
- data/lib/potrubi/klass/syntax/braket.rb +115 -25
- data/lib/potrubi/klass/syntax/builder.rb +45 -0
- data/lib/potrubi/klass/syntax/method.rb +436 -0
- data/lib/potrubi/klass/syntax/mixin/name_generation.rb +85 -0
- data/lib/potrubi/klass/syntax/mixin/new_aliases.rb +76 -0
- data/lib/potrubi/klass/syntax/mixin/new_brakets.rb +89 -0
- data/lib/potrubi/klass/syntax/mixin/new_methods.rb +158 -0
- data/lib/potrubi/klass/syntax/mixin/new_snippets.rb +74 -0
- data/lib/potrubi/klass/syntax/mixin/new_statements.rb +0 -0
- data/lib/potrubi/klass/syntax/mixin/statement_management.rb +69 -0
- data/lib/potrubi/klass/syntax/mixin/synel_management.rb +168 -0
- data/lib/potrubi/klass/syntax/snippet.rb +386 -0
- data/lib/potrubi/klass/syntax/statement.rb +91 -0
- data/lib/potrubi/klass/syntax/super.rb +88 -0
- data/lib/potrubi/mixin/bootstrap_common.rb +38 -12
- data/lib/potrubi/mixin/configuration.rb +31 -3
- data/lib/potrubi/mixin/contract.rb +5 -14
- data/lib/potrubi/mixin/contract/recipes.rb +307 -0
- data/lib/potrubi/mixin/dynamic-recipes.rb +1 -11
- data/lib/potrubi/mixin/dynamic.rb +223 -115
- data/lib/potrubi/mixin/exception.rb +3 -22
- data/lib/potrubi/mixin/filesys.rb +5 -21
- data/lib/potrubi/mixin/initialize.rb +11 -6
- data/lib/potrubi/mixin/konstant.rb +14 -118
- data/lib/potrubi/mixin/logger.rb +28 -41
- data/lib/potrubi/mixin/pathandnames.rb +4 -34
- data/lib/potrubi/mixin/persistence.rb +115 -10
- data/lib/potrubi/mixin/script.rb +0 -5
- data/lib/potrubi/mixin/{text-snippets → snippet-dictionaries}/methods-text-snippets.rb +138 -49
- data/lib/potrubi/mixin/{text-snippets.rb → snippet-manager.rb} +51 -39
- data/lib/potrubi/mixin/util.rb +66 -20
- data/lib/potrubi/version.rb +1 -1
- data/test/potrubi/mixin/bootstrap_common.rb +205 -0
- data/test/potrubi/mixin/konstant.rb +216 -0
- data/test/potrubi/mixin/logger.rb +124 -0
- data/test/ts_bootstrap_mixins.rb +16 -0
- data/test/ts_core_mixins.rb +7 -0
- metadata +31 -6
- data/lib/potrubi/mixin/contract-recipes.rb +0 -226
@@ -20,11 +20,8 @@ mixinContent = Module.new do
|
|
20
20
|
Object.class_eval(errorText)
|
21
21
|
|
22
22
|
def raise_exception(exceptionTypeNom, *tellTales)
|
23
|
-
#puts "RAISE EXCEPTION CALLED"
|
24
23
|
exceptionTypeNrm = exceptionTypeNom.is_a?(Exception) ? exceptionTypeNom : RuntimeError # was an exxception type given? Default to Rumtime
|
25
24
|
tellTale = (exceptionTypeNrm == exceptionTypeNom) ? logger_format_telltales(*tellTales) : logger_format_telltales(exceptionTypeNom, *tellTales)
|
26
|
-
#error_message('RAISE EXCEPTION:', exceptionTypeNrm.class.name.upcase, *tellTales)
|
27
|
-
#puts caller
|
28
25
|
raise(exceptionTypeNrm,tellTale,caller)
|
29
26
|
end
|
30
27
|
|
@@ -33,30 +30,15 @@ mixinContent = Module.new do
|
|
33
30
|
end
|
34
31
|
|
35
32
|
exceptionMethods = {
|
36
|
-
#:deprecated_method => nil,
|
37
|
-
#:wrong_class => nil,
|
38
33
|
:unsupported => nil,
|
39
34
|
:surprise => nil,
|
40
35
|
:duplicate => nil,
|
41
36
|
:missing => nil,
|
42
37
|
:contract => nil,
|
43
|
-
#:too_small => nil,
|
44
|
-
#:unequal => nil,
|
45
|
-
#:value => nil,
|
46
|
-
#:instantiation => nil,
|
47
|
-
#:unknown_attribute => nil,
|
48
|
-
#:nil => nil,
|
49
38
|
:nomethod => nil,
|
50
|
-
#:method => nil,
|
51
|
-
#:file_not_found => nil,
|
52
|
-
#:file_not_writeable => nil,
|
53
|
-
#:runtime => nil,
|
54
|
-
#:require => nil,
|
55
|
-
#:chain => nil,
|
56
39
|
:size => nil,
|
57
40
|
:empty => nil,
|
58
41
|
:connection => nil,
|
59
|
-
#:argument => nil,
|
60
42
|
}
|
61
43
|
|
62
44
|
Potrubi::Mixin::Dynamic::dynamic_define_methods(self, exceptionMethods) do | exceptionMethod, exceptionType |
|
@@ -66,7 +48,6 @@ mixinContent = Module.new do
|
|
66
48
|
METHOD_NAME: "#{exceptionMethod}_exception",
|
67
49
|
EXCEPTION_NAME: "#{exceptionMethod}",
|
68
50
|
EXCEPTION_TYPE: excType.to_s.split('_').map{|a| a.capitalize }.join.sub(/\Z/,'Error'),
|
69
|
-
###EYENAME: ":'exc_#{exceptionMethod}'",
|
70
51
|
}
|
71
52
|
|
72
53
|
textException = <<-'ENDOFHERE'
|
@@ -74,10 +55,10 @@ mixinContent = Module.new do
|
|
74
55
|
raise_exception(EXCEPTION_TYPE, *args, "value >#{value.class}< >#{value}<")
|
75
56
|
end;
|
76
57
|
ENDOFHERE
|
58
|
+
|
59
|
+
{edit: edits, spec: textException}
|
77
60
|
|
78
|
-
|
79
|
-
|
80
|
-
end
|
61
|
+
end
|
81
62
|
|
82
63
|
end
|
83
64
|
|
@@ -5,49 +5,37 @@ require_relative '../core'
|
|
5
5
|
|
6
6
|
require 'fileutils'
|
7
7
|
|
8
|
-
#requireList = %w(bootstrap)
|
9
|
-
#requireList.each {|r| require_relative "#{r}"}
|
10
|
-
|
11
8
|
mixinContent = Module.new do
|
12
9
|
|
13
10
|
# FileSys Methods
|
14
11
|
# ###############
|
15
12
|
|
16
|
-
#=begin
|
17
13
|
def filesys_find_path_or_croak(*paths, &block)
|
18
14
|
mustbe_file_or_directory_or_croak(normalise_pathandname_paths_or_croak(*paths, &block))
|
19
15
|
end
|
20
16
|
alias_method :find_path_or_croak, :filesys_find_path_or_croak
|
21
|
-
#=end
|
22
17
|
|
23
|
-
#=begin
|
24
18
|
def filesys_find_file_or_croak(*paths, &block)
|
25
19
|
mustbe_file_or_croak(normalise_pathandname_paths_or_croak(*paths, &block))
|
26
20
|
end
|
27
21
|
alias_method :find_file_or_croak, :filesys_find_file_or_croak
|
28
|
-
#=end
|
29
22
|
|
30
|
-
#=begin
|
31
23
|
def filesys_find_directory_or_croak(*paths, &block)
|
32
24
|
mustbe_directory_or_croak(normalise_pathandname_paths_or_croak(*paths, &block))
|
33
25
|
end
|
34
26
|
alias_method :find_directory_or_croak, :filesys_find_directory_or_croak
|
35
27
|
alias_method :find_dir_or_croak, :filesys_find_directory_or_croak
|
36
|
-
#=end
|
37
28
|
|
38
|
-
#=begin
|
39
29
|
def create_filesys_path_directory_or_croak(*pathElements)
|
40
30
|
eye = :cpn_path_dir_or_croak
|
41
31
|
pathName = normalise_pathandname_paths_or_croak(*pathElements)
|
42
32
|
dirName = File.dirname(pathName)
|
43
|
-
|
33
|
+
filesys_create_directory_or_croak(dirName)
|
44
34
|
end
|
45
35
|
alias_method :create_path_directory_or_croak, :create_filesys_path_directory_or_croak
|
46
36
|
alias_method :create_path_dir_or_croak, :create_filesys_path_directory_or_croak
|
47
|
-
#=end
|
48
37
|
|
49
|
-
|
50
|
-
def create_filesys_directory_or_croak(*pathElements)
|
38
|
+
def filesys_create_directory_or_croak(*pathElements)
|
51
39
|
eye = :cpn_dir_or_croak
|
52
40
|
dirName = normalise_pathandname_paths_or_croak(*pathElements)
|
53
41
|
case
|
@@ -59,26 +47,22 @@ mixinContent = Module.new do
|
|
59
47
|
duplicate_exception(dirName, eye, "dirName already exists but not a directory")
|
60
48
|
end
|
61
49
|
end
|
62
|
-
alias_method :create_directory_or_croak, :
|
63
|
-
alias_method :create_dir_or_croak, :
|
64
|
-
#=end
|
50
|
+
alias_method :create_directory_or_croak, :filesys_create_directory_or_croak
|
51
|
+
alias_method :create_dir_or_croak, :filesys_create_directory_or_croak
|
65
52
|
|
66
|
-
#=begin
|
67
53
|
def filesys_find_path_base_or_croak(*paths, &block) # without the .rb if any
|
68
54
|
fullPath = normalise_pathandname_paths_or_croak(*paths, &block)
|
69
55
|
basePath = File.join(File.dirname(fullPath), File.basename(fullPath, ".rb"))
|
70
56
|
$DEBUG && logger_ca(:f_pan_p_base, logger_fmt_who(:basePath => basePath, :fullPath => fullPath, :paths => paths))
|
71
57
|
mustbe_directory_or_croak(basePath)
|
72
58
|
end
|
73
|
-
|
74
|
-
#=begin
|
59
|
+
|
75
60
|
def filesys_find_mixin_home_or_croak(*paths, &block)
|
76
61
|
mixinPath = File.join(filesys_find_path_base_or_croak(*paths), 'mixin')
|
77
62
|
$DEBUG && logger_ca(:f_mix_home, logger_fmt_who(:mixinPath => mixinPath, :paths => paths))
|
78
63
|
mustbe_directory_or_croak(mixinPath)
|
79
64
|
end
|
80
65
|
alias_method :find_mixin_home_or_croak, :filesys_find_mixin_home_or_croak
|
81
|
-
#=end
|
82
66
|
|
83
67
|
end
|
84
68
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
|
-
require_relative '../
|
2
|
+
require_relative '../bootstrap'
|
3
3
|
|
4
4
|
mixinContent = Module.new do
|
5
5
|
|
6
6
|
attr_accessor :name, :type, :parent
|
7
7
|
|
8
8
|
def initialize(initArgs=nil, &initBlok)
|
9
|
-
eye = :
|
9
|
+
eye = :i
|
10
10
|
|
11
|
-
initArgs &&
|
11
|
+
initArgs && potrubi_bootstrap_mustbe_hash_or_croak(initArgs, eye).each {|k, v| __send__("#{k}=", v) }
|
12
12
|
|
13
13
|
Kernel.block_given? && instance_eval(&initBlok)
|
14
14
|
|
@@ -16,8 +16,13 @@ mixinContent = Module.new do
|
|
16
16
|
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
module Potrubi
|
20
|
+
module Mixin
|
21
|
+
module Initialize
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
21
25
|
|
22
|
-
|
26
|
+
Potrubi::Mixin::Initialize.__send__(:include, mixinContent) # Instance Methods
|
23
27
|
|
28
|
+
__END__
|
@@ -1,19 +1,10 @@
|
|
1
1
|
|
2
2
|
# potrubi constants methods
|
3
3
|
|
4
|
-
#require_relative '../bootstrap'
|
5
|
-
|
6
|
-
#requireList = %w(dynamic)
|
7
|
-
#requireList.each {|r| require_relative "#{r}"}
|
8
|
-
|
9
4
|
moduleContent = Module.new do
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
# ]
|
14
|
-
#includeList.each {|n| include n}
|
15
|
-
|
16
|
-
#=begin
|
6
|
+
include Potrubi::Bootstrap
|
7
|
+
|
17
8
|
def normalise_module_constant_names_or_croak(*names, &nrmBlok)
|
18
9
|
eye = :nrm_mod_cnst_ns
|
19
10
|
|
@@ -30,22 +21,17 @@ moduleContent = Module.new do
|
|
30
21
|
moduleNamesNrm
|
31
22
|
|
32
23
|
end
|
33
|
-
#=end
|
34
24
|
|
35
|
-
#=begin
|
36
25
|
def assign_class_constant_or_croak(classConstant, *names, &asgBlok)
|
37
26
|
r = classConstant.is_a?(Class) ? classConstant : create_class_constant_or_croak(*classConstant)
|
38
27
|
potrubi_bootstrap_mustbe_class_or_croak(assign_module_constant_or_croak(r, *names, &asgBlok))
|
39
28
|
end
|
40
29
|
alias_method :assign_class_constant, :assign_class_constant_or_croak
|
41
|
-
#=end
|
42
30
|
|
43
|
-
#=begin
|
44
31
|
def assign_module_constant_or_croak(moduleConstant, *names, &asgBlok)
|
45
32
|
eye = :asg_mod_cnst
|
46
33
|
|
47
34
|
moduleNames = normalise_module_constant_names_or_croak(*names)
|
48
|
-
###normalise_pathandname_names_to_hier_or_croak(*names)
|
49
35
|
|
50
36
|
$DEBUG_POTRUBI_BOOTSTRAP && begin
|
51
37
|
logrArgs = potrubi_bootstrap_logger_fmt_who(:constant => moduleConstant, :moduleNames => moduleNames, :names => names, :self => self)
|
@@ -54,8 +40,6 @@ moduleContent = Module.new do
|
|
54
40
|
|
55
41
|
moduleName = moduleNames.pop
|
56
42
|
|
57
|
-
###puts("#{eye} moduleName >#{moduleName}< moduleNames >#{moduleNames.class}< >#{moduleNames}<")
|
58
|
-
|
59
43
|
moduleParent = case
|
60
44
|
when moduleNames.empty? then Object
|
61
45
|
else
|
@@ -68,10 +52,9 @@ moduleContent = Module.new do
|
|
68
52
|
|
69
53
|
currentConstant && begin
|
70
54
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, potrubi_bootstrap_logger_fmt_who(:moduleParent => moduleParent, :moduleName => moduleName), "exists already")
|
71
|
-
|
55
|
+
potrubi_bootstrap_duplicate_exception(moduleName, "moduleName exists already")
|
72
56
|
end
|
73
57
|
|
74
|
-
#moduleParent.const_set(moduleName, moduleConstant)
|
75
58
|
moduleParent.const_set(moduleName, moduleConstant.is_a?(Module) ? moduleConstant : create_module_constant_or_croak(*moduleConstant))
|
76
59
|
|
77
60
|
moduleConstantFound = moduleParent.const_get(moduleName)
|
@@ -84,7 +67,6 @@ moduleContent = Module.new do
|
|
84
67
|
alias_method :assign_module_constant, :assign_module_constant_or_croak
|
85
68
|
alias_method :assign_mixin_constant_or_croak, :assign_module_constant_or_croak
|
86
69
|
alias_method :assign_mixin_constant, :assign_mixin_constant_or_croak
|
87
|
-
#=end
|
88
70
|
|
89
71
|
def find_class_constant(*a, &b)
|
90
72
|
find_class_constant_or_croak(*a, &b) rescue nil
|
@@ -119,29 +101,28 @@ moduleContent = Module.new do
|
|
119
101
|
def find_module_constant(*a, &b)
|
120
102
|
find_module_constant_or_croak(*a, &b) rescue nil
|
121
103
|
end
|
104
|
+
|
122
105
|
def find_module_constant_or_croak(*names, &findBlok)
|
123
106
|
eye = :f_mod_cnst
|
124
107
|
|
125
|
-
###modNames = names.flatten.compact
|
126
108
|
modNames = normalise_module_constant_names_or_croak(*names)
|
127
109
|
|
128
110
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(:modNames => modNames))
|
129
111
|
potrubi_bootstrap_mustbe_not_empty_or_croak(modNames, eye)
|
130
112
|
|
131
|
-
modCon =
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
113
|
+
modCon =
|
114
|
+
case
|
115
|
+
when modNames.empty? then Object
|
116
|
+
when (modNames.size == 1) && (modNames.first.is_a?(Module)) then modNames.first # nothing to do
|
117
|
+
else
|
118
|
+
modNames.join('::').split('::').inject(Object) do | mC, mN |
|
136
119
|
potrubi_bootstrap_mustbe_module_or_croak(mC, eye, "mC not module mN >#{mN}<")
|
137
|
-
###puts("#{eye} INJ mC >#{mC.class}< >#{mC}< mN >#{mN.class}< >#{mN}<");
|
138
120
|
mC.const_defined?(mN, false) ? mC.const_get(mN) : nil
|
139
121
|
end
|
140
|
-
|
122
|
+
end
|
141
123
|
|
142
124
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, "modCon >#{modCon.class}< >#{modCon}< modNames >#{modNames}<")
|
143
125
|
|
144
|
-
#modCon.is_a?(Module) ? modCon : raise(ArgumentError, "#{eye} modCon >#{modCon.class}< >#{modCon}< not Module")
|
145
126
|
potrubi_bootstrap_mustbe_module_or_croak(modCon)
|
146
127
|
|
147
128
|
modResult = Kernel.block_given? ? findBlok.call(modCon) : modCon
|
@@ -153,23 +134,18 @@ moduleContent = Module.new do
|
|
153
134
|
end
|
154
135
|
alias_method :find_mixin_constant_or_croak, :find_module_constant_or_croak
|
155
136
|
|
156
|
-
|
157
|
-
#begin
|
158
137
|
def find_peer_class_constant_or_croak(*peerNames)
|
159
138
|
thisHier = self.class.name.split('::')
|
160
139
|
thisHier.pop
|
161
140
|
find_class_constant_or_croak(thisHier, peerNames)
|
162
141
|
end
|
163
|
-
#=end
|
164
142
|
|
165
|
-
#=begin
|
166
143
|
def create_class_constant_or_croak(*names, &cratBlok)
|
167
144
|
initValue = names.flatten.first.is_a?(Class) ? nil : Class.new # Must ALWAYS have a class first
|
168
145
|
potrubi_bootstrap_mustbe_class_or_croak(create_module_constant_or_croak(initValue, *names, &cratBlok))
|
169
146
|
end
|
170
147
|
alias_method :enhance_class_constant_or_croak, :create_class_constant_or_croak
|
171
148
|
|
172
|
-
#=begin
|
173
149
|
def create_module_constant_or_croak(*names, &cratBlok)
|
174
150
|
eye = :cr_mod_cnst
|
175
151
|
|
@@ -178,7 +154,6 @@ moduleContent = Module.new do
|
|
178
154
|
logrArgs = potrubi_bootstrap_logger_fmt_who(:names => moduleNames)
|
179
155
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, logrArgs)
|
180
156
|
|
181
|
-
#moduleName = moduleNames.pop
|
182
157
|
moduleConstants = normalise_module_contents_or_croak(*moduleNames)
|
183
158
|
|
184
159
|
moduleConstantFirst = moduleConstants.first
|
@@ -197,9 +172,7 @@ moduleContent = Module.new do
|
|
197
172
|
potrubi_bootstrap_mustbe_module_or_croak(moduleConstant)
|
198
173
|
|
199
174
|
end
|
200
|
-
#=end
|
201
175
|
|
202
|
-
#=begin
|
203
176
|
def extend_receiver_or_croak(receiverValue, *mixinContents)
|
204
177
|
eye = :ext_rcv
|
205
178
|
eyeTale = 'EXTEND RCV'
|
@@ -208,8 +181,6 @@ moduleContent = Module.new do
|
|
208
181
|
|
209
182
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTale, logrArgs)
|
210
183
|
|
211
|
-
#mixinConstants = normalise_mixins_or_croak(receiverValue, nil, *mixinContents).values
|
212
|
-
#mixinConstants = mixinContents.flatten.compact.uniq.map {|m| potrubi_bootstrap_mustbe_module_or_croak(m) }
|
213
184
|
mixinConstants = normalise_mixin_contents_or_croak(*mixinContents)
|
214
185
|
|
215
186
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, logrArgs, potrubi_bootstrap_logger_fmt_who(:mixin_constants => mixinConstants))
|
@@ -222,10 +193,6 @@ moduleContent = Module.new do
|
|
222
193
|
|
223
194
|
receiverValue.extend(mixinConstant) # Add the instance methods, etc of mixin to receiver
|
224
195
|
|
225
|
-
#mixinConstantClassMethods = mixinConstant.const_get(:ClassMethods, false) rescue nil # any class methods
|
226
|
-
#potrubi_bootstrap_logger_ms(eye, eyeTale, "KLS MTDS receiverValue >#{receiverValue.class}< >#{receiverValue}< mixinConstantClassMethods >#{mixinConstantClassMethods.class}< >#{mixinConstantClassMethods}<")
|
227
|
-
#mixinConstantClassMethods && mixinConstantClassMethods.is_a?(Module) && receiverValue.instance_eval{ extend mixinConstantClassMethods } # Add the class methods of mixin to the singleton classs of receiver
|
228
|
-
|
229
196
|
end
|
230
197
|
|
231
198
|
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, 'EXTENDED', logrArgs)
|
@@ -238,9 +205,7 @@ moduleContent = Module.new do
|
|
238
205
|
self
|
239
206
|
|
240
207
|
end
|
241
|
-
#=end
|
242
208
|
|
243
|
-
#=begin
|
244
209
|
def normalise_mixin_contents_or_croak(*nomMixins)
|
245
210
|
eye = :nrm_mxn_cnts
|
246
211
|
eyeTale = 'NRM MXN CONTENTS'
|
@@ -251,7 +216,7 @@ moduleContent = Module.new do
|
|
251
216
|
nrmMixins = nomMixins.flatten(1).compact.map.with_index do | mV, mN |
|
252
217
|
|
253
218
|
logrNormArgs = potrubi_bootstrap_logger_fmt_who(:mN => mN, :mV => mV)
|
254
|
-
$DEBUG_POTRUBI_BOOTSTRAP &&
|
219
|
+
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_beg(eye, eyeTale, "NORM", logrNormArgs)
|
255
220
|
|
256
221
|
mC = case mV
|
257
222
|
when Module then mV # nothing to to
|
@@ -266,9 +231,8 @@ moduleContent = Module.new do
|
|
266
231
|
potrubi_bootstrap_surprise_exception(mV,"mN >#{mN}< mV is what?")
|
267
232
|
end
|
268
233
|
|
269
|
-
$DEBUG_POTRUBI_BOOTSTRAP &&
|
234
|
+
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_fin(eye, eyeTale, "NORM", logrNormArgs, potrubi_bootstrap_logger_fmt_who(:mC => mC))
|
270
235
|
|
271
|
-
#mC && potrubi_bootstrap_mustbe_module_or_croak(mC)
|
272
236
|
mC
|
273
237
|
|
274
238
|
end.flatten.compact
|
@@ -282,9 +246,6 @@ moduleContent = Module.new do
|
|
282
246
|
potrubi_bootstrap_mustbe_array_or_croak(nrmMixins, eye)
|
283
247
|
end
|
284
248
|
alias_method :normalise_module_contents_or_croak, :normalise_mixin_contents_or_croak
|
285
|
-
#=end
|
286
|
-
|
287
|
-
|
288
249
|
|
289
250
|
end
|
290
251
|
|
@@ -297,72 +258,7 @@ module Potrubi
|
|
297
258
|
end
|
298
259
|
end
|
299
260
|
|
300
|
-
|
261
|
+
Potrubi::Mixin::Konstant.extend(moduleContent)
|
301
262
|
Potrubi::Mixin::Konstant.__send__(:include, moduleContent) # Instance Methods
|
302
263
|
|
303
264
|
__END__
|
304
|
-
|
305
|
-
#=begin
|
306
|
-
def resolve_module_constants_or_croak(*resolvMaps)
|
307
|
-
eye = :rsv_mod_cons
|
308
|
-
|
309
|
-
logrArgs = potrubi_bootstrap_logger_fmt_who(:map => resolvMaps)
|
310
|
-
|
311
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, logrArgs)
|
312
|
-
|
313
|
-
moduleConstants = resolvMaps.flatten.compact.each_with_object({}) do | resolvMap, h |
|
314
|
-
|
315
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, "MOD SPEC", potrubi_bootstrap_logger_fmt_who(:rsv_map => resolvMap))
|
316
|
-
|
317
|
-
potrubi_bootstrap_mustbe_hash_or_croak(resolvMap)
|
318
|
-
|
319
|
-
r = case
|
320
|
-
when resolvMap.has_key?(:requires) then
|
321
|
-
requireNames = [*resolvMap[:requires]].flatten.compact
|
322
|
-
requirePath = resolvMap[:path]
|
323
|
-
requirePath && potrubi_bootstrap_mustbe_directory_or_croak(requirePath)
|
324
|
-
requirePaths = requirePath ? requireNames.each_with_object({}) {|n,h| h[n] = File.join(requirePath, n) } : requireNames.each_with_object({}) {|n,h1| h1[n] = n}
|
325
|
-
|
326
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, 'REQUIRES', potrubi_bootstrap_logger_fmt_who(:paths => requirePaths, :names => requireNames, :path => requirePath))
|
327
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, 'LOADED FEATURES', potrubi_bootstrap_logger_fmt_who(:loaded => $LOADED_FEATURES))
|
328
|
-
|
329
|
-
#potrubi_bootstrap_trace_exception(eye,"REQUIRES HOLD HERE X1")
|
330
|
-
|
331
|
-
requirePaths.each do |n, p|
|
332
|
-
case
|
333
|
-
when $LOADED_FEATURES.include?(p) then nil
|
334
|
-
else
|
335
|
-
r = require p
|
336
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, "REQUIRED", potrubi_bootstrap_logger_fmt_who(:n => n, :p => p, :r => r))
|
337
|
-
potrubi_bootstrap_mustbe_not_nil_or_croak(r, eye, "n >#{n} p >#{p}< require failed >#{r.class}< >#{r}<")
|
338
|
-
r
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
potrubi_bootstrap_trace_exception(eye,"REQUIRES HOLD HERE X2")
|
343
|
-
|
344
|
-
when resolvMap.has_key?(:mixins) then
|
345
|
-
mixinNames = [*resolvMap[:mixins]].flatten.compact
|
346
|
-
mixinParent = potrubi_bootstrap_mustbe_key_or_croak(resolvMap, :relative)
|
347
|
-
else
|
348
|
-
potrubi_bootstrap_surprise_exception(resolvMap, eye, "resolveMap does not have any know keys")
|
349
|
-
end
|
350
|
-
|
351
|
-
###when Module then resolvMap # nothing to do
|
352
|
-
###when String, Symbol, Array then bootstrap_find_module_constant_or_croak(resolvMap)
|
353
|
-
|
354
|
-
###else
|
355
|
-
### potrubi_bootstrap_surprise_exception(resolvMap, eye, "resolvMap is what?")
|
356
|
-
###end
|
357
|
-
|
358
|
-
r && (h[resolvMap] = r)
|
359
|
-
|
360
|
-
|
361
|
-
end
|
362
|
-
|
363
|
-
|
364
|
-
$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(:constants => moduleConstants), logrArgs)
|
365
|
-
|
366
|
-
moduleConstants
|
367
|
-
end
|
368
|
-
#=end
|