rules_engine 0.1.10 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/VERSION +1 -1
  2. data/rails_generators/manifests/rules_engine.rb +25 -18
  3. data/rails_generators/manifests/rules_engine.yml +10 -3
  4. data/rails_generators/templates/app/controllers/re_history_controller.rb +15 -0
  5. data/rails_generators/templates/app/controllers/re_plan_workflows_controller.rb +12 -23
  6. data/rails_generators/templates/app/controllers/re_plans_controller.rb +11 -11
  7. data/rails_generators/templates/app/controllers/re_workflow_rules_controller.rb +2 -1
  8. data/rails_generators/templates/app/controllers/re_workflows_controller.rb +7 -7
  9. data/rails_generators/templates/app/helpers/rules_engine_helper.rb +1 -1
  10. data/rails_generators/templates/app/models/re_plan.rb +1 -1
  11. data/rails_generators/templates/app/models/re_rule.rb +1 -2
  12. data/rails_generators/templates/app/models/re_workflow.rb +1 -9
  13. data/rails_generators/templates/app/views/re_history/_index_prepare.html.erb +12 -0
  14. data/rails_generators/templates/app/views/re_history/_index_update.html.erb +20 -0
  15. data/rails_generators/templates/app/views/re_history/_show.html.erb +30 -0
  16. data/rails_generators/templates/app/views/re_history/index.html.erb +11 -0
  17. data/rails_generators/templates/app/views/re_history/index.js.erb +4 -0
  18. data/rails_generators/templates/app/views/re_history/show.html.erb +8 -0
  19. data/rails_generators/templates/app/views/re_history/show.js.erb +4 -0
  20. data/rails_generators/templates/app/views/re_plans/_copy.html.erb +1 -1
  21. data/rails_generators/templates/app/views/re_plans/{re_process.html.erb → history.html.erb} +3 -3
  22. data/rails_generators/templates/app/views/re_plans/history.js.erb +4 -0
  23. data/rails_generators/templates/app/views/re_plans/index.html.erb +2 -2
  24. data/rails_generators/templates/app/views/re_plans/preview.html.erb +0 -1
  25. data/rails_generators/templates/app/views/re_plans/show.html.erb +2 -2
  26. data/rails_generators/templates/app/views/re_workflows/_copy.html.erb +1 -1
  27. data/rails_generators/templates/app/views/re_workflows/index.html.erb +2 -2
  28. data/rails_generators/templates/doc/README.rules_engine +1 -1
  29. data/rails_generators/templates/public/javascripts/rules_engine/re_history_index.js +43 -0
  30. data/rails_generators/templates/public/javascripts/rules_engine/{re_process_show.js → re_history_show.js} +3 -3
  31. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/error-14.png +0 -0
  32. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/info-14.png +0 -0
  33. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/list-25.png +0 -0
  34. data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/success-14.png +0 -0
  35. data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +19 -69
  36. data/rails_generators/templates/spec/controllers/re_application_controller_spec.rb +68 -0
  37. data/rails_generators/templates/spec/controllers/re_history_controller_spec.rb +41 -0
  38. data/rails_generators/templates/spec/controllers/re_plan_workflow_rules_controller_spec.rb +355 -0
  39. data/rails_generators/templates/spec/controllers/re_plan_workflows_controller_spec.rb +364 -0
  40. data/rails_generators/templates/spec/controllers/re_plans_controller_spec.rb +165 -223
  41. data/rails_generators/templates/spec/controllers/re_publications_controller_spec.rb +29 -0
  42. data/rails_generators/templates/spec/controllers/re_workflow_rules_controller_spec.rb +353 -0
  43. data/rails_generators/templates/spec/controllers/re_workflows_controller_spec.rb +326 -0
  44. data/rails_generators/templates/spec/helpers/rules_engine_helper_spec.rb +8 -8
  45. metadata +28 -21
  46. data/rails_generators/templates/app/controllers/re_processes_controller.rb +0 -15
  47. data/rails_generators/templates/app/views/re_plans/re_process.js.erb +0 -4
  48. data/rails_generators/templates/app/views/re_processes/_index_prepare.html.erb +0 -12
  49. data/rails_generators/templates/app/views/re_processes/_index_update.html.erb +0 -20
  50. data/rails_generators/templates/app/views/re_processes/_show.html.erb +0 -30
  51. data/rails_generators/templates/app/views/re_processes/index.html.erb +0 -11
  52. data/rails_generators/templates/app/views/re_processes/index.js.erb +0 -4
  53. data/rails_generators/templates/app/views/re_processes/show.html.erb +0 -8
  54. data/rails_generators/templates/app/views/re_processes/show.js.erb +0 -4
  55. data/rails_generators/templates/public/javascripts/rules_engine/re_process_index.js +0 -43
