module-cluster 1.4.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +127 -337
- data/lib/module-cluster.rb +1 -153
- data/lib/module/cluster.rb +341 -0
- data/lib/module/cluster/class_support.rb +22 -0
- data/lib/module/cluster/cluster.rb +10 -0
- data/lib/module/cluster/cluster/cluster_interface.rb +550 -0
- data/lib/module/cluster/exception/module_not_in_stack.rb +26 -0
- data/lib/module/cluster/instance_controller.rb +14 -0
- data/lib/module/cluster/instance_controller/hook_controller.rb +33 -0
- data/lib/module/cluster/instance_controller/hook_controller/chain_proxy.rb +511 -0
- data/lib/module/cluster/instance_controller/hook_controller/hook_controller_interface.rb +830 -0
- data/lib/module/cluster/instance_controller/instance_controller_interface.rb +269 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb +359 -0
- data/lib/module/cluster/instance_controller/multiple_hook_controller_proxy/chain_proxy.rb +442 -0
- data/lib/module/cluster/module_support.rb +67 -0
- data/lib/module/namespaces.rb +13 -0
- data/lib/module/requires.rb +32 -0
- data/spec/module/cluster/cluster_spec.rb +473 -0
- data/spec/module/cluster/instance_controller/hook_controller_spec.rb +922 -0
- data/spec/module/cluster/instance_controller/multiple_hook_controller_proxy_spec.rb +1240 -0
- data/spec/module/cluster_spec.rb +1794 -0
- metadata +27 -98
- data/README.rdoc +0 -395
- data/lib/module-cluster/ModuleCluster.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define.rb +0 -12
- data/lib/module-cluster/ModuleCluster/Define/Block.rb +0 -9
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClass.rb +0 -83
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingClassOrModule.rb +0 -70
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModule.rb +0 -79
- data/lib/module-cluster/ModuleCluster/Define/Block/CascadingModuleOrSubclass.rb +0 -21
- data/lib/module-cluster/ModuleCluster/Define/Block/Class.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModule.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrModuleOrSubclass.rb +0 -36
- data/lib/module-cluster/ModuleCluster/Define/Block/ClassOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Instance.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/Block/Module.rb +0 -77
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrInstance.rb +0 -78
- data/lib/module-cluster/ModuleCluster/Define/Block/ModuleOrSubclass.rb +0 -29
- data/lib/module-cluster/ModuleCluster/Define/Block/Subclass.rb +0 -56
- data/lib/module-cluster/ModuleCluster/Define/ClassCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ClassOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Cluster.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascades.rb +0 -185
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToClass.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/ClusterCascadesToModule.rb +0 -181
- data/lib/module-cluster/ModuleCluster/Define/Deprecated.rb +0 -40
- data/lib/module-cluster/ModuleCluster/Define/InstanceCluster.rb +0 -45
- data/lib/module-cluster/ModuleCluster/Define/ModuleCluster.rb +0 -193
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrClassCluster.rb +0 -209
- data/lib/module-cluster/ModuleCluster/Define/ModuleOrInstanceCluster.rb +0 -128
- data/lib/module-cluster/ModuleCluster/Define/Status.rb +0 -106
- data/lib/module-cluster/ModuleCluster/Suspend.rb +0 -7
- data/lib/module-cluster/ModuleCluster/Suspend/Hooks.rb +0 -315
- data/lib/module-cluster/ModuleCluster/Suspend/WithoutHooks.rb +0 -153
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures.rb +0 -77
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/ClusterStack.rb +0 -44
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/PerformCascades.rb +0 -292
- data/lib/module-cluster/_private_/ModuleCluster/CascadeFeatures/Subclass.rb +0 -24
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack.rb +0 -12
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block.rb +0 -9
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Class.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Inherited.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Instance.rb +0 -20
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Module.rb +0 -36
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Block/Set.rb +0 -6
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Extends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Includes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsExtends.rb +0 -140
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/PrependsIncludes.rb +0 -110
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set.rb +0 -35
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy.rb +0 -359
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Status.rb +0 -55
- data/lib/module-cluster/_private_/ModuleCluster/ClusterStack/Suspend.rb +0 -199
- data/lib/module-cluster/_private_/ModuleCluster/ExtendForCascade.rb +0 -34
- data/spec/ModuleCluster/Define/Block/CascadingClassOrModule_spec.rb +0 -285
- data/spec/ModuleCluster/Define/Block/CascadingClass_spec.rb +0 -254
- data/spec/ModuleCluster/Define/Block/CascadingModuleOrSubclass_spec.rb +0 -56
- data/spec/ModuleCluster/Define/Block/CascadingModule_spec.rb +0 -278
- data/spec/ModuleCluster/Define/Block/ClassOrInstance_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrInstance_spec.rb +0 -238
- data/spec/ModuleCluster/Define/Block/ClassOrModuleOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ClassOrModule_spec.rb +0 -231
- data/spec/ModuleCluster/Define/Block/ClassOrSubclass_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/Class_spec.rb +0 -224
- data/spec/ModuleCluster/Define/Block/Instance_spec.rb +0 -78
- data/spec/ModuleCluster/Define/Block/ModuleOrInstance_spec.rb +0 -54
- data/spec/ModuleCluster/Define/Block/ModuleOrSubclass_spec.rb +0 -51
- data/spec/ModuleCluster/Define/Block/Module_spec.rb +0 -230
- data/spec/ModuleCluster/Define/Block/Subclass_spec.rb +0 -73
- data/spec/ModuleCluster/Define/Block_spec.rb +0 -18
- data/spec/ModuleCluster/Define/ClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ClassOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Define/ClusterCascadesToClass_spec.rb +0 -659
- data/spec/ModuleCluster/Define/ClusterCascadesToModule_spec.rb +0 -678
- data/spec/ModuleCluster/Define/ClusterCascades_spec.rb +0 -644
- data/spec/ModuleCluster/Define/Cluster_spec.rb +0 -708
- data/spec/ModuleCluster/Define/InstanceCluster_spec.rb +0 -102
- data/spec/ModuleCluster/Define/ModuleCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrClassCluster_spec.rb +0 -728
- data/spec/ModuleCluster/Define/ModuleOrInstanceCluster_spec.rb +0 -576
- data/spec/ModuleCluster/Suspend/Hooks_spec.rb +0 -573
- data/spec/ModuleCluster/Suspend/WithoutHooks_spec.rb +0 -559
- data/spec/ModuleCluster_spec.rb +0 -15
- data/spec/_private_/ModuleCluster/CascadeFeatures/PerformCascades_spec.rb +0 -386
- data/spec/_private_/ModuleCluster/ClusterStack/Set/MultiSetProxy_spec.rb +0 -419
- data/spec/_private_/ModuleCluster/ClusterStack/Suspend_spec.rb +0 -242
@@ -1,242 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative '../../../../lib/module-cluster.rb'
|
3
|
-
|
4
|
-
describe ::ModuleCluster::ClusterStack::Suspend do
|
5
|
-
|
6
|
-
##########################
|
7
|
-
# suspend_any_hooks #
|
8
|
-
# all_hooks_suspended? #
|
9
|
-
# resume_any_hooks #
|
10
|
-
##########################
|
11
|
-
|
12
|
-
it 'can suspend all hooks at once' do
|
13
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock01
|
14
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
15
|
-
end
|
16
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock01.new
|
17
|
-
instance.all_hooks_suspended?.should == false
|
18
|
-
instance.suspend_any_hooks
|
19
|
-
instance.all_hooks_suspended?.should == true
|
20
|
-
instance.all_include_hooks_suspended?.should == true
|
21
|
-
instance.all_extend_hooks_suspended?.should == true
|
22
|
-
instance.include_hooks_suspended?.should == true
|
23
|
-
instance.extend_hooks_suspended?.should == true
|
24
|
-
instance.prepend_include_hooks_suspended?.should == true
|
25
|
-
instance.prepend_extend_hooks_suspended?.should == true
|
26
|
-
instance.resume_any_hooks
|
27
|
-
instance.all_hooks_suspended?.should == false
|
28
|
-
end
|
29
|
-
|
30
|
-
##################################
|
31
|
-
# suspend_any_include_hooks #
|
32
|
-
# all_include_hooks_suspended? #
|
33
|
-
# resume_any_include_hooks #
|
34
|
-
##################################
|
35
|
-
|
36
|
-
it 'can suspend all include hooks at once' do
|
37
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock02
|
38
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
39
|
-
end
|
40
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock02.new
|
41
|
-
instance.all_include_hooks_suspended?.should == false
|
42
|
-
instance.suspend_any_include_hooks
|
43
|
-
instance.all_include_hooks_suspended?.should == true
|
44
|
-
instance.include_hooks_suspended?.should == true
|
45
|
-
instance.prepend_include_hooks_suspended?.should == true
|
46
|
-
instance.all_hooks_suspended?.should == false
|
47
|
-
instance.all_extend_hooks_suspended?.should == false
|
48
|
-
instance.resume_any_include_hooks
|
49
|
-
instance.all_include_hooks_suspended?.should == false
|
50
|
-
end
|
51
|
-
|
52
|
-
#################################
|
53
|
-
# suspend_any_extend_hooks #
|
54
|
-
# all_extend_hooks_suspended? #
|
55
|
-
# resume_any_extend_hooks #
|
56
|
-
#################################
|
57
|
-
|
58
|
-
it 'can suspend all extend hooks at once' do
|
59
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock03
|
60
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
61
|
-
end
|
62
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock03.new
|
63
|
-
instance.all_extend_hooks_suspended?.should == false
|
64
|
-
instance.suspend_any_extend_hooks
|
65
|
-
instance.all_extend_hooks_suspended?.should == true
|
66
|
-
instance.extend_hooks_suspended?.should == true
|
67
|
-
instance.prepend_extend_hooks_suspended?.should == true
|
68
|
-
instance.all_hooks_suspended?.should == false
|
69
|
-
instance.all_include_hooks_suspended?.should == false
|
70
|
-
instance.resume_any_extend_hooks
|
71
|
-
instance.all_extend_hooks_suspended?.should == false
|
72
|
-
end
|
73
|
-
|
74
|
-
##############################
|
75
|
-
# suspend_include_hooks #
|
76
|
-
# include_hooks_suspended? #
|
77
|
-
# resume_include_hooks #
|
78
|
-
##############################
|
79
|
-
|
80
|
-
it 'can suspend all include hooks' do
|
81
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock04
|
82
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
83
|
-
end
|
84
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock04.new
|
85
|
-
instance.include_hooks_suspended?.should == false
|
86
|
-
instance.suspend_include_hooks
|
87
|
-
instance.include_hooks_suspended?.should == true
|
88
|
-
instance.all_hooks_suspended?.should == false
|
89
|
-
instance.all_include_hooks_suspended?.should == false
|
90
|
-
instance.all_extend_hooks_suspended?.should == false
|
91
|
-
instance.extend_hooks_suspended?.should == false
|
92
|
-
instance.prepend_include_hooks_suspended?.should == false
|
93
|
-
instance.prepend_extend_hooks_suspended?.should == false
|
94
|
-
instance.resume_include_hooks
|
95
|
-
instance.include_hooks_suspended?.should == false
|
96
|
-
end
|
97
|
-
|
98
|
-
#############################
|
99
|
-
# suspend_extend_hooks #
|
100
|
-
# extend_hooks_suspended? #
|
101
|
-
# resume_extend_hooks #
|
102
|
-
#############################
|
103
|
-
|
104
|
-
it 'can suspend all extend hooks' do
|
105
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock05
|
106
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
107
|
-
end
|
108
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock05.new
|
109
|
-
instance.extend_hooks_suspended?.should == false
|
110
|
-
instance.suspend_extend_hooks
|
111
|
-
instance.extend_hooks_suspended?.should == true
|
112
|
-
instance.all_hooks_suspended?.should == false
|
113
|
-
instance.all_include_hooks_suspended?.should == false
|
114
|
-
instance.all_extend_hooks_suspended?.should == false
|
115
|
-
instance.include_hooks_suspended?.should == false
|
116
|
-
instance.prepend_include_hooks_suspended?.should == false
|
117
|
-
instance.prepend_extend_hooks_suspended?.should == false
|
118
|
-
instance.resume_extend_hooks
|
119
|
-
instance.extend_hooks_suspended?.should == false
|
120
|
-
end
|
121
|
-
|
122
|
-
######################################
|
123
|
-
# suspend_prepend_include_hooks #
|
124
|
-
# prepend_include_hooks_suspended? #
|
125
|
-
# resume_prepend_include_hooks #
|
126
|
-
######################################
|
127
|
-
|
128
|
-
it 'can suspend all prepend include hooks' do
|
129
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock06
|
130
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
131
|
-
end
|
132
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock06.new
|
133
|
-
instance.prepend_include_hooks_suspended?.should == false
|
134
|
-
instance.suspend_prepend_include_hooks
|
135
|
-
instance.prepend_include_hooks_suspended?.should == true
|
136
|
-
instance.all_hooks_suspended?.should == false
|
137
|
-
instance.all_include_hooks_suspended?.should == false
|
138
|
-
instance.all_extend_hooks_suspended?.should == false
|
139
|
-
instance.include_hooks_suspended?.should == false
|
140
|
-
instance.extend_hooks_suspended?.should == false
|
141
|
-
instance.prepend_extend_hooks_suspended?.should == false
|
142
|
-
instance.resume_prepend_include_hooks
|
143
|
-
instance.prepend_include_hooks_suspended?.should == false
|
144
|
-
end
|
145
|
-
|
146
|
-
#####################################
|
147
|
-
# suspend_prepend_extend_hooks #
|
148
|
-
# prepend_extend_hooks_suspended? #
|
149
|
-
# resume_prepend_extend_hooks #
|
150
|
-
#####################################
|
151
|
-
|
152
|
-
it 'can suspend all prepend extend hooks' do
|
153
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock07
|
154
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
155
|
-
end
|
156
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock07.new
|
157
|
-
instance.prepend_extend_hooks_suspended?.should == false
|
158
|
-
instance.suspend_prepend_extend_hooks
|
159
|
-
instance.prepend_extend_hooks_suspended?.should == true
|
160
|
-
instance.all_hooks_suspended?.should == false
|
161
|
-
instance.all_include_hooks_suspended?.should == false
|
162
|
-
instance.all_extend_hooks_suspended?.should == false
|
163
|
-
instance.include_hooks_suspended?.should == false
|
164
|
-
instance.extend_hooks_suspended?.should == false
|
165
|
-
instance.prepend_include_hooks_suspended?.should == false
|
166
|
-
instance.resume_prepend_extend_hooks
|
167
|
-
instance.prepend_extend_hooks_suspended?.should == false
|
168
|
-
end
|
169
|
-
|
170
|
-
######################
|
171
|
-
# hooks_suspended? #
|
172
|
-
######################
|
173
|
-
|
174
|
-
it 'can report whether hooks are extended for all of current action' do
|
175
|
-
class ::ModuleCluster::ClusterStack::Suspend::Mock08
|
176
|
-
include ::ModuleCluster::ClusterStack::Suspend
|
177
|
-
end
|
178
|
-
instance = ::ModuleCluster::ClusterStack::Suspend::Mock08.new
|
179
|
-
instance.hooks_suspended?( :prepend_include ).should == false
|
180
|
-
instance.hooks_suspended?( :include ).should == false
|
181
|
-
instance.hooks_suspended?( :prepend_extend ).should == false
|
182
|
-
instance.hooks_suspended?( :extend ).should == false
|
183
|
-
|
184
|
-
# suspend all
|
185
|
-
instance.suspend_any_hooks
|
186
|
-
instance.hooks_suspended?( :prepend_include ).should == true
|
187
|
-
instance.hooks_suspended?( :include ).should == true
|
188
|
-
instance.hooks_suspended?( :prepend_extend ).should == true
|
189
|
-
instance.hooks_suspended?( :extend ).should == true
|
190
|
-
instance.resume_any_hooks
|
191
|
-
|
192
|
-
# suspend all include
|
193
|
-
instance.suspend_any_include_hooks
|
194
|
-
instance.hooks_suspended?( :prepend_include ).should == true
|
195
|
-
instance.hooks_suspended?( :include ).should == true
|
196
|
-
instance.hooks_suspended?( :prepend_extend ).should == false
|
197
|
-
instance.hooks_suspended?( :extend ).should == false
|
198
|
-
instance.resume_any_include_hooks
|
199
|
-
|
200
|
-
# suspend all extend
|
201
|
-
instance.suspend_any_extend_hooks
|
202
|
-
instance.hooks_suspended?( :prepend_include ).should == false
|
203
|
-
instance.hooks_suspended?( :include ).should == false
|
204
|
-
instance.hooks_suspended?( :prepend_extend ).should == true
|
205
|
-
instance.hooks_suspended?( :extend ).should == true
|
206
|
-
instance.resume_any_extend_hooks
|
207
|
-
|
208
|
-
# suspend prepend include
|
209
|
-
instance.suspend_prepend_include_hooks
|
210
|
-
instance.hooks_suspended?( :prepend_include ).should == true
|
211
|
-
instance.hooks_suspended?( :include ).should == false
|
212
|
-
instance.hooks_suspended?( :prepend_extend ).should == false
|
213
|
-
instance.hooks_suspended?( :extend ).should == false
|
214
|
-
instance.resume_prepend_include_hooks
|
215
|
-
|
216
|
-
# suspend include
|
217
|
-
instance.suspend_include_hooks
|
218
|
-
instance.hooks_suspended?( :prepend_include ).should == false
|
219
|
-
instance.hooks_suspended?( :include ).should == true
|
220
|
-
instance.hooks_suspended?( :prepend_extend ).should == false
|
221
|
-
instance.hooks_suspended?( :extend ).should == false
|
222
|
-
instance.resume_include_hooks
|
223
|
-
|
224
|
-
# suspend prepend extend
|
225
|
-
instance.suspend_prepend_extend_hooks
|
226
|
-
instance.hooks_suspended?( :prepend_include ).should == false
|
227
|
-
instance.hooks_suspended?( :include ).should == false
|
228
|
-
instance.hooks_suspended?( :prepend_extend ).should == true
|
229
|
-
instance.hooks_suspended?( :extend ).should == false
|
230
|
-
instance.resume_prepend_extend_hooks
|
231
|
-
|
232
|
-
# suspend extend
|
233
|
-
instance.suspend_extend_hooks
|
234
|
-
instance.hooks_suspended?( :prepend_include ).should == false
|
235
|
-
instance.hooks_suspended?( :include ).should == false
|
236
|
-
instance.hooks_suspended?( :prepend_extend ).should == false
|
237
|
-
instance.hooks_suspended?( :extend ).should == true
|
238
|
-
instance.resume_extend_hooks
|
239
|
-
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|