ruote-kit 2.1.10 → 2.1.11

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.
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
metadata CHANGED
@@ -1,123 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruote-kit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 10
10
- version: 2.1.10
9
+ - 11
10
+ version: 2.1.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - kenneth.kalmer@gmail.com
14
+ - Torsten Schoenebaum
14
15
  - John Mettraux
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-07-07 00:00:00 +02:00
20
+ date: 2010-10-01 00:00:00 +02:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
- name: bundler
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 49
29
+ hash: 3
30
30
  segments:
31
31
  - 0
32
- - 9
33
- - 5
34
- version: 0.9.5
35
- type: :runtime
32
+ version: "0"
33
+ requirement: *id001
36
34
  prerelease: false
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: sinatra
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 51
46
- segments:
47
- - 0
48
- - 9
49
- - 4
50
- version: 0.9.4
51
35
  type: :runtime
52
- prerelease: false
53
- version_requirements: *id002
36
+ name: bundler
54
37
  - !ruby/object:Gem::Dependency
55
- name: sinatra-respond_to
56
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
57
39
  none: false
58
40
  requirements:
59
41
  - - ">="
60
42
  - !ruby/object:Gem::Version
61
- hash: 15
43
+ hash: 3
62
44
  segments:
63
45
  - 0
64
- - 4
65
- - 0
66
- version: 0.4.0
67
- type: :runtime
46
+ version: "0"
47
+ requirement: *id002
68
48
  prerelease: false
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: haml
72
- requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- hash: 13
78
- segments:
79
- - 2
80
- - 2
81
- - 5
82
- version: 2.2.5
83
49
  type: :runtime
84
- prerelease: false
85
- version_requirements: *id004
50
+ name: sinatra
86
51
  - !ruby/object:Gem::Dependency
87
- name: rufus-json
88
- requirement: &id005 !ruby/object:Gem::Requirement
52
+ version_requirements: &id003 !ruby/object:Gem::Requirement
89
53
  none: false
90
54
  requirements:
91
55
  - - ">="
92
56
  - !ruby/object:Gem::Version
93
- hash: 17
57
+ hash: 3
94
58
  segments:
95
59
  - 0
96
- - 2
97
- - 3
98
- version: 0.2.3
99
- type: :runtime
60
+ version: "0"
61
+ requirement: *id003
100
62
  prerelease: false
101
- version_requirements: *id005
102
- - !ruby/object:Gem::Dependency
103
- name: ruote
104
- requirement: &id006 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 31
110
- segments:
111
- - 2
112
- - 1
113
- - 10
114
- version: 2.1.10
115
63
  type: :runtime
116
- prerelease: false
117
- version_requirements: *id006
64
+ name: sinatra-respond_to
118
65
  - !ruby/object:Gem::Dependency
119
- name: rake
120
- requirement: &id007 !ruby/object:Gem::Requirement
66
+ version_requirements: &id004 !ruby/object:Gem::Requirement
121
67
  none: false
122
68
  requirements:
123
69
  - - ">="
@@ -126,12 +72,12 @@ dependencies:
126
72
  segments:
127
73
  - 0
128
74
  version: "0"
129
- type: :development
75
+ requirement: *id004
130
76
  prerelease: false
131
- version_requirements: *id007
77
+ type: :runtime
78
+ name: haml
132
79
  - !ruby/object:Gem::Dependency
133
- name: rspec
134
- requirement: &id008 !ruby/object:Gem::Requirement
80
+ version_requirements: &id005 !ruby/object:Gem::Requirement
135
81
  none: false
136
82
  requirements:
137
83
  - - ">="
@@ -140,12 +86,12 @@ dependencies:
140
86
  segments:
141
87
  - 0
142
88
  version: "0"
143
- type: :development
89
+ requirement: *id005
144
90
  prerelease: false
145
- version_requirements: *id008
91
+ type: :runtime
92
+ name: thin
146
93
  - !ruby/object:Gem::Dependency
147
- name: jeweler
148
- requirement: &id009 !ruby/object:Gem::Requirement
94
+ version_requirements: &id006 !ruby/object:Gem::Requirement
149
95
  none: false
150
96
  requirements:
151
97
  - - ">="
@@ -154,53 +100,42 @@ dependencies:
154
100
  segments:
155
101
  - 0
