ruote-kit 2.1.10 → 2.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG.txt +10 -0
  3. data/Gemfile +21 -5
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +132 -80
  6. data/Rakefile +4 -15
  7. data/TODO.txt +12 -0
  8. data/config.ru +22 -14
  9. data/lib/ruote-kit/application.rb +46 -22
  10. data/lib/ruote-kit/helpers/json_helpers.rb +280 -0
  11. data/lib/ruote-kit/helpers/link_helpers.rb +117 -0
  12. data/lib/ruote-kit/helpers/misc_helpers.rb +35 -0
  13. data/lib/ruote-kit/helpers/pagination_helpers.rb +30 -0
  14. data/lib/ruote-kit/helpers/render_helpers.rb +39 -92
  15. data/lib/ruote-kit/public/_ruote/images/favicon.ico +0 -0
  16. data/lib/ruote-kit/public/_ruote/images/ruote.png +0 -0
  17. data/lib/ruote-kit/public/_ruote/images/ruote_buttons.png +0 -0
  18. data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js +154 -0
  19. data/lib/ruote-kit/public/_ruote/javascripts/rk.js +40 -0
  20. data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js +548 -0
  21. data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js +32 -1
  22. data/lib/ruote-kit/public/_ruote/stylesheets/reset.css +53 -0
  23. data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +355 -16
  24. data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css +108 -0
  25. data/lib/ruote-kit/resources/errors.rb +46 -43
  26. data/lib/ruote-kit/resources/expressions.rb +92 -35
  27. data/lib/ruote-kit/resources/participants.rb +53 -0
  28. data/lib/ruote-kit/resources/processes.rb +68 -36
  29. data/lib/ruote-kit/resources/schedules.rb +27 -0
  30. data/lib/ruote-kit/resources/workitems.rb +93 -31
  31. data/lib/ruote-kit/spec/ruote_helpers.rb +25 -16
  32. data/lib/ruote-kit/version.rb +3 -1
  33. data/lib/ruote-kit/views/_pagination.html.haml +38 -0
  34. data/lib/ruote-kit/views/_tree_editor.html.haml +52 -0
  35. data/lib/ruote-kit/views/error.html.haml +69 -0
  36. data/lib/ruote-kit/views/errors.html.haml +28 -12
  37. data/lib/ruote-kit/views/expression.html.haml +161 -30
  38. data/lib/ruote-kit/views/expressions.html.haml +26 -21
  39. data/lib/ruote-kit/views/http_error.html.haml +11 -0
  40. data/lib/ruote-kit/views/index.html.haml +4 -0
  41. data/lib/ruote-kit/views/layout.html.haml +52 -32
  42. data/lib/ruote-kit/views/participants.html.haml +79 -0
  43. data/lib/ruote-kit/views/process.html.haml +109 -42
  44. data/lib/ruote-kit/views/process_launched.html.haml +6 -2
  45. data/lib/ruote-kit/views/processes.html.haml +55 -24
  46. data/lib/ruote-kit/views/processes_new.html.haml +36 -0
  47. data/lib/ruote-kit/views/schedules.html.haml +42 -0
  48. data/lib/ruote-kit/views/workitem.html.haml +83 -29
  49. data/lib/ruote-kit/views/workitems.html.haml +42 -19
  50. data/lib/ruote-kit.rb +17 -88
  51. data/ruote-kit.gemspec +68 -80
  52. data/spec/it_has_an_engine.rb +69 -0
  53. data/spec/resources/errors_spec.rb +198 -270
  54. data/spec/resources/expressions_spec.rb +308 -52
  55. data/spec/resources/index_spec.rb +28 -16
  56. data/spec/resources/participants_spec.rb +102 -0
  57. data/spec/resources/processes_spec.rb +218 -104
  58. data/spec/resources/schedules_spec.rb +97 -0
  59. data/spec/resources/workitems_spec.rb +195 -100
  60. data/spec/ruote-kit_configure_spec.rb +32 -75
  61. data/spec/spec.opts +0 -1
  62. data/spec/spec_helper.rb +31 -92
  63. data/spec/webapp_helpers_spec.rb +309 -0
  64. metadata +87 -152
  65. data/lib/ruote-kit/configuration.rb +0 -83
  66. data/lib/ruote-kit/helpers/engine_helpers.rb +0 -24
  67. data/lib/ruote-kit/helpers/form_helpers.rb +0 -11
  68. data/lib/ruote-kit/helpers/launch_item_parser.rb +0 -59
  69. data/lib/ruote-kit/helpers/navigation_helpers.rb +0 -54
  70. data/lib/ruote-kit/helpers.rb +0 -9
  71. data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
  72. data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
  73. data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
  74. data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
  75. data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
  76. data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +0 -191
  77. data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +0 -149
  78. data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +0 -226
  79. data/lib/ruote-kit/public/_ruote/stylesheets/base.css +0 -336
  80. data/lib/ruote-kit/public/_ruote/stylesheets/style.css +0 -393
  81. data/lib/ruote-kit/views/launch_process.html.haml +0 -19
  82. data/lib/ruote-kit/views/process_failed_to_launch.html.haml +0 -7
  83. data/lib/ruote-kit/views/resource_not_found.html.haml +0 -7
  84. data/spec/helpers/render_helpers_spec.rb +0 -214
  85. data/spec/ruote-kit_spec.rb +0 -4
  86. data/spec/views/expressions.html.haml_spec.rb +0 -31
  87. data/spec/views/launch_process.html.haml_spec.rb +0 -22
  88. data/spec/views/process.html.haml_spec.rb +0 -17
  89. data/spec/views/process_launched.html.haml_spec.rb +0 -16
  90. data/spec/views/processes.html.haml_spec.rb +0 -31
  91. data/spec/views/workitems.html.haml_spec.rb +0 -69