@@ -41,26 +41,26 @@ describe RulesEngineHelper do
41
41
 
42
42
  describe "re_perocess_status" do
43
43
  it "should running" do
44
- helper.re_process_status(RulesEngine::Process::PROCESS_STATUS_RUNNING).should == 'running'
44
+ helper.re_history_status(RulesEngine::Process::PROCESS_STATUS_RUNNING).should == 'running'
45
45
  end
46
46
 
47
47
  it "should be success" do
48
- helper.re_process_status(RulesEngine::Process::PROCESS_STATUS_SUCCESS).should == 'success'
48
+ helper.re_history_status(RulesEngine::Process::PROCESS_STATUS_SUCCESS).should == 'success'
49
49
  end
50
50
 
51
51
  it "should be error" do
52
- helper.re_process_status(RulesEngine::Process::PROCESS_STATUS_FAILURE).should == 'error'
52
+ helper.re_history_status(RulesEngine::Process::PROCESS_STATUS_FAILURE).should == 'error'
53
53
  end
54
54
 
55
55
  it "should be info" do
56
- helper.re_process_status(RulesEngine::Process::PROCESS_STATUS_NONE).should == 'info'
56
+ helper.re_history_status(RulesEngine::Process::PROCESS_STATUS_NONE).should == 'info'
57
57
  end
58
58
 
59
59
  it "should accept string versions of the process status" do
60
- helper.re_process_status("#{RulesEngine::Process::PROCESS_STATUS_RUNNING}").should == 'running'
61
- helper.re_process_status("#{RulesEngine::Process::PROCESS_STATUS_SUCCESS}").should == 'success'
62
- helper.re_process_status("#{RulesEngine::Process::PROCESS_STATUS_FAILURE}").should == 'error'
63
- helper.re_process_status("#{RulesEngine::Process::PROCESS_STATUS_NONE}").should == 'info'
60
+ helper.re_history_status("#{RulesEngine::Process::PROCESS_STATUS_RUNNING}").should == 'running'
61
+ helper.re_history_status("#{RulesEngine::Process::PROCESS_STATUS_SUCCESS}").should == 'success'
62
+ helper.re_history_status("#{RulesEngine::Process::PROCESS_STATUS_FAILURE}").should == 'error'
63
+ helper.re_history_status("#{RulesEngine::Process::PROCESS_STATUS_NONE}").should == 'info'
64
64
  end
65
65
  end
66
66
 
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: 15
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 10
10
- version: 0.1.10
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Douglas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-07 00:00:00 +10:00
18
+ date: 2010-09-15 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -75,10 +75,10 @@ files:
75
75
  - rails_generators/manifests/simple.rb
76
76
  - rails_generators/manifests/simple.yml
77
77
  - rails_generators/rules_engine_generator.rb
78
+ - rails_generators/templates/app/controllers/re_history_controller.rb
78
79
  - rails_generators/templates/app/controllers/re_plan_workflow_rules_controller.rb
79
80
  - rails_generators/templates/app/controllers/re_plan_workflows_controller.rb
80
81
  - rails_generators/templates/app/controllers/re_plans_controller.rb
81
- - rails_generators/templates/app/controllers/re_processes_controller.rb
82
82
  - rails_generators/templates/app/controllers/re_publications_controller.rb
83
83
  - rails_generators/templates/app/controllers/re_workflow_rules_controller.rb
84
84
  - rails_generators/templates/app/controllers/re_workflows_controller.rb
@@ -90,6 +90,13 @@ files:
90
90
  - rails_generators/templates/app/rules/complex.rb
91
91
  - rails_generators/templates/app/rules/simple.rb
92
92
  - rails_generators/templates/app/views/layouts/rules_engine.html.erb
93
+ - rails_generators/templates/app/views/re_history/_index_prepare.html.erb
94
+ - rails_generators/templates/app/views/re_history/_index_update.html.erb
95
+ - rails_generators/templates/app/views/re_history/_show.html.erb
96
+ - rails_generators/templates/app/views/re_history/index.html.erb
97
+ - rails_generators/templates/app/views/re_history/index.js.erb
98
+ - rails_generators/templates/app/views/re_history/show.html.erb
99
+ - rails_generators/templates/app/views/re_history/show.js.erb
93
100
  - rails_generators/templates/app/views/re_plan_workflow_rules/edit.html.erb