156
102
  version: "0"
157
- type: :development
103
+ requirement: *id006
158
104
  prerelease: false
159
- version_requirements: *id009
105
+ type: :runtime
106
+ name: yajl-ruby
160
107
  - !ruby/object:Gem::Dependency
161
- name: webrat
162
- requirement: &id010 !ruby/object:Gem::Requirement
108
+ version_requirements: &id007 !ruby/object:Gem::Requirement
163
109
  none: false
164
110
  requirements:
165
111
  - - ">="
166
112
  - !ruby/object:Gem::Version
167
- hash: 3
113
+ hash: 29
168
114
  segments:
169
115
  - 0
170
- version: "0"
171
- type: :development
116
+ - 2
117
+ - 5
118
+ version: 0.2.5
119
+ requirement: *id007
172
120
  prerelease: false
173
- version_requirements: *id010
121
+ type: :runtime
122
+ name: rufus-json
174
123
  - !ruby/object:Gem::Dependency
175
- name: test-unit
176
- requirement: &id011 !ruby/object:Gem::Requirement
124
+ version_requirements: &id008 !ruby/object:Gem::Requirement
177
125
  none: false
178
126
  requirements:
179
127
  - - ~>
180
128
  - !ruby/object:Gem::Version
181
- hash: 25
129
+ hash: 29
182
130
  segments:
183
- - 1
184
131
  - 2
185
- - 3
186
- version: 1.2.3
187
- type: :development
188
- prerelease: false
189
- version_requirements: *id011
190
- - !ruby/object:Gem::Dependency
191
- name: rack-test
192
- requirement: &id012 !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
201
- type: :development
132
+ - 1
133
+ - 11
134
+ version: 2.1.11
135
+ requirement: *id008
202
136
  prerelease: false
203
- version_requirements: *id012
137
+ type: :runtime
138
+ name: ruote
204
139
  description: ruote-kit is a RESTful Rack app for the ruote workflow engine
205
140
  email: kenneth.kalmer@gmail.com
206
141
  executables: []
@@ -208,73 +143,77 @@ executables: []
208
143
  extensions: []
209
144
 
210
145
  extra_rdoc_files:
146
+ - CHANGELOG.txt
147
+ - LICENSE.txt
211
148
  - README.rdoc
149
+ - TODO.txt
212
150
  files:
213
151
  - .document
214
152
  - .gitignore
153
+ - CHANGELOG.txt
215
154
  - Gemfile
155
+ - LICENSE.txt
216
156
  - README.rdoc
217
157
  - Rakefile
158
+ - TODO.txt
218
159
  - config.ru
219
160
  - lib/ruote-kit.rb
220
161
  - lib/ruote-kit/application.rb
221
- - lib/ruote-kit/configuration.rb
222
- - lib/ruote-kit/helpers.rb
223
- - lib/ruote-kit/helpers/engine_helpers.rb
224
- - lib/ruote-kit/helpers/form_helpers.rb
225
- - lib/ruote-kit/helpers/launch_item_parser.rb
226
- - lib/ruote-kit/helpers/navigation_helpers.rb
162
+ - lib/ruote-kit/helpers/json_helpers.rb
163
+ - lib/ruote-kit/helpers/link_helpers.rb
164
+ - lib/ruote-kit/helpers/misc_helpers.rb
165
+ - lib/ruote-kit/helpers/pagination_helpers.rb
227
166
  - lib/ruote-kit/helpers/render_helpers.rb
228
- - lib/ruote-kit/public/_ruote/images/bg.gif
229
- - lib/ruote-kit/public/_ruote/images/bg_button_left.gif
230
- - lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif
231
- - lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif
232
- - lib/ruote-kit/public/_ruote/images/bg_button_right.gif
233
- - lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js
234
- - lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js
167
+ - lib/ruote-kit/public/_ruote/images/favicon.ico
168
+ - lib/ruote-kit/public/_ruote/images/ruote.png
169
+ - lib/ruote-kit/public/_ruote/images/ruote_buttons.png
170
+ - lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js
171
+ - lib/ruote-kit/public/_ruote/javascripts/rk.js
172
+ - lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js
235
173
  - lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js
236
- - lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css
237
- - lib/ruote-kit/public/_ruote/stylesheets/base.css
174
+ - lib/ruote-kit/public/_ruote/stylesheets/reset.css
238
175
  - lib/ruote-kit/public/_ruote/stylesheets/rk.css