@@ -1,7 +0,0 @@
1
- %h2 Process failed to launch
2
-
3
- .flash
4
- .message.error
5
- %p
6
- &= @error.message
7
- %a{ :href => "javascript:history.go(-1)" } Go back to the previous page
@@ -1,7 +0,0 @@
1
- %h2 Resource not found
2
-
3
- .flash
4
- .message.error
5
- %p
6
- The resource you requested could not be found.
7
- %a{ :href => "javascript:history.go(-1)" } Go back to the previous page
@@ -1,214 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- undef :context if defined?(context)
4
-
5
- describe "json helper", :type => :with_engine do
6
-
7
- describe "rendering defaults" do
8
- before(:each) do
9
- stub_chain( :request, :fullpath ).and_return('/_ruote')
10
-
11
- @hash = Rufus::Json.decode( json( :status, :ok ) )
12
- end
13
-
14
- it "should have the key & value" do
15
- @hash.should have_key('status')
16
- @hash['status'].should == 'ok'
17
- end
18
-
19
- it "should have a collection of links" do
20
- @hash.should have_key('links')
21
- @hash['links'].should_not be_empty
22
- end
23
-
24
- it "should link to 'self'" do
25
- @hash['links'].detect { |l| l['rel'] == 'self' && l['href'] == '/_ruote' }.should_not be_nil
26
- end
27
-
28
- it "should link to the root" do
29
- @hash['links'].detect { |l| l['rel'] =~ /#root$/ && l['href'] == '/_ruote' }.should_not be_nil
30
- end
31
-
32
- it "should link to the processes" do
33
- @hash['links'].detect { |l| l['rel'] =~ /#processes$/ && l['href'] == '/_ruote/processes' }.should_not be_nil
34
- end
35
-
36
- it "should not link to the expressions by default" do
37
- @hash['links'].detect { |l| l['rel'] =~ /#expressions$/ && l['href'] == '/_ruote/expressions' }.should be_nil
38
- end
39
-
40
- it "should link to the workitems" do
41
- @hash['links'].detect { |l| l['rel'] =~ /#workitems$/ && l['href'] == '/_ruote/workitems' }.should_not be_nil
42
- end
43
- end
44
-
45
- describe "rendering processes" do
46
- before(:each) do
47
- stub_chain( :request, :fullpath ).and_return('/_ruote/processes')
48
-
49
- @wfid = launch_test_process
50
- process = engine.process( @wfid )
51
-
52
- @hash = Rufus::Json.decode( json( :processes, [process] ) )
53
- end
54
-
55
- it "should have a collection of processes" do
56
- @hash.should have_key('processes')
57
- @hash['processes'].should_not be_empty
58
- end
59
-
60
- describe "in detail, and" do
61
- before(:each) do
62
- @process = @hash['processes'].first
63
-
64
- @process.should have_key('links')
65
- end
66
-
67
- it "should link to the process details" do
68
-
69
- @process['links'].detect { |l| l['rel'] =~ /#process/ && l['href'] == "/_ruote/processes/#{@wfid}" }.should_not be_nil
70
- end
71
-
72
- it "should link to the process expressions" do
73
-
74
- @process['links'].detect { |l| l['rel'] =~ /#expressions/ && l['href'] == "/_ruote/expressions/#{@wfid}" }.should_not be_nil
75
- end
76
-
77
- it "should link to the process workitems" do
78
-
79
- @process['links'].detect { |l| l['rel'] =~ /#workitems/ && l['href'] == "/_ruote/workitems/#{@wfid}" }.should_not be_nil
80
- end
81
- end
82
-
83
- end
84
-
85
- describe "rendering a single process" do
86
- before(:each) do
87
- @wfid = launch_test_process
88
-
89
- stub_chain( :request, :fullpath ).and_return("/_ruote/processes/#{@wfid}")
90
-
91
- process = engine.process( @wfid )
92
-
93
- @hash = Rufus::Json.decode( json( :process, process ) )
94
- end
95
-
96
- it "should have the process details" do
97
- @hash.should have_key('process')
98
- end
99
-
100
- it "should link to the process details" do
101
-
102
- @hash['process']['links'].detect { |l| l['rel'] =~ /#process/ && l['href'] == "/_ruote/processes/#{@wfid}" }.should_not be_nil
103
- end
104
-
105
- it "should link to the process expressions" do
106
-
107
- @hash['process']['links'].detect { |l| l['rel'] =~ /#expressions/ && l['href'] == "/_ruote/expressions/#{@wfid}" }.should_not be_nil
108
- end
109
-
110
- it "should link to the process workitems" do
111
-
112
- @hash['process']['links'].detect { |l| l['rel'] =~ /#workitems/ && l['href'] == "/_ruote/workitems/#{@wfid}" }.should_not be_nil
113
- end
114
- end
115
-
116
- describe "render a single expression" do
117
- before(:each) do
118
- @wfid = launch_test_process do
119
- Ruote.process_definition :name => 'foo' do
120
- sequence do
121
- nada :activity => 'work your magic'
122
- end
123
- end
124
- end
125
-
126
- @expid = '0_0_0'
127
-
128
- stub_chain( :request, :fullpath ).and_return("/_ruote/expressions/#{@wfid}/#{@expid}")
129
-
130
- process = engine.process( @wfid )
131
- expression = process.expressions.detect { |exp| exp.fei.expid == @expid }
132
-
133
- @hash = Rufus::Json.decode( json( :expression, expression ) )
134
- end
135
-
136
- it "should contain the expression" do
137
- @hash.should have_key('expression')
138
- end
139
-
140
- it "should link to the process" do
141
- @hash['expression']['links'].detect { |l| l['rel'] =~ /#process/ && l['href'] == "/_ruote/processes/#{@wfid}" }.should_not be_nil
142
- end
143
-
144
- it "should link to the parent expression" do
145
- @hash['expression']['links'].detect { |l| l['rel'] == 'parent' && l['href'] == "/_ruote/expressions/#{@wfid}/0_0" }.should_not be_nil
146
- end
147
- end
148
-
149
- describe "render an expression tree" do
150
- before(:each) do
151
- @wfid = launch_test_process do
152
- Ruote.process_definition :name => 'foo' do
153
- sequence do
154
- nada :activity => 'work your magic'
155
- end
156
- end
157
- end
158
-
159
- stub_chain( :request, :fullpath ).and_return("/_ruote/expressions/#{@wfid}")
160
-
161
- process = engine.process( @wfid )
162
-
163
- @hash = Rufus::Json.decode( json( :expressions, process.expressions ) )
164
- end
165
-
166
- it "should have the list of expressions" do
167
- @hash.should have_key('expressions')
168
- end
169
- end
170
-
171
- describe "rendering a workitem" do
172
- before(:each) do
173
- @wfid = launch_test_process do
174
- Ruote.process_definition :name => 'foo' do
175
- sequence do
176
- nada :activity => 'work your magic'
177
- end
178
- end
179
- end
180
-
181
- stub_chain( :request, :fullpath ).and_return("/_ruote/workitems/#{@wfid}/0_0_0")
182
-
183
- workitem = find_workitem( @wfid, '0_0_0' )
184
-
185
- @hash = Rufus::Json.decode( json( :workitem, workitem ) )
186
- end
187
-
188
- it "should have the workitem" do
189
- @hash.should have_key('workitem')
190
- end
191
-
192
- end
193
-
194
- describe "rendering workitems" do
195
- before(:each) do
196
- @wfid = launch_test_process do
197
- Ruote.process_definition :name => 'foo' do
198
- sequence do
199
- nada :activity => 'work your magic'
200
- end
201
- end
202
- end
203
-
204
- stub_chain( :request, :fullpath ).and_return("/_ruote/workitems")
205
-
206
- @hash = Rufus::Json.decode( json( :workitems, storage_participant.all ) )
207
- end
208
-
209
- it "should have the workitems" do
210
- @hash.should have_key('workitems')
211
- end
212
-
213
- end
214
- end
@@ -1,4 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe RuoteKit do
4
- end
@@ -1,31 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
-
4
- undef :context if defined?(context)
5
-
6
-
7
- describe "expressions.html.haml", :type => :with_engine do
8
-
9
- describe "without expressions" do
10
- it "should be helpful" do
11
- render "expressions.html.haml"
12
-
13
- response.should match(/Expressions are atomic pieces of process instances/)
14
- end
15
- end
16
-
17
- describe "with expressions" do
18
- before(:each) do
19
- @wfid = launch_test_process
20
- @process = engine.process( @wfid )
21
-
22
- assigns[:process] = @process
23
-
24
- render 'expressions.html.haml'
25
- end
26
-
27
- it "should have the process id" do
28
- response.should include(@wfid)
29
- end
30
- end
31
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "launch_process.html.haml", :type => :with_engine do
4
-
5
- it "should have a process definition field" do
6
- render 'launch_process.html.haml'
7
-
8
- response.should have_selector('textarea', :name => 'process_definition')
9
- end
10
-
11
- it "should have a workitem fields field" do
12
- render 'launch_process.html.haml'
13
-
14
- response.should have_selector('textarea', :name => 'process_fields')
15
- end
16
-
17
- it "should have a workitem variables field" do
18
- render 'launch_process.html.haml'
19
-
20
- response.should have_selector('textarea', :name => 'process_variables')
21
- end
22
- end
@@ -1,17 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "process.html.haml", :type => :with_engine do
4
-
5
- before(:each) do
6
- @wfid = launch_test_process
7
- @process = engine.process( @wfid )
8
-
9
- assigns[:process] = @process
10
-
11
- render 'process.html.haml'
12
- end
13
-
14
- it "should have the process name" do
15
- response.should include(@wfid)
16
- end
17
- end
@@ -1,16 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "process_launched.html.haml", :type => :with_engine do
4
-
5
- before(:each) do
6
- @wfid = launch_test_process
7
-
8
- assigns[:wfid] = @wfid
9
-
10
- render 'process_launched.html.haml'
11
- end
12
-
13
- it "should have the process id" do
14
- response.should include(@wfid)
15
- end
16
- end
@@ -1,31 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "processes.html.haml", :type => :with_engine do
4
-
5
- describe "without processes" do
6
- before(:each) do
7
- assigns[:processes] = []
8
-
9
- render 'processes.html.haml'
10
- end
11
-
12
- it "should give a nice notice" do
13
- response.should contain(/No processes are currently running/)
14
- end
15
- end
16
-
17
- describe "with processes" do
18
- before(:each) do
19
- @wfid = launch_test_process
20
- @process = engine.process( @wfid )
21
-
22
- assigns[:processes] = [ @process ]
23
-
24
- render 'processes.html.haml'
25
- end
26
-
27
- it "should count the processes" do
28
- response.should contain(/Currently running 1 processes/)
29
- end
30
- end
31
- end
@@ -1,69 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "workitems.html.haml", :type => :with_engine do
4
-
5
- describe "rendering no workitems" do
6
- before(:each) do
7
- assigns[:workitems] = []
8
-
9
- render 'workitems.html.haml'
10
- end
11
-
12
- it "should note so" do
13
- response.should have_selector('div.warn p', :content => "No workitems are currently available")
14
- end
15
- end
16
-
17
- describe "rendering all workitems" do
18
- before(:each) do
19
- @wfid1 = launch_test_process
20
- @wfid2 = launch_test_process
21
-
22
- assigns[:workitems] = storage_participant.all
23
-
24
- render 'workitems.html.haml'
25
- end
26
-
27
- it "should have a notice" do
28
- response.should have_selector('div.notice p', :content => "2 workitems available")
29
- end
30
-
31
- it "should show the processes" do
32
- response.should include(@wfid1)
33
- response.should include(@wfid2)
34
- end
35
- end
36
-
37
- describe "rendering process workitems" do
38
- before(:each) do
39
- @wfid = launch_test_process
40
-
41
- assigns[:wfid] = @wfid
42
- assigns[:workitems] = find_workitems( @wfid )
43
-
44
- render "workitems.html.haml"
45
- end
46
-
47
- it "should have a notice" do
48
- response.should have_selector('div.notice p', :content => "1 workitem available for #{@wfid}")
49
- end
50
-
51
- it "should show the process" do
52
- response.should include(@wfid)
53
- end
54
- end
55
-
56
- describe "rendering filtered workitems" do
57
- before(:each) do
58
- assigns[:workitems] = []
59
- end
60
-
61
- it "should show the participants used" do
62
- assigns[:participants] = ['jack']
63
-
64
- render 'workitems.html.haml'
65
-
66
- response.should have_selector('div.notice p', :content => "Filtered for participant(s): jack")
67
- end
68
- end
69
- end