94
101
  - rails_generators/templates/app/views/re_plan_workflow_rules/edit.js.erb
95
102
  - rails_generators/templates/app/views/re_plan_workflow_rules/error.html.erb
@@ -126,24 +133,17 @@ files:
126
133
  - rails_generators/templates/app/views/re_plans/create.js.erb
127
134
  - rails_generators/templates/app/views/re_plans/edit.html.erb
128
135
  - rails_generators/templates/app/views/re_plans/edit.js.erb
136
+ - rails_generators/templates/app/views/re_plans/history.html.erb
137
+ - rails_generators/templates/app/views/re_plans/history.js.erb
129
138
  - rails_generators/templates/app/views/re_plans/index.html.erb
130
139
  - rails_generators/templates/app/views/re_plans/index.js.erb
131
140
  - rails_generators/templates/app/views/re_plans/new.html.erb
132
141
  - rails_generators/templates/app/views/re_plans/new.js.erb
133
142
  - rails_generators/templates/app/views/re_plans/preview.html.erb
134
143
  - rails_generators/templates/app/views/re_plans/preview.js.erb
135
- - rails_generators/templates/app/views/re_plans/re_process.html.erb
136
- - rails_generators/templates/app/views/re_plans/re_process.js.erb
137
144
  - rails_generators/templates/app/views/re_plans/show.html.erb
138
145
  - rails_generators/templates/app/views/re_plans/template.html.erb
139
146
  - rails_generators/templates/app/views/re_plans/update.js.erb
140
- - rails_generators/templates/app/views/re_processes/_index_prepare.html.erb
141
- - rails_generators/templates/app/views/re_processes/_index_update.html.erb
142
- - rails_generators/templates/app/views/re_processes/_show.html.erb
143
- - rails_generators/templates/app/views/re_processes/index.html.erb
144
- - rails_generators/templates/app/views/re_processes/index.js.erb
145
- - rails_generators/templates/app/views/re_processes/show.html.erb
146
- - rails_generators/templates/app/views/re_processes/show.js.erb
147
147
  - rails_generators/templates/app/views/re_publications/_show_prepare.html.erb
148
148
  - rails_generators/templates/app/views/re_publications/_show_update.html.erb
149
149
  - rails_generators/templates/app/views/re_publications/show.html.erb
@@ -221,11 +221,11 @@ files:
221
221
  - rails_generators/templates/public/javascripts/jquery.autocomplete.pack.js
222
222
  - rails_generators/templates/public/javascripts/jquery.blockUI.js
223
223
  - rails_generators/templates/public/javascripts/jquery.fancybox-1.3.1.js
224
+ - rails_generators/templates/public/javascripts/rules_engine/re_history_index.js
225
+ - rails_generators/templates/public/javascripts/rules_engine/re_history_show.js
224
226
  - rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js
225
227
  - rails_generators/templates/public/javascripts/rules_engine/re_plan_new.js
226
228
  - rails_generators/templates/public/javascripts/rules_engine/re_plan_preview.js
227
- - rails_generators/templates/public/javascripts/rules_engine/re_process_index.js
228
- - rails_generators/templates/public/javascripts/rules_engine/re_process_show.js
229
229
  - rails_generators/templates/public/javascripts/rules_engine/re_publication_show.js
230
230
  - rails_generators/templates/public/javascripts/rules_engine/re_view.js
231
231
  - rails_generators/templates/public/javascripts/rules_engine/re_workflow_add.js
@@ -325,6 +325,10 @@ files:
325
325
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_common/status-verify-14.png
326
326
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_common/status-verify-18.png
327
327
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_common/status-verify-25.png
328
+ - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_history/error-14.png
329
+ - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_history/info-14.png
330
+ - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_history/list-25.png
331
+ - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_history/success-14.png
328
332
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/alert-25.png
329
333
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/change-25.png
330
334
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/copy-25.png
@@ -338,10 +342,6 @@ files:
338
342
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/show-25.png
339
343
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/title-plural.png
340
344
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/title-single.png
341
- - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_process/error-14.png
342
- - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_process/info-14.png
343
- - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_process/list-25.png
344
- - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_process/success-14.png
345
345
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_publication/show-25.png
346
346
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_rule/add-14.png
347
347
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_rule/alert-25.png
@@ -386,7 +386,14 @@ files:
386
386
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_workflow/title-plural.png
387
387
  - rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_workflow/title-single.png