239
- - lib/ruote-kit/public/_ruote/stylesheets/style.css
176
+ - lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css
240
177
  - lib/ruote-kit/resources/errors.rb
241
178
  - lib/ruote-kit/resources/expressions.rb
179
+ - lib/ruote-kit/resources/participants.rb
242
180
  - lib/ruote-kit/resources/processes.rb
181
+ - lib/ruote-kit/resources/schedules.rb
243
182
  - lib/ruote-kit/resources/workitems.rb
244
183
  - lib/ruote-kit/spec/ruote_helpers.rb
245
184
  - lib/ruote-kit/version.rb
185
+ - lib/ruote-kit/views/_pagination.html.haml
186
+ - lib/ruote-kit/views/_tree_editor.html.haml
187
+ - lib/ruote-kit/views/error.html.haml
246
188
  - lib/ruote-kit/views/errors.html.haml
247
189
  - lib/ruote-kit/views/expression.html.haml
248
190
  - lib/ruote-kit/views/expressions.html.haml
191
+ - lib/ruote-kit/views/http_error.html.haml
249
192
  - lib/ruote-kit/views/index.html.haml
250
- - lib/ruote-kit/views/launch_process.html.haml
251
193
  - lib/ruote-kit/views/layout.html.haml
194
+ - lib/ruote-kit/views/participants.html.haml
252
195
  - lib/ruote-kit/views/process.html.haml
253
- - lib/ruote-kit/views/process_failed_to_launch.html.haml
254
196
  - lib/ruote-kit/views/process_launched.html.haml
255
197
  - lib/ruote-kit/views/processes.html.haml
256
- - lib/ruote-kit/views/resource_not_found.html.haml
198
+ - lib/ruote-kit/views/processes_new.html.haml
199
+ - lib/ruote-kit/views/schedules.html.haml
257
200
  - lib/ruote-kit/views/workitem.html.haml
258
201
  - lib/ruote-kit/views/workitems.html.haml
259
202
  - ruote-kit.gemspec
260
- - spec/helpers/render_helpers_spec.rb
203
+ - spec/it_has_an_engine.rb
261
204
  - spec/resources/errors_spec.rb
262
205
  - spec/resources/expressions_spec.rb
263
206
  - spec/resources/index_spec.rb
207
+ - spec/resources/participants_spec.rb
264
208
  - spec/resources/processes_spec.rb
209
+ - spec/resources/schedules_spec.rb
265
210
  - spec/resources/workitems_spec.rb
266
211
  - spec/ruote-kit_configure_spec.rb
267
- - spec/ruote-kit_spec.rb
268
212
  - spec/spec.opts
269
213
  - spec/spec_helper.rb
270
- - spec/views/expressions.html.haml_spec.rb
271
- - spec/views/launch_process.html.haml_spec.rb
272
- - spec/views/process.html.haml_spec.rb
273
- - spec/views/process_launched.html.haml_spec.rb
274
- - spec/views/processes.html.haml_spec.rb
275
- - spec/views/workitems.html.haml_spec.rb
214
+ - spec/webapp_helpers_spec.rb
276
215
  has_rdoc: true
277
- homepage: http://github.com/kennethkalmer/ruote-kit
216
+ homepage: http://github.com/tosch/ruote-kit
278
217
  licenses: []
279
218
 
280
219
  post_install_message:
@@ -308,18 +247,14 @@ signing_key:
308
247
  specification_version: 3
309
248
  summary: ruote workflow engine, wrapped in a loving rack embrace
310
249
  test_files:
311
- - spec/resources/expressions_spec.rb
312
- - spec/resources/workitems_spec.rb
250
+ - spec/webapp_helpers_spec.rb
251
+ - spec/resources/participants_spec.rb
313
252
  - spec/resources/index_spec.rb
314
253
  - spec/resources/errors_spec.rb
315
254
  - spec/resources/processes_spec.rb
