rules_engine 0.0.5 → 0.0.6
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/VERSION +1 -1
- data/rails_generators/templates/app/controllers/re_pipelines_controller.rb +8 -4
- data/rails_generators/templates/app/models/re_rule.rb +5 -5
- data/rails_generators/templates/app/views/re_pipeline_rules/_change.html.erb +1 -1
- data/rails_generators/templates/app/views/re_pipeline_rules/_menu.html.erb +7 -7
- data/rails_generators/templates/public/javascripts/re_pipeline_change.js +3 -3
- data/rails_generators/templates/public/stylesheets/re_view.css +4 -2
- data/rails_generators/templates/public/stylesheets/re_view_error.css +2 -1
- data/rails_generators/templates/public/stylesheets/re_view_form.css +2 -1
- data/rails_generators/templates/public/stylesheets/rules_engine.css +10 -6
- data/rails_generators/templates/spec/controllers/re_pipelines_controller_spec.rb +35 -7
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -89,11 +89,15 @@ class RePipelinesController < ApplicationController
|
|
89
89
|
klass = RePipeline
|
90
90
|
@re_pipelines = klass.find(:all)
|
91
91
|
|
92
|
-
@re_pipelines.
|
93
|
-
|
92
|
+
if @re_pipelines.any? { | re_pipeline| !re_pipeline.valid? }
|
93
|
+
flash[:error] = 'Cannot Activate Pipelines.'
|
94
|
+
else
|
95
|
+
@re_pipelines.each do |re_pipeline|
|
96
|
+
re_pipeline.activate!
|
97
|
+
end
|
98
|
+
flash[:success] = 'All Pipelines Activated.'
|
94
99
|
end
|
95
|
-
|
96
|
-
|
100
|
+
|
97
101
|
respond_to do |format|
|
98
102
|
format.html do
|
99
103
|
redirect_to(re_pipelines_path)
|
@@ -61,26 +61,26 @@ class ReRule < ActiveRecord::Base
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def rule_attributes=params
|
64
|
-
raise 'rule class not found' if rule.nil?
|
64
|
+
raise 'rule class not found' if rule.nil?
|
65
65
|
rule.attributes = params
|
66
66
|
end
|
67
67
|
|
68
68
|
def before_save_rule
|
69
|
-
|
69
|
+
return if rule.nil?
|
70
70
|
self.title = rule.title
|
71
71
|
self.summary = rule.summary
|
72
72
|
self.data = rule.data
|
73
73
|
|
74
|
-
self.re_rule_expected_outcomes = (rule.expected_outcomes).map { |expected_outcome| ReRuleExpectedOutcome.new(expected_outcome) }
|
74
|
+
self.re_rule_expected_outcomes = (rule.expected_outcomes || []).map { |expected_outcome| ReRuleExpectedOutcome.new(expected_outcome) }
|
75
75
|
end
|
76
76
|
|
77
77
|
def after_create_rule
|
78
|
-
|
78
|
+
return if rule.nil?
|
79
79
|
rule.after_add_to_pipeline(self.re_pipeline_id, self.id)
|
80
80
|
end
|
81
81
|
|
82
82
|
def before_destroy_rule
|
83
|
-
|
83
|
+
return if rule.nil?
|
84
84
|
rule.before_remove_from_pipeline(self.re_pipeline_id, self.id)
|
85
85
|
end
|
86
86
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<div class="span-15 last re-rule-change" id="re_rule_change_<%= re_rule.id %>">
|
6
6
|
<div class="<%= rule_error.blank? ? 're-bluebox' : 're-redbox' %> re-rule-status-<%= rule_error.blank? ? 'valid' : 'verify' %>">
|
7
7
|
<h3 class="float-left"><%= re_rule.title %></h3>
|
8
|
-
<div class="float-right
|
8
|
+
<div class="float-right">
|
9
9
|
<%= link_to("<span>Edit</span>", "##{@re_pipeline.id}|#{re_rule.id}", :class => "re-rule-edit") %>
|
10
10
|
<%= link_to("<span>Delete</span>", "##{@re_pipeline.id}|#{re_rule.id}", :class => "re-rule-delete") %>
|
11
11
|
<%= link_to("<span>Move Down</span>", "##{@re_pipeline.id}|#{re_rule.id}", :class => "#{local_last_rule ? 're-rule-move-down-off' : 're-rule-move-down'}") %>
|
@@ -8,11 +8,11 @@
|
|
8
8
|
<div class="re-rule-class-list hide" id="re_rule_class_name_<%= name.downcase.gsub(/[^a-z0-9]+/i, '_') %>">
|
9
9
|
<% rule_classes.each do |rule_class| %>
|
10
10
|
<div class="re-yellowbox">
|
11
|
-
<h5>
|
12
|
-
<%= rule_class.options[:display_name] %>
|
13
|
-
</h5>
|
14
11
|
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-new"> <span>Add</span> </a>
|
15
12
|
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-help"> <span>Help</span> </a>
|
13
|
+
<div class="float-left">
|
14
|
+
<%= rule_class.options[:display_name] %>
|
15
|
+
</div>
|
16
16
|
<div class="clear"></div>
|
17
17
|
</div>
|
18
18
|
<div class="clear top-5"></div>
|
@@ -23,11 +23,11 @@
|
|
23
23
|
<div class="re-rule-class-list" id="re_rule_class_name_all">
|
24
24
|
<% RulesEngine::Discovery.rule_classes.each do |rule_class| %>
|
25
25
|
<div class="re-yellowbox">
|
26
|
-
|
26
|
+
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-new"> <span>Add</span> </a>
|
27
|
+
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-help"> <span>Help</span> </a>
|
28
|
+
<div class="float-left">
|
27
29
|
<%= rule_class.options[:display_name] %>
|
28
|
-
</
|
29
|
-
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-new"> <span>Add</span> </a>
|
30
|
-
<a href="#<%=@re_pipeline.id%>|<%= rule_class %>" class="re-rule-class-help"> <span>Help</span> </a>
|
30
|
+
</div>
|
31
31
|
<div class="clear"></div>
|
32
32
|
</div>
|
33
33
|
<div class="clear top-5"></div>
|
@@ -72,7 +72,7 @@ $(document).ready(function() {
|
|
72
72
|
return false;
|
73
73
|
|
74
74
|
$.re_block();
|
75
|
-
$.get('/re_pipelines/' + values[0] + '/
|
75
|
+
$.get('/re_pipelines/' + values[0] + '/re_rules/new?rule_class_name=' + values[1], null, null, 'script');
|
76
76
|
return false;
|
77
77
|
});
|
78
78
|
|
@@ -94,7 +94,7 @@ $(document).ready(function() {
|
|
94
94
|
return false;
|
95
95
|
|
96
96
|
$.re_block();
|
97
|
-
$.get('/re_pipelines/' + values[0] + '/
|
97
|
+
$.get('/re_pipelines/' + values[0] + '/re_rules/' + values[1] + '/edit', null, null, 'script');
|
98
98
|
return false;
|
99
99
|
});
|
100
100
|
|
@@ -170,7 +170,7 @@ $(document).ready(function() {
|
|
170
170
|
return false;
|
171
171
|
|
172
172
|
$.re_block();
|
173
|
-
$.get('/re_pipelines/' + values[0] + '/
|
173
|
+
$.get('/re_pipelines/' + values[0] + '/re_rules/help?rule_class_name=' + values[1], null, null, 'script');
|
174
174
|
return false;
|
175
175
|
});
|
176
176
|
|
@@ -3,7 +3,8 @@ html, body {
|
|
3
3
|
margin: 0px;
|
4
4
|
padding: 0px;
|
5
5
|
font-size: 14px;
|
6
|
-
color: #000
|
6
|
+
/* color: #000;*/
|
7
|
+
color: #222;
|
7
8
|
background: #2F323C;
|
8
9
|
font-family: "Lucida Grande","Lucida Sans Unicode",verdana,arial,helvetica,sans-serif;
|
9
10
|
}
|
@@ -15,7 +16,8 @@ html, body {
|
|
15
16
|
|
16
17
|
h1, h2, h3, h4, h5, h6 {
|
17
18
|
font-weight:normal;
|
18
|
-
color:#111
|
19
|
+
/* color:#111;*/
|
20
|
+
color: #222;
|
19
21
|
}
|
20
22
|
h1 {
|
21
23
|
font-size:36px;
|
@@ -1,8 +1,3 @@
|
|
1
|
-
/* CHANGE THE RULES MENU */
|
2
|
-
/*.re-rule-menu .shadowbox-outer{*/
|
3
|
-
/* padding-bottom: 15px;*/
|
4
|
-
/*}*/
|
5
|
-
|
6
1
|
/* breadcrumb title items */
|
7
2
|
.re-breadcrumbs .re-pipeline-list {
|
8
3
|
background: transparent url('./rules_engine/re_pipeline/list-25.png') no-repeat 0 6px;
|
@@ -251,18 +246,26 @@ h2.re-rule-edit {
|
|
251
246
|
padding: 0px 0 0 28px;
|
252
247
|
}
|
253
248
|
|
249
|
+
.re-rule-show p{
|
250
|
+
font-size: 13px;
|
251
|
+
}
|
254
252
|
.re-rule-show div.re-rule-status-valid {
|
255
253
|
background: transparent url('./rules_engine/re_rule/valid-18.png') no-repeat 2px 2px;
|
256
254
|
padding: 2px 0 4px 24px;
|
255
|
+
font-weight: bold;
|
257
256
|
}
|
258
257
|
.re-rule-show div.re-rule-status-verify {
|
259
258
|
background: #FBE3E4 url('./rules_engine/re_rule/verify-18.png') no-repeat 2px 2px;
|
260
259
|
padding: 2px 0 4px 24px;
|
260
|
+
font-weight: bold;
|
261
261
|
}
|
262
262
|
.re-rule-change h3 {
|
263
263
|
margin: 0;
|
264
264
|
padding: 0;
|
265
265
|
}
|
266
|
+
.re-rule-change p{
|
267
|
+
font-size: 13px;
|
268
|
+
}
|
266
269
|
.re-rule-change div.re-rule-status-valid {
|
267
270
|
background: transparent url('./rules_engine/re_rule/valid-25.png') no-repeat 2px 2px;
|
268
271
|
padding: 2px 0 4px 31px;
|
@@ -511,7 +514,8 @@ a.re-rule-class-help span {
|
|
511
514
|
}
|
512
515
|
|
513
516
|
a.re-job-detail {
|
514
|
-
color: #000
|
517
|
+
/* color: #000;*/
|
518
|
+
color: #222;
|
515
519
|
text-decoration: none;
|
516
520
|
background-color: #222;
|
517
521
|
}
|
@@ -269,8 +269,10 @@ describe RePipelinesController do
|
|
269
269
|
|
270
270
|
before do
|
271
271
|
@re_pipeline_1 = mock_model(RePipeline)
|
272
|
+
@re_pipeline_1.stub!(:valid?).and_return(true)
|
272
273
|
@re_pipeline_1.stub!(:activate!)
|
273
274
|
@re_pipeline_2 = mock_model(RePipeline)
|
275
|
+
@re_pipeline_2.stub!(:valid?).and_return(true)
|
274
276
|
@re_pipeline_2.stub!(:activate!)
|
275
277
|
RePipeline.stub!(:find).and_return([@re_pipeline_1, @re_pipeline_2])
|
276
278
|
end
|
@@ -281,15 +283,41 @@ describe RePipelinesController do
|
|
281
283
|
assigns[:re_pipelines].should == [@re_pipeline_1, @re_pipeline_2]
|
282
284
|
end
|
283
285
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
286
|
+
describe "all of the pipelines are valid" do
|
287
|
+
it "should activate all of the re_pipeline" do
|
288
|
+
@re_pipeline_1.should_receive(:activate!)
|
289
|
+
@re_pipeline_2.should_receive(:activate!)
|
290
|
+
put :activate_all
|
291
|
+
end
|
292
|
+
|
293
|
+
it "should display a flash success message" do
|
294
|
+
put :activate_all
|
295
|
+
flash[:success].should_not be_blank
|
296
|
+
end
|
288
297
|
end
|
298
|
+
|
299
|
+
describe "one of the pipelines is invalid" do
|
300
|
+
before(:each) do
|
301
|
+
@re_pipeline_2.stub!(:valid?).and_return(false)
|
302
|
+
@re_pipeline_2.stub!(:valid?).and_return(false)
|
303
|
+
end
|
304
|
+
|
305
|
+
it "should stop checking at the first invalid pipeline" do
|
306
|
+
@re_pipeline_1.should_receive(:valid?).and_return(false)
|
307
|
+
@re_pipeline_2.should_not_receive(:valid?)
|
308
|
+
put :activate_all
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should not activate the pipelines" do
|
312
|
+
@re_pipeline_1.should_not_receive(:activate!)
|
313
|
+
@re_pipeline_2.should_not_receive(:activate!)
|
314
|
+
put :activate_all
|
315
|
+
end
|
289
316
|
|
290
|
-
|
291
|
-
|
292
|
-
|
317
|
+
it "should display a flash error message" do
|
318
|
+
put :activate_all
|
319
|
+
flash[:error].should_not be_blank
|
320
|
+
end
|
293
321
|
end
|
294
322
|
|
295
323
|
it "should redirect to the re_pipeline index page for HTML" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rules_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Douglas
|