388
388
  - rails_generators/templates/public/stylesheets/rules_engine/screen.css
389
+ - rails_generators/templates/spec/controllers/re_application_controller_spec.rb
390
+ - rails_generators/templates/spec/controllers/re_history_controller_spec.rb
391
+ - rails_generators/templates/spec/controllers/re_plan_workflow_rules_controller_spec.rb
392
+ - rails_generators/templates/spec/controllers/re_plan_workflows_controller_spec.rb
389
393
  - rails_generators/templates/spec/controllers/re_plans_controller_spec.rb
394
+ - rails_generators/templates/spec/controllers/re_publications_controller_spec.rb
395
+ - rails_generators/templates/spec/controllers/re_workflow_rules_controller_spec.rb
396
+ - rails_generators/templates/spec/controllers/re_workflows_controller_spec.rb
390
397
  - rails_generators/templates/spec/helpers/rules_engine_helper_spec.rb
391
398
  - rails_generators/templates/spec/lib/rules/complex_spec.rb
392
399
  - rails_generators/templates/spec/lib/rules/simple_spec.rb
@@ -1,15 +0,0 @@
1
- class ReProcessesController < ApplicationController
2
- helper :rules_engine
3
- layout 'rules_engine'
4
-
5
- # before_filter :login_required
6
- before_filter :rules_engine_reader_access_required, :only => [:index, :show]
7
-
8
- def index
9
- @re_processes = RulesEngine::Process.runner.history(nil, :page => params[:page] || 1, :per_page => 5)
10
- end
11
-
12
- def show
13
- @re_audits = RulesEngine::Process.auditor.history(params[:id])
14
- end
15
- end
@@ -1,4 +0,0 @@
1
- $('#re_process_list_pending').hide();
2
-
3
- $('#re_process_list').html('<%=escape_javascript(render('/re_processes/index_update'))%>');
4
- $('#re_process_list').show();
@@ -1,12 +0,0 @@
1
- <h4>
2
- <div class="re-menu-process-list" id="re_menu_process_list_<%= re_plan_id %>">Process History</div>
3
- </h4>
4
-
5
- <div class="clear top-5"></div>
6
- <div id="re_process_list_pending">
7
- <div class="re-xtra-process-list-pending">
8
- Updating Processes
9
- </div>
10
- </div>
11
- <div id="re_process_list">
12
- </div>
@@ -1,20 +0,0 @@
1
- <% if @re_processes.nil? || @re_processes["processes"].nil? || @re_processes["processes"].empty? %>
2
- <h6 class="left-50 red"><em>Not Processed</em></h6>
3
- <% else %>
4
- <% @re_processes["processes"].each do |re_process| %>
5
- <div class="clear top-2"></div>
6
- <div class="left-10 right-5">
7
- <a class="re-code-small float-left re-xtra-process-show re-xtra-process-<%= re_process_status(re_process["process_status"]) %>" href="#<%= re_process["process_id"] %>">
8
- <%= re_process["plan_code"] %> <span class="blue">V.<%= re_process["plan_version"] %></span>
9
- </a>
10
- <div class="smalltext float-right right-5">
11
- <%= re_process["started_at"].nil? ? '' : Time.parse(re_process["started_at"]).strftime('%d %b %Y - %H:%M') %>
12
- </div>
13
- <hr/>
14
- </div>
15
- <% end %>
16
- <% if !@re_processes["processes"].empty? && (@re_processes["next_page"] || @re_processes["previous_page"]) %>
17
- <a class="re-xtra-process-next-<%= @re_processes["next_page"] ? 'enabled' : 'disabled' %>" href='#<%= @re_processes["next_page"] || '1' %>'></a>
18
- <a class="re-xtra-process-prev-<%= @re_processes["previous_page"] ? 'enabled' : 'disabled' %>" href='#<%= @re_processes["previous_page"] || '1' %>'></a>
19
- <% end %>
20
- <% end %>
@@ -1,30 +0,0 @@
1
- <div class="clear span-18">
2
- <div class="re-infobox">
3
- <h3 class="re-hdr-process-show"> Process Audit</h3>
4
- <div class="clear top-10"></div>
5
- <% if @re_audits.nil? || @re_audits["audits"].nil? || @re_audits["audits"].empty? %>
6
- <h6 class="left-50 red"><em>No Audit History</em></h6>
7
- <% else %>
8
- <% @re_audits["audits"].each do |re_audit| %>
9
- <div class="clear top-2"></div>
10
- <div class="left-10 right-5">
11
- <div class="re-code-small float-left re-xtra-process-audit-<%= re_audit_status(re_audit["code"]) %>">
12
- <%= re_audit["message"] %>
13
- </div>
14
- <div class="smalltext float-right right-5">
15
- <%= re_audit["created_at"].nil? ? '' : Time.parse(re_audit["created_at"]).strftime('%d %b %Y - %H:%M') %>
16
- </div>
17
- <hr/>
18
- </div>
19
-
20
- <% end %>
21
- <% if !@re_audits["audits"].empty? && (@re_audits["next_page"] || @re_audits["previous_page"]) %>
22
- <a class="re-xtra-process-next-<%= @re_audits["next_page"] ? 'enabled' : 'disabled' %>" href='#<%= @re_audits["next_page"] || '1' %>'></a>
23
- <a class="re-xtra-process-prev-<%= @re_audits["previous_page"] ? 'enabled' : 'disabled' %>" href='#<%= @re_audits["previous_page"] || '1' %>'></a>
24
- <% end %>
25
- <% end %>
26
- <%= re_button_link_orange('Close', re_processes_path, :id => "re_process_show_close") %>
27
- <div class="clear top-5"></div>
28
- </div>
29
- </div>
30
- <div class="clear"></div>
@@ -1,11 +0,0 @@
1
- <% set_re_javascript_include ['rules_engine/re_process_index', 'rules_engine/re_process_show'] %>
2
- <% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
3
- '<span class="re-bc-process-list">Show Processes</span>' %>
4
-
5
- <div class="prepend-1 span-22 append-1">
6
- <div class="re-infobox">
7
- <%= render '/re_processes/index_prepare', :re_plan_id => 0 %>
8
- <div class="clear top-5"></div>
9
- </div>
10
- </div>
11
- <div class="clear"></div>
@@ -1,4 +0,0 @@
1
- $('#re_process_list_pending').hide();
2
-
3
- $('#re_process_list').html('<%=escape_javascript(render('/re_processes/index_update'))%>');
4
- $('#re_process_list').show();
@@ -1,8 +0,0 @@
1
- <% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
2
- link_to("All Processes", re_processes_path, :class => "re-bc-process-list"),
3
- '<span class="re-bc-process-show">Show Process</span>' %>
4
-
5
- <div class="span-22 prepend-1 append-1">
6
- <%= render '/re_processes/show' %>
7
- </div>
8
- <div class="clear"></div>
@@ -1,4 +0,0 @@
1
- $('#re_content').html('<%=escape_javascript(render('/re_processes/show'))%>');
2
-
3
- $.re_unblock();
4
- $.fancybox({ href: '#re_content'});
@@ -1,43 +0,0 @@
1
- re_process_list_get = function(page) {
2
- var plan_id = $('.re-menu-process-list:first').attr('id').replace('re_menu_process_list_', '')
3
-
4
- if (plan_id.length == 0 || plan_id == "0")
5
- $.get('/re_processes?page=' + page, null, null, 'script');
6
- else
7
- $.get('/re_plans/' + plan_id + '/re_process?page=' + page, null, null, 'script');
8
- }
9
-
10
- $(document).ready(function() {
11
-
12
- re_process_list_get(1);
13
-
14
- $('.re-xtra-process-next-enabled').live('click', function() {
15
- var page = $(this).attr('href').replace('#', '')
16
-
17
- $('#re_process_list').hide();
18
- $('#re_process_list_pending').show();
19
-
20
- re_process_list_get(page);
21
- return false;
22
- });
23
-
24
- $('.re-xtra-process-next-disabled').live('click', function() {
25
- return false;
26
- });
27
-
28
- $('.re-xtra-process-prev-enabled').live('click', function() {
29
- var page = $(this).attr('href').replace('#', '')
30
-
31
- $('#re_process_list').hide();
32
- $('#re_process_list_pending').show();
33
-
34
- re_process_list_get(page);
35
- return false;
36
- });
37
-
38
- $('.re-xtra-process-prev-disabled').live('click', function() {
39
- return false;
40
- });
41
- });
42
-
43
-