316
- - spec/ruote-kit_configure_spec.rb
317
- - spec/ruote-kit_spec.rb
318
- - spec/helpers/render_helpers_spec.rb
319
- - spec/views/workitems.html.haml_spec.rb
320
- - spec/views/process_launched.html.haml_spec.rb
321
- - spec/views/launch_process.html.haml_spec.rb
322
- - spec/views/expressions.html.haml_spec.rb
323
- - spec/views/processes.html.haml_spec.rb
324
- - spec/views/process.html.haml_spec.rb
255
+ - spec/resources/workitems_spec.rb
256
+ - spec/resources/schedules_spec.rb
257
+ - spec/resources/expressions_spec.rb
258
+ - spec/it_has_an_engine.rb
325
259
  - spec/spec_helper.rb
260
+ - spec/ruote-kit_configure_spec.rb
@@ -1,83 +0,0 @@
1
- module RuoteKit
2
- # RuoteKit configuration handling
3
- class Configuration
4
-
5
- class ParticipantRegistrationProxy
6
- def self.participant(*args, &block)
7
- RuoteKit.engine.register_participant(*args, &block)
8
- end
9
-
10
- def self.catchall(*args, &block)
11
- if(args.empty? and not block_given?)
12
- require 'ruote/part/storage_participant'
13
- participant('.+', Ruote::StorageParticipant)
14
- else
15
- participant('.+', *args, &block)
16
- end
17
- end
18
- end
19
-
20
- # Working directory for the engine (if using file system persistence)
21
- attr_accessor :work_directory
22
-
23
- # Number of workers to spawn (1 by default)
24
- attr_accessor :workers
25
-
26
- # Whether to run the engine or not (defaults to true)
27
- attr_accessor :run_engine
28
-
29
- # Whether to run a single worker or not (defaults to false)
30
- attr_accessor :run_worker
31
-
32
- def initialize
33
- self.work_directory = File.join( Dir.pwd, "work_#{RuoteKit.env}" )
34
- self.run_engine = true
35
- self.run_worker = false
36
- end
37
-
38
- # Return the selected ruote-kit mode
39
- def mode
40
- @mode ||= :file_system
41
- end
42
-
43
- # Set the ruote-kit mode
44
- def mode=( mode )
45
- raise ArgumentError, "Unsupported mode (#{mode})" unless [ :transient, :file_system ].include?( mode )
46
- @mode = mode
47
- end
48
-
49
- # Sets a custom storage
50
- def set_storage( klass, *args )
51
- @storage = [ klass, args ]
52
- @mode = :custom
53
- end
54
-
55
- # Return the best suited storage class for the current mode
56
- def storage_instance
57
-
58
- if @storage
59
- klass, args = @storage
60
- return klass.new( *args )
61
- end
62
-
63
- case mode
64
- when :transient
65
- require 'ruote/storage/hash_storage'
66
- Ruote::HashStorage.new
67
- when :file_system
68
- require 'ruote/storage/fs_storage'
69
- Ruote::FsStorage.new( self.work_directory )
70
- end
71
- end
72
-
73
- def register &block
74
- @participant_registration_block = block
75
- do_participant_registration
76
- end
77
-
78
- def do_participant_registration
79
- return nil unless @participant_registration_block && RuoteKit.engine
80
- ParticipantRegistrationProxy.instance_eval(&@participant_registration_block)
81
- end
82
- end
83
- end
@@ -1,24 +0,0 @@
1
- module RuoteKit
2
- module Helpers
3
- module EngineHelpers
4
-
5
- def engine
6
- RuoteKit.engine
7
- end
8
-
9
- def storage_participant
10
- RuoteKit.storage_participant
11
- end
12
-
13
- def find_workitems( wfid )
14
- storage_participant.by_wfid( wfid )
15
- end
16
-
17
- def find_workitem( wfid, expid )
18
- find_workitems( wfid ).detect { |wi| wi.fei.expid == expid }
19
- end
20
-
21
- end
22
- end
23
- end
24
-
@@ -1,11 +0,0 @@
1
- module RuoteKit
2
- module Helpers
3
- module FormHelpers
4
-
5
- def button( text, css_class = nil )
6
- "<button type=\"submit\" class=\"#{css_class}\"><span><span>#{text}</span></span></button>"
7
- end
8
-
9
- end
10
- end
11
- end
@@ -1,59 +0,0 @@
1
- module RuoteKit
2
- module Helpers
3
- module LaunchItemParser
4
-
5
- # Extract the launch item parameters from a posted form or a JSON request body
6
- def launch_item_from_post
7
- case env["CONTENT_TYPE"]
8
-
9
- when "application/json" then
10
- data = Rufus::Json.decode( env["rack.input"].read )
11
- launch_item = {}
12
- launch_item['pdef'] = data["definition"]
13
- launch_item['fields'] = data["fields"] || {}
14
- launch_item['variables'] = data["variables"] || {}
15
- return launch_item
16
-
17
- when "application/x-www-form-urlencoded"
18
- launch_item = { 'pdef' => params[:process_definition] }
19
- fields = params[:process_fields] || ""
20
- fields = "{}" if fields.empty?
21
- launch_item['fields'] = Rufus::Json.decode( fields )
22
- vars = params[:process_variables] || ""
23
- vars = "{}" if vars.empty?
24
- launch_item['variables'] = Rufus::Json.decode( vars )
25
- return launch_item
26
-
27
- else
28
- raise "#{env['CONTENT_TYPE']} not supported as a launch mechanism yet"
29
- end
30
- end
31
-
32
- def field_updates_and_proceed_from_put
33
- options = {
34
- :fields => {},
35
- :proceed => false
36
- }
37
-
38
- case env['CONTENT_TYPE']
39
-
40
- when "application/json" then
41
- data = Rufus::Json.decode( env['rack.input'].read )
42
- options[:fields] = data['fields'] unless data['fields'].nil? || data['fields'].empty?
43
- options[:proceed] = data['_proceed'] unless data['_proceed'].nil? || data['_proceed'].empty?
44
-
45
- when "application/x-www-form-urlencoded"
46
- options[:fields] = Rufus::Json.decode( params[:fields] ) unless params['fields'].nil? || params['fields'].empty?
47
- options[:proceed] = params[:_proceed] unless params[:_proceed].nil? || params[:_proceed].empty?
48
-
49
- else
50
- raise "#{evn['CONTENT_TYPE']} is not supported for workitem fields"
51
- end
52
-
53
- return options
54
- end
55
-
56
-
57
- end
58
- end
59
- end
@@ -1,54 +0,0 @@
1
- module RuoteKit
2
- module Helpers
3
- module NavigationHelpers
4
-
5
- def navigate_to( text, path )
6
- css_classes = []
7
- css_classes << 'first' if @first.nil?
8
- @first = true
9
-
10
- css_classes << 'active' if path.split('/')[2] == request.path.split('/')[2]
11
-
12
- "<li class=\"#{css_classes.join(' ')}\"><a href=\"#{ path }\">#{text}</a></li>"
13
- end
14
-
15
- def pluralize( number, word )
16
- if number > 1
17
- word << 's'
18
- end
19
-
20
- return [ number, word ].join(' ')
21
- end
22
-
23
- def link_to( object, *args )
24
- case object
25
- when Ruote::ProcessStatus
26
- link_to_process( object )
27
- when Ruote::Workitem
28
- link_to_workitem( object )
29
- when String
30
- "<a href=\"#{args.first}\">#{object}</a>"
31
- end
32
- end
33
-
34
- def link_to_workitem( workitem )
35
- path = "/_ruote/workitems/#{workitem.fei.wfid}/#{workitem.fei.expid}"
36
-
37
- "<a href=\"#{path}\">GET #{path}</a>"
38
- end
39
-
40
- def link_to_process( status )
41
- path = "/_ruote/processes/#{status.wfid}"
42
-
43
- "<a href=\"#{path}\">GET #{path}</a>"
44
- end
45
-
46
- def link_to_expression( expression )
47
- path = "/_ruote/expressions/#{expression.fei.wfid}/#{expression.fei.expid}"
48
-
49
- "<a href=\"#{path}\">GET #{path}</a>"
50
- end
51
-
52
- end
53
- end
54
- end
@@ -1,9 +0,0 @@
1
- module RuoteKit
2
- module Helpers
3
- autoload :EngineHelpers, 'ruote-kit/helpers/engine_helpers'
4
- autoload :FormHelpers, 'ruote-kit/helpers/form_helpers'
5
- autoload :LaunchItemParser, 'ruote-kit/helpers/launch_item_parser'
6
- autoload :NavigationHelpers, 'ruote-kit/helpers/navigation_helpers'
7
- autoload :RenderHelpers, 'ruote-kit/helpers/render_helpers'
8
- end
9
- end