phenomenal 0.9.0 → 0.11.11.24.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README +4 -3
- data/Rakefile +0 -3
- data/demo.rb +24 -0
- data/demo_age.rb +89 -0
- data/demo_dsl.rb +28 -0
- data/lib/phenomenal.rb +2 -15
- data/lib/phenomenal/adaptation.rb +12 -22
- data/lib/phenomenal/context.rb +134 -127
- data/lib/phenomenal/dsl.rb +14 -41
- data/lib/phenomenal/logger.rb +1 -0
- data/lib/phenomenal/manager.rb +35 -117
- data/phenomenal.gemspec +15 -0
- data/{spec → test}/test_classes.rb +0 -3
- data/test/test_cop_adaptation.rb +168 -0
- data/test/test_cop_composition.rb +84 -0
- data/test/test_cop_conflictpolicy.rb +177 -0
- data/test/test_cop_infrastructure.rb +129 -0
- data/test_declaration.rb +18 -0
- metadata +29 -70
- data/lib/phenomenal/feature.rb +0 -8
- data/lib/phenomenal/relationships/context_relationships.rb +0 -22
- data/lib/phenomenal/relationships/dsl.rb +0 -18
- data/lib/phenomenal/relationships/feature_relationships.rb +0 -42
- data/lib/phenomenal/relationships/implication.rb +0 -35
- data/lib/phenomenal/relationships/relationship.rb +0 -42
- data/lib/phenomenal/relationships/relationships_manager.rb +0 -63
- data/lib/phenomenal/relationships/relationships_store.rb +0 -73
- data/lib/phenomenal/relationships/requirement.rb +0 -26
- data/lib/phenomenal/relationships/suggestion.rb +0 -41
- data/lib/phenomenal/version.rb +0 -3
- data/spec/adaptation_spec.rb +0 -64
- data/spec/behavior/adaptation_spec.rb +0 -5
- data/spec/behavior/combined_contexts_spec.rb +0 -5
- data/spec/behavior/composition_spec.rb +0 -5
- data/spec/behavior/conflict_policy_spec.rb +0 -5
- data/spec/behavior/open_context.rb +0 -5
- data/spec/behavior/relationships_spec.rb +0 -249
- data/spec/context_spec.rb +0 -268
- data/spec/dsl_spec.rb +0 -181
- data/spec/feature_spec.rb +0 -5
- data/spec/manager_spec.rb +0 -84
- data/spec/proc_spec.rb +0 -20
- data/spec/relationships/context_relationships_spec.rb +0 -13
- data/spec/relationships/dsl_spec.rb +0 -13
- data/spec/relationships/feature_relationships_spec.rb +0 -13
- data/spec/relationships/relationship_spec.rb +0 -31
- data/spec/relationships/relationships_manager_spec.rb +0 -15
- data/spec/relationships/relationships_store_spec.rb +0 -19
- data/spec/spec_helper.rb +0 -18
data/spec/dsl_spec.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Phenomenal::DSL do
|
4
|
-
|
5
|
-
describe "#phen_define_context" do
|
6
|
-
pending "TODO"
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "#phen_context" do
|
10
|
-
it "should exist in Kernel" do
|
11
|
-
Kernel.should respond_to :phen_context
|
12
|
-
end
|
13
|
-
|
14
|
-
pending "TODO"
|
15
|
-
|
16
|
-
describe "#context" do
|
17
|
-
it "should exist in Kernel" do
|
18
|
-
Kernel.should respond_to :context
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should be an alias of phen_context" do
|
22
|
-
Kernel.method(:phen_context).should == Kernel.method(:context)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#phen_feature" do
|
28
|
-
it "should exist in Kernel" do
|
29
|
-
Kernel.should respond_to :phen_feature
|
30
|
-
end
|
31
|
-
|
32
|
-
pending "TODO"
|
33
|
-
|
34
|
-
describe "#feature" do
|
35
|
-
it "should exist in Kernel" do
|
36
|
-
Kernel.should respond_to :feature
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should be an alias of phen_context" do
|
40
|
-
Kernel.method(:phen_feature).should == Kernel.method(:feature)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#phen_forget_context" do
|
46
|
-
it "should exist in Kernel" do
|
47
|
-
Kernel.should respond_to :phen_forget_context
|
48
|
-
end
|
49
|
-
|
50
|
-
pending "TODO"
|
51
|
-
end
|
52
|
-
describe "#phen_add_adaptation" do
|
53
|
-
it "should exist in Kernel" do
|
54
|
-
Kernel.should respond_to :phen_add_adaptation
|
55
|
-
end
|
56
|
-
|
57
|
-
pending "TODO"
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#phen_add_class_adaptation" do
|
61
|
-
it "should exist in Kernel" do
|
62
|
-
Kernel.should respond_to :phen_add_class_adaptation
|
63
|
-
end
|
64
|
-
|
65
|
-
pending "TODO"
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "#phen_remove_adaptation" do
|
69
|
-
it "should exist in Kernel" do
|
70
|
-
Kernel.should respond_to :phen_remove_adaptation
|
71
|
-
end
|
72
|
-
|
73
|
-
pending "TODO"
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "#phen_remove_class_adaptation" do
|
77
|
-
it "should exist in Kernel" do
|
78
|
-
Kernel.should respond_to :phen_remove_class_adaptation
|
79
|
-
end
|
80
|
-
|
81
|
-
pending "TODO"
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "#phen_activate_context" do
|
85
|
-
it "should exist in Kernel" do
|
86
|
-
Kernel.should respond_to :phen_activate_context
|
87
|
-
end
|
88
|
-
|
89
|
-
pending "TODO"
|
90
|
-
|
91
|
-
describe "#activate_context" do
|
92
|
-
it "should exist in Kernel" do
|
93
|
-
Kernel.should respond_to :activate_context
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should be an alias of phen_context" do
|
97
|
-
Kernel.method(:phen_activate_context).should == Kernel.method(:activate_context)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "#phen_deactivate_context" do
|
103
|
-
it "should exist in Kernel" do
|
104
|
-
Kernel.should respond_to :phen_deactivate_context
|
105
|
-
end
|
106
|
-
|
107
|
-
pending "TODO"
|
108
|
-
|
109
|
-
describe "#deactivate_context" do
|
110
|
-
it "should exist in Kernel" do
|
111
|
-
Kernel.should respond_to :deactivate_context
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should be an alias of phen_context" do
|
115
|
-
Kernel.method(:phen_deactivate_context).should == Kernel.method(:deactivate_context)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "#phen_context_active?" do
|
121
|
-
it "should exist in Kernel" do
|
122
|
-
Kernel.should respond_to :phen_context_active?
|
123
|
-
end
|
124
|
-
|
125
|
-
pending "TODO"
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "#phen_context_information" do
|
129
|
-
it "should exist in Kernel" do
|
130
|
-
Kernel.should respond_to :phen_context_information
|
131
|
-
end
|
132
|
-
|
133
|
-
pending "TODO"
|
134
|
-
end
|
135
|
-
|
136
|
-
describe "#phen_default_context" do
|
137
|
-
it "should exist in Kernel" do
|
138
|
-
Kernel.should respond_to :phen_default_context
|
139
|
-
end
|
140
|
-
|
141
|
-
pending "TODO"
|
142
|
-
end
|
143
|
-
|
144
|
-
describe "#phen_defined_contexts" do
|
145
|
-
it "should exist in Kernel" do
|
146
|
-
Kernel.should respond_to :phen_defined_contexts
|
147
|
-
end
|
148
|
-
|
149
|
-
pending "TODO"
|
150
|
-
end
|
151
|
-
|
152
|
-
describe "#phen_proceed" do
|
153
|
-
it "should exist in Kernel" do
|
154
|
-
Kernel.should respond_to :phen_proceed
|
155
|
-
end
|
156
|
-
|
157
|
-
pending "TODO"
|
158
|
-
|
159
|
-
describe "#proceed" do
|
160
|
-
it "should exist in Kernel" do
|
161
|
-
Kernel.should respond_to :proceed
|
162
|
-
end
|
163
|
-
|
164
|
-
it "should be an alias of phen_context" do
|
165
|
-
Kernel.method(:phen_proceed).should == Kernel.method(:proceed)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe "#phen_change_conflict_policy" do
|
171
|
-
it "should exist in Kernel" do
|
172
|
-
Kernel.should respond_to :phen_change_conflict_policy
|
173
|
-
end
|
174
|
-
|
175
|
-
pending "TODO"
|
176
|
-
end
|
177
|
-
|
178
|
-
describe ".phen_alias" do
|
179
|
-
pending "TODO"
|
180
|
-
end
|
181
|
-
end
|
data/spec/feature_spec.rb
DELETED
data/spec/manager_spec.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Phenomenal::Manager do
|
4
|
-
before :each do
|
5
|
-
@context = Phenomenal::Context.new(:test)
|
6
|
-
@context2 = Phenomenal::Context.new(:test2)
|
7
|
-
@combined = context :test,:test2
|
8
|
-
@manager = Phenomenal::Manager.instance
|
9
|
-
end
|
10
|
-
|
11
|
-
after :each do
|
12
|
-
force_forget_context(@context)
|
13
|
-
force_forget_context(@context2)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#register_context" do
|
17
|
-
pending "TODO"
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#unregister_context" do
|
21
|
-
pending "TODO"
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#register_adaptation" do
|
25
|
-
pending "unregister_adaptation"
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#activate_context" do
|
29
|
-
pending "TODO"
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#deactivate_context" do
|
33
|
-
pending "TODO"
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "#proceed" do
|
37
|
-
pending "TODO"
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "#change_conflict_policy" do
|
41
|
-
pending "TODO"
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "#find_context" do
|
45
|
-
it "should return the simple context with the name passed as parameter" do
|
46
|
-
@manager.find_context(:test).should==@context
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should raise an error if the context wasn't found" do
|
50
|
-
expect {@manager.find_context(:unknown)}.to raise_error Phenomenal::Error
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should return the context immediatly if the argument is a context an is known by the manager" do
|
54
|
-
@manager.find_context(@context).should==@context
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should return the combined context matching the list of names passed as parameters" do
|
58
|
-
@manager.find_context(:test,:test2).should==@combined
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#context_defined?" do
|
63
|
-
it "should return the context if the context exist" do
|
64
|
-
@manager.context_defined?(:test).should==@context
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should return nil if the context doesn't exist" do
|
68
|
-
context = Phenomenal::Context.new(:context)
|
69
|
-
@manager.context_defined?(:context).should==context
|
70
|
-
context.forget
|
71
|
-
@manager.context_defined?(:context).should be_nil
|
72
|
-
@manager.context_defined?(:unknown).should be_nil
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should work with context references" do
|
76
|
-
@manager.context_defined?(@context).should==@context
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should work with combined contexts" do
|
80
|
-
@manager.context_defined?(:test,:test2).should==@combined
|
81
|
-
@manager.context_defined?(:test,:unknown).should be_nil
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
data/spec/proc_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Proc do
|
4
|
-
describe "#phenomenal_bind" do
|
5
|
-
it "should be possible to bind proc as instance methods" do
|
6
|
-
p = Proc.new{"Proc"}
|
7
|
-
p.should respond_to :phenomenal_bind
|
8
|
-
o = BasicObject.new
|
9
|
-
p.phenomenal_bind(o).call.should == "Proc"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#phenomenal_class_bind" do
|
14
|
-
it "should be possible to bind proc as class methods" do
|
15
|
-
p = Proc.new{"Proc"}
|
16
|
-
p.should respond_to :phenomenal_class_bind
|
17
|
-
p.phenomenal_bind(BasicObject).call.should == "Proc"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Phenomenal::Relationship do
|
4
|
-
describe "#==" do
|
5
|
-
it "should be true for two relationships with the same source and target" do
|
6
|
-
a = Phenomenal::Relationship.new(:source,:target,nil)
|
7
|
-
b = Phenomenal::Relationship.new(:source,:target,nil)
|
8
|
-
a.should == b
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should be false for relationships concerning different contexts" do
|
12
|
-
a = Phenomenal::Relationship.new(:source,:target,nil)
|
13
|
-
c = Phenomenal::Relationship.new(:source,:other_target,nil)
|
14
|
-
a.should_not == c
|
15
|
-
d = Phenomenal::Relationship.new(:other_source,:other_target,nil)
|
16
|
-
a.should_not == d
|
17
|
-
e = Phenomenal::Relationship.new(:other_source,:target,nil)
|
18
|
-
a.should_not == e
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should be false for relationships of different types" do
|
22
|
-
a = Phenomenal::Implication.new(:source,:target,nil)
|
23
|
-
b = Phenomenal::Requirement.new(:source,:target,nil)
|
24
|
-
a.should_not == b
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#refresh" do
|
29
|
-
pending "TODO"
|
30
|
-
end
|
31
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Phenomenal::RelationshipsManager do
|
4
|
-
describe "#activate_relationships" do
|
5
|
-
pending "TODO"
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "#deactivate_relationships" do
|
9
|
-
pending "TODO"
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#update_relationships_references" do
|
13
|
-
pending "TODO"
|
14
|
-
end
|
15
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Phenomenal::RelationshipsStore do
|
4
|
-
describe "#add" do
|
5
|
-
pending "TODO"
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "#remove" do
|
9
|
-
pending "TODO"
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#update_references" do
|
13
|
-
pending "TODO"
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#get_for" do
|
17
|
-
pending "TODO"
|
18
|
-
end
|
19
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require "phenomenal"
|
3
|
-
|
4
|
-
RSpec.configure do |config|
|
5
|
-
config.color_enabled = true
|
6
|
-
config.formatter = 'progress'
|
7
|
-
end
|
8
|
-
|
9
|
-
def force_forget_context(context)
|
10
|
-
while phen_context_active?(context) do
|
11
|
-
phen_deactivate_context(context)
|
12
|
-
end
|
13
|
-
phen_forget_context(context)
|
14
|
-
end
|
15
|
-
|
16
|
-
def define_test_classes
|
17
|
-
load "test_classes.rb"
|
18
|
-
end
|