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.
- data/.gitignore +2 -0
- data/CHANGELOG.txt +10 -0
- data/Gemfile +21 -5
- data/LICENSE.txt +20 -0
- data/README.rdoc +132 -80
- data/Rakefile +4 -15
- data/TODO.txt +12 -0
- data/config.ru +22 -14
- data/lib/ruote-kit/application.rb +46 -22
- data/lib/ruote-kit/helpers/json_helpers.rb +280 -0
- data/lib/ruote-kit/helpers/link_helpers.rb +117 -0
- data/lib/ruote-kit/helpers/misc_helpers.rb +35 -0
- data/lib/ruote-kit/helpers/pagination_helpers.rb +30 -0
- data/lib/ruote-kit/helpers/render_helpers.rb +39 -92
- data/lib/ruote-kit/public/_ruote/images/favicon.ico +0 -0
- data/lib/ruote-kit/public/_ruote/images/ruote.png +0 -0
- data/lib/ruote-kit/public/_ruote/images/ruote_buttons.png +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js +154 -0
- data/lib/ruote-kit/public/_ruote/javascripts/rk.js +40 -0
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js +548 -0
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js +32 -1
- data/lib/ruote-kit/public/_ruote/stylesheets/reset.css +53 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +355 -16
- data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css +108 -0
- data/lib/ruote-kit/resources/errors.rb +46 -43
- data/lib/ruote-kit/resources/expressions.rb +92 -35
- data/lib/ruote-kit/resources/participants.rb +53 -0
- data/lib/ruote-kit/resources/processes.rb +68 -36
- data/lib/ruote-kit/resources/schedules.rb +27 -0
- data/lib/ruote-kit/resources/workitems.rb +93 -31
- data/lib/ruote-kit/spec/ruote_helpers.rb +25 -16
- data/lib/ruote-kit/version.rb +3 -1
- data/lib/ruote-kit/views/_pagination.html.haml +38 -0
- data/lib/ruote-kit/views/_tree_editor.html.haml +52 -0
- data/lib/ruote-kit/views/error.html.haml +69 -0
- data/lib/ruote-kit/views/errors.html.haml +28 -12
- data/lib/ruote-kit/views/expression.html.haml +161 -30
- data/lib/ruote-kit/views/expressions.html.haml +26 -21
- data/lib/ruote-kit/views/http_error.html.haml +11 -0
- data/lib/ruote-kit/views/index.html.haml +4 -0
- data/lib/ruote-kit/views/layout.html.haml +52 -32
- data/lib/ruote-kit/views/participants.html.haml +79 -0
- data/lib/ruote-kit/views/process.html.haml +109 -42
- data/lib/ruote-kit/views/process_launched.html.haml +6 -2
- data/lib/ruote-kit/views/processes.html.haml +55 -24
- data/lib/ruote-kit/views/processes_new.html.haml +36 -0
- data/lib/ruote-kit/views/schedules.html.haml +42 -0
- data/lib/ruote-kit/views/workitem.html.haml +83 -29
- data/lib/ruote-kit/views/workitems.html.haml +42 -19
- data/lib/ruote-kit.rb +17 -88
- data/ruote-kit.gemspec +68 -80
- data/spec/it_has_an_engine.rb +69 -0
- data/spec/resources/errors_spec.rb +198 -270
- data/spec/resources/expressions_spec.rb +308 -52
- data/spec/resources/index_spec.rb +28 -16
- data/spec/resources/participants_spec.rb +102 -0
- data/spec/resources/processes_spec.rb +218 -104
- data/spec/resources/schedules_spec.rb +97 -0
- data/spec/resources/workitems_spec.rb +195 -100
- data/spec/ruote-kit_configure_spec.rb +32 -75
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +31 -92
- data/spec/webapp_helpers_spec.rb +309 -0
- metadata +87 -152
- data/lib/ruote-kit/configuration.rb +0 -83
- data/lib/ruote-kit/helpers/engine_helpers.rb +0 -24
- data/lib/ruote-kit/helpers/form_helpers.rb +0 -11
- data/lib/ruote-kit/helpers/launch_item_parser.rb +0 -59
- data/lib/ruote-kit/helpers/navigation_helpers.rb +0 -54
- data/lib/ruote-kit/helpers.rb +0 -9
- data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +0 -191
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +0 -149
- data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +0 -226
- data/lib/ruote-kit/public/_ruote/stylesheets/base.css +0 -336
- data/lib/ruote-kit/public/_ruote/stylesheets/style.css +0 -393
- data/lib/ruote-kit/views/launch_process.html.haml +0 -19
- data/lib/ruote-kit/views/process_failed_to_launch.html.haml +0 -7
- data/lib/ruote-kit/views/resource_not_found.html.haml +0 -7
- data/spec/helpers/render_helpers_spec.rb +0 -214
- data/spec/ruote-kit_spec.rb +0 -4
- data/spec/views/expressions.html.haml_spec.rb +0 -31
- data/spec/views/launch_process.html.haml_spec.rb +0 -22
- data/spec/views/process.html.haml_spec.rb +0 -17
- data/spec/views/process_launched.html.haml_spec.rb +0 -16
- data/spec/views/processes.html.haml_spec.rb +0 -31
- data/spec/views/workitems.html.haml_spec.rb +0 -69
data/.gitignore
CHANGED
data/CHANGELOG.txt
ADDED
data/Gemfile
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
|
+
|
|
1
2
|
# Dependencies for ruote-kit
|
|
3
|
+
|
|
2
4
|
source :gemcutter
|
|
3
5
|
|
|
4
6
|
# ruote-kit itself
|
|
7
|
+
|
|
5
8
|
gem 'bundler'
|
|
6
9
|
gem 'sinatra'
|
|
7
10
|
gem 'sinatra-respond_to'
|
|
8
11
|
gem 'haml'
|
|
9
12
|
|
|
13
|
+
# more servers
|
|
14
|
+
|
|
15
|
+
gem 'thin'
|
|
16
|
+
# for rackup -s thin
|
|
17
|
+
|
|
10
18
|
# json support
|
|
11
19
|
#
|
|
12
20
|
# you should choose one of the following three or add another backend supported
|
|
13
21
|
# by Rufus::Json (http://github.com/jmettraux/rufus-json/)
|
|
14
22
|
#
|
|
15
|
-
# gem 'json_pure'
|
|
16
|
-
# gem 'yajl-ruby'
|
|
17
|
-
# gem 'json'
|
|
23
|
+
# gem 'json_pure' # safest all-around choice
|
|
24
|
+
# gem 'yajl-ruby' # the fastest, but using c code
|
|
25
|
+
# gem 'json' # not bad, but using c code and sometimes broken
|
|
26
|
+
# gem 'json-jruby' # for jruby
|
|
18
27
|
#
|
|
19
28
|
# needed, uses one of the above as backend
|
|
20
|
-
|
|
29
|
+
|
|
30
|
+
gem 'yajl-ruby', :require => 'yajl'
|
|
31
|
+
gem 'rufus-json', '>= 0.2.5'
|
|
21
32
|
|
|
22
33
|
# ruote
|
|
23
|
-
|
|
34
|
+
|
|
35
|
+
gem 'ruote', '~> 2.1.11'
|
|
36
|
+
#gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git', :branch => 'ruote2.1'
|
|
37
|
+
#gem 'ruote', :path => '~/w/ruote/'
|
|
24
38
|
|
|
25
39
|
# Testing environment requirements
|
|
40
|
+
|
|
26
41
|
group :test do
|
|
27
42
|
gem 'rspec', :require => "spec"
|
|
28
43
|
gem 'rack-test'
|
|
@@ -33,3 +48,4 @@ end
|
|
|
33
48
|
group :build do
|
|
34
49
|
gem 'jeweler'
|
|
35
50
|
end
|
|
51
|
+
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009-2010 Kenneth Kalmer (Internet Exchange CC, Clear Planet Information Solutions Pty Ltd)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
= ruote-kit (RESTful ruote & middleware)
|
|
2
3
|
|
|
3
4
|
* http://kit.rubyforge.org/ruote (soon)
|
|
@@ -13,41 +14,38 @@ Follow development:
|
|
|
13
14
|
* http://opensourcery.co.za
|
|
14
15
|
* @kennethkalmer on Twitter
|
|
15
16
|
|
|
16
|
-
==
|
|
17
|
+
== Dependencies
|
|
17
18
|
|
|
18
|
-
ruote-kit
|
|
19
|
-
|
|
19
|
+
ruote-kit uses Bundler[http://gembundler.com/] to setup and maintain its
|
|
20
|
+
environment. Before running ruote-kit for the first time you need to install
|
|
21
|
+
Bundler (gem install bundler) and then run:
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
$ bundle install
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
* sinatra
|
|
25
|
-
* sinatra-respond_to
|
|
26
|
-
* haml
|
|
27
|
-
* rufus-json[http://github.com/jmettraux/rufus-json] and a compatible backend
|
|
28
|
-
* rspec (only to run the specs)
|
|
25
|
+
Bundler will download all the required gems and install them for you.
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
ruote-kit for the first time you need to install bundler and then run:
|
|
27
|
+
Have a look at the Gemfile if you want to see the various dependencies.
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
== Getting started quickly
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
bundle the gems you can simply run 'bundle lock' and all the gems will be
|
|
37
|
-
unpacked in .bundle
|
|
31
|
+
=== Using the source
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
* Get the source files using git
|
|
34
|
+
$ git clone http://github.com/kennethkalmer/ruote-kit.git && cd ruote-kit
|
|
35
|
+
* Make sure every dependency is resolved
|
|
36
|
+
$ bundle install
|
|
37
|
+
* Get going
|
|
38
|
+
$ rackup
|
|
40
39
|
|
|
41
|
-
=== Using the RubyGem
|
|
40
|
+
=== Using the RubyGem / Bundler
|
|
42
41
|
|
|
43
|
-
* Install the gem and its dependencies
|
|
44
|
-
$ gem install ruote-kit
|
|
45
42
|
* You'll need an empty directory
|
|
46
43
|
$ mkdir my-ruote-kit && cd my-ruote-kit
|
|
47
44
|
* There are two files needed in that directory: Gemfile and config.ru
|
|
48
45
|
* Gemfile
|
|
49
46
|
source :gemcutter
|
|
50
|
-
gem 'ruote
|
|
47
|
+
gem 'ruote', '~> 2.1.11'
|
|
48
|
+
gem 'ruote-kit', '~> 2.1.11'
|
|
51
49
|
* config.ru
|
|
52
50
|
begin
|
|
53
51
|
# Try to require the preresolved locked set of gems.
|
|
@@ -60,32 +58,24 @@ unpacked in .bundle
|
|
|
60
58
|
end
|
|
61
59
|
|
|
62
60
|
# load json backend
|
|
63
|
-
require 'yajl-ruby' #
|
|
61
|
+
require 'yajl-ruby' # fastest, but uses a c module
|
|
64
62
|
# require 'json_pure' # should work everywhere
|
|
65
63
|
|
|
66
64
|
require 'ruote-kit'
|
|
67
65
|
|
|
68
|
-
RuoteKit.
|
|
69
|
-
|
|
66
|
+
RuoteKit.engine = Ruote::Engine.new(
|
|
67
|
+
Ruote::Worker.new(
|
|
68
|
+
Ruote::FsStorage.new('ruote_work')))
|
|
69
|
+
|
|
70
|
+
RuoteKit.engine.register do
|
|
71
|
+
catchall
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
use Rack::CommonLogger
|
|
73
75
|
use Rack::Lint
|
|
74
76
|
|
|
75
77
|
run RuoteKit::Application
|
|
76
|
-
*
|
|
77
|
-
$ bundle check
|
|
78
|
-
* If there are missing dependencies (there shouldn't be any if the gem
|
|
79
|
-
installation succeeded)
|
|
80
|
-
$ bundle install
|
|
81
|
-
* Get going
|
|
82
|
-
$ rackup
|
|
83
|
-
|
|
84
|
-
=== Using the source
|
|
85
|
-
|
|
86
|
-
* Get the source files using git
|
|
87
|
-
$ git clone http://github.com/kennethkalmer/ruote-kit.git && cd ruote-kit
|
|
88
|
-
* Make sure every dependency is resolved
|
|
78
|
+
* Install all needed gems
|
|
89
79
|
$ bundle install
|
|
90
80
|
* Get going
|
|
91
81
|
$ rackup
|
|
@@ -104,17 +94,12 @@ rack middleware stack without issues.
|
|
|
104
94
|
|
|
105
95
|
Example:
|
|
106
96
|
|
|
107
|
-
RuoteKit.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
# register the catchall participant if needed
|
|
115
|
-
require 'ruote/part/storage_participant'
|
|
116
|
-
catchall Ruote::StorageParticipant
|
|
117
|
-
end
|
|
97
|
+
RuoteKit.engine = Ruote::Engine.new(
|
|
98
|
+
Ruote::Worker.new(
|
|
99
|
+
Ruote::FsStorage.new('ruote_work')))
|
|
100
|
+
|
|
101
|
+
RuoteKit.engine.register do
|
|
102
|
+
catchall
|
|
118
103
|
end
|
|
119
104
|
|
|
120
105
|
|
|
@@ -127,23 +112,38 @@ See http://github.com/tosch/ruote-on-rails for an example Rails app.
|
|
|
127
112
|
|
|
128
113
|
== Configuring ruote-kit & ruote
|
|
129
114
|
|
|
130
|
-
ruote-kit
|
|
131
|
-
|
|
115
|
+
ruote-kit itself needs only little configuration, the only thing to do is to
|
|
116
|
+
bind a ruote engine to use. That engine may be configured, see
|
|
117
|
+
http://ruote.rubyforge.org/configuration.html for details.
|
|
132
118
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
119
|
+
When using the source version, you'll have to edit the +config.ru+ file if you
|
|
120
|
+
want to change the engine configuration. It defaults to use file system
|
|
121
|
+
persistence and runs a
|
|
122
|
+
worker[http://ruote.rubyforge.org/configuration.html#worker] within the engine.
|
|
123
|
+
The persistence files will be stored in a sub directory called
|
|
124
|
+
"ruote_work_#{ENV}".
|
|
125
|
+
|
|
126
|
+
When using the gem version or plugging ruote-kit into your rack stack, you'll
|
|
127
|
+
have to bind the ruote engine to use yourself. See the examples above.
|
|
136
128
|
|
|
137
129
|
=== Registration of participants
|
|
138
130
|
|
|
139
|
-
ruote participants may be registered
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
ruote participants may be registered using the register method of the engine.
|
|
132
|
+
It expects a block containing of +participant+ and one or less +catchall+ calls.
|
|
133
|
+
|
|
134
|
+
require 'ruote/part/no_op_participant'
|
|
135
|
+
|
|
136
|
+
RuoteKit.engine.register do
|
|
137
|
+
participant 'no-op', Ruote::NoOpParticipant
|
|
138
|
+
catchall
|
|
139
|
+
end
|
|
143
140
|
|
|
144
141
|
Note that all +participant+ calls after a +catchall+ one are pretty useless:
|
|
145
142
|
The catchall will eat all their cookies.
|
|
146
143
|
|
|
144
|
+
If you want to learn more about ruote's participants, have a look at
|
|
145
|
+
http://ruote.rubyforge.org/participants.html .
|
|
146
|
+
|
|
147
147
|
== The +workitems+ resource
|
|
148
148
|
|
|
149
149
|
The +workitems+ resource relies on the Ruote::StorageParticipant. You'll have to
|
|
@@ -153,25 +153,65 @@ the resource. Example:
|
|
|
153
153
|
require 'ruote/part/storage_participant'
|
|
154
154
|
RuoteKit.engine.register_participant :storage, Ruote::StorageParticipant
|
|
155
155
|
|
|
156
|
-
You may also use the catchall participant provided by
|
|
156
|
+
You may also use the catchall participant provided by ruote. It's named '.+',
|
|
157
157
|
so it will catch all workitems for any participant mentioned in your workflow
|
|
158
158
|
definitions which are not already caught by another (previously) registered
|
|
159
159
|
participant. So make sure to register the catchall after your own participants.
|
|
160
160
|
The catchall participant may be registered by calling +catchall+ within the
|
|
161
|
-
block given to
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
block given to Ruote::Engine#register (this will use Ruote::StorageParticipant
|
|
162
|
+
as participant implementation, you may use any options of
|
|
163
|
+
Ruote::Engine#register_participant to overwrite that default -- see the example
|
|
164
|
+
above).
|
|
165
165
|
|
|
166
166
|
== Running workers
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
Always make sure to have a running ruote
|
|
169
|
+
worker[http://ruote.rubyforge.org/configuration.html#worker] for your storage.
|
|
170
|
+
The shipped config.ru takes care of that, but if you use the gem version or use
|
|
171
|
+
ruote-kit as part of your rack stack, you'll need to make sure there is a
|
|
172
|
+
running worker.
|
|
173
|
+
|
|
174
|
+
Perhaps it's best to give some more explanations about the architecture of ruote
|
|
175
|
+
here. Ruote's engine class is shallow, just a few methods that insert launch and
|
|
176
|
+
reply orders in the storage and read it when querying for process statuses. You
|
|
177
|
+
see: The storage is important, it is used as communications backend between the
|
|
178
|
+
various parts of ruote. The engine class and the storage are not enough, though.
|
|
179
|
+
The real work is done by one or more workers which query the storage for things
|
|
180
|
+
to do (note: it is unlikely that you will ever need more than one worker for one
|
|
181
|
+
ruote instance; ruote isn't fast, but it's faster than most human processes, so
|
|
182
|
+
that you'll won't need more than one worker unless you are running hundreds of
|
|
183
|
+
processes at the same time ).
|
|
184
|
+
|
|
185
|
+
Ruote ships with one worker implementation (you won't need more) and various
|
|
186
|
+
different storages. Have a look at
|
|
187
|
+
http://ruote.rubyforge.org/configuration.html#storage for an overview.
|
|
188
|
+
|
|
189
|
+
In the most examples above, the worker instance is bound to the engine which
|
|
190
|
+
is given to RuoteKit.engine:
|
|
191
|
+
|
|
192
|
+
RuoteKit.engine = Ruote::Engine.new(
|
|
193
|
+
Ruote::Worker.new(
|
|
194
|
+
Ruote::FsStorage.new('ruote_work')))
|
|
195
|
+
|
|
196
|
+
That is fine, especially when there is only one instance of the app running or
|
|
197
|
+
the storage implementation supports multiple workers, because if there is more
|
|
198
|
+
than one instance of the app running, there will be more than one worker
|
|
199
|
+
operating on the same storage.
|
|
200
|
+
|
|
201
|
+
If you want to use a storage implementation which doesn't support multiple
|
|
202
|
+
workers (Ruote::FsStorage under Windows, for example), you should start a
|
|
203
|
+
dedicated worker in its own instance. In config.ru (or whereever you configure
|
|
204
|
+
the engine to be used by ruote-kit), instanciate the engine without a worker:
|
|
205
|
+
|
|
206
|
+
RuoteKit.engine = Ruote::Engine.new(
|
|
207
|
+
Ruote::FsStorage.new('ruote_work'))
|
|
208
|
+
|
|
209
|
+
ruote-kit or your rack app will start with no problems, you may even launch
|
|
210
|
+
processes, but they'll never show up under /_ruote/processes: There is no worker
|
|
211
|
+
which processes the launch requests stored in the storage.
|
|
212
|
+
|
|
213
|
+
To run a worker you need to setup a worker script similar to the rake task
|
|
214
|
+
example below:
|
|
175
215
|
|
|
176
216
|
require 'rake'
|
|
177
217
|
require 'ruote-kit'
|
|
@@ -179,22 +219,22 @@ below:
|
|
|
179
219
|
desc "Run a ruote-kit worker"
|
|
180
220
|
task :ruote_kit_worker do
|
|
181
221
|
|
|
182
|
-
RuoteKit.
|
|
183
|
-
# Setup your configuration
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
RuoteKit.run_worker!
|
|
222
|
+
RuoteKit.run_worker(Ruote::FsStorage.new('ruote_work'))
|
|
187
223
|
end
|
|
188
224
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
225
|
+
Make sure to configure the storage in the same way as in the rest of the
|
|
226
|
+
application or you won't get what you expect ;-)
|
|
227
|
+
|
|
228
|
+
You also should consider using a separate worker instance when you're running
|
|
229
|
+
ruote-kit or you're rack app in an environment like Passenger: You won't be sure
|
|
230
|
+
the app runs all the time, so it's likely that scheduled events will be missed
|
|
231
|
+
(better: triggered too late). If you don't want to start a separate worker
|
|
232
|
+
process, configure Passenger in a way that your app won't be killed in a very
|
|
233
|
+
long time and make sure your storage implementation supports multiple workers.
|
|
192
234
|
|
|
193
235
|
== Feedback & bug reports
|
|
194
236
|
|
|
195
|
-
|
|
196
|
-
and suggestions limited to the google group and #ruote channel, at least for the
|
|
197
|
-
time being.
|
|
237
|
+
Feedback and bug reports are welcome on the mailing-list[http://groups.google.com/group/openwferu-users], or on the #ruote IRC channel at Freenode.net.
|
|
198
238
|
|
|
199
239
|
Please do not hesitate to come back with *any* feedback.
|
|
200
240
|
|
|
@@ -222,3 +262,15 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
222
262
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
223
263
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
224
264
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
265
|
+
|
|
266
|
+
== libraries used
|
|
267
|
+
|
|
268
|
+
- rack, http://rack.rubyforge.org/
|
|
269
|
+
- sinatra, http://www.sinatrarb.com/
|
|
270
|
+
- sinatra-respond_to, http://github.com/cehoffman/sinatra-respond_to
|
|
271
|
+
- haml, http://haml-lang.com/
|
|
272
|
+
- yajl-ruby, http://github.com/brianmario/yajl-ruby
|
|
273
|
+
- jquery, http://jquery.com/
|
|
274
|
+
|
|
275
|
+
many thanks to the authors and contributors
|
|
276
|
+
|
data/Rakefile
CHANGED
|
@@ -5,7 +5,7 @@ require "rubygems"
|
|
|
5
5
|
require "bundler"
|
|
6
6
|
Bundler.setup(:default, :test, :build)
|
|
7
7
|
|
|
8
|
-
require 'lib/ruote-kit/version'
|
|
8
|
+
require File.join(File.dirname(__FILE__), 'lib/ruote-kit/version')
|
|
9
9
|
|
|
10
10
|
begin
|
|
11
11
|
require 'jeweler'
|
|
@@ -15,25 +15,14 @@ begin
|
|
|
15
15
|
gemspec.summary = 'ruote workflow engine, wrapped in a loving rack embrace'
|
|
16
16
|
gemspec.description = 'ruote-kit is a RESTful Rack app for the ruote workflow engine'
|
|
17
17
|
gemspec.email = 'kenneth.kalmer@gmail.com'
|
|
18
|
-
gemspec.homepage = 'http://github.com/
|
|
19
|
-
gemspec.authors = ['kenneth.kalmer@gmail.com', 'John Mettraux']
|
|
18
|
+
gemspec.homepage = 'http://github.com/tosch/ruote-kit'
|
|
19
|
+
gemspec.authors = [ 'kenneth.kalmer@gmail.com', 'Torsten Schoenebaum', 'John Mettraux' ]
|
|
20
20
|
gemspec.extra_rdoc_files.include '*.txt'
|
|
21
21
|
|
|
22
22
|
gemspec.files.include 'lib/ruote-kit/public/**/*'
|
|
23
23
|
gemspec.executables.clear
|
|
24
24
|
|
|
25
|
-
gemspec.
|
|
26
|
-
gemspec.add_dependency 'sinatra', '>=0.9.4'
|
|
27
|
-
gemspec.add_dependency 'sinatra-respond_to', '>=0.4.0'
|
|
28
|
-
gemspec.add_dependency 'haml', '>= 2.2.5'
|
|
29
|
-
gemspec.add_dependency 'rufus-json', '>= 0.2.3'
|
|
30
|
-
gemspec.add_dependency 'ruote', '>= 2.1.10'
|
|
31
|
-
gemspec.add_development_dependency 'rake'
|
|
32
|
-
gemspec.add_development_dependency 'rspec'
|
|
33
|
-
gemspec.add_development_dependency 'jeweler'
|
|
34
|
-
gemspec.add_development_dependency 'webrat'
|
|
35
|
-
gemspec.add_development_dependency 'test-unit', '~> 1.2.3'
|
|
36
|
-
gemspec.add_development_dependency 'rack-test'
|
|
25
|
+
gemspec.add_bundler_dependencies
|
|
37
26
|
end
|
|
38
27
|
Jeweler::GemcutterTasks.new
|
|
39
28
|
rescue LoadError
|
data/TODO.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
[o] fix re_apply issue https://gist.github.com/e68fcb4eef2ee66b9081
|
|
3
|
+
[o] pagination for /workitems
|
|
4
|
+
[o] pagination for /processes
|
|
5
|
+
[o] pagination for /errors
|
|
6
|
+
[o] PUT /expressions fluo-editor integration
|
|
7
|
+
|
|
8
|
+
[ ] error : replay_at_error OK but reply too
|
|
9
|
+
[ ] expression : re_apply OK but reply too
|
|
10
|
+
|
|
11
|
+
[ ] If-Match etag
|
|
12
|
+
|
data/config.ru
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
# bundler
|
|
3
|
+
|
|
2
4
|
begin
|
|
3
|
-
#
|
|
5
|
+
# try to require the preresolved locked set of gems.
|
|
4
6
|
require ::File.expand_path('.bundle/environment', __FILE__)
|
|
5
7
|
rescue LoadError
|
|
6
|
-
#
|
|
8
|
+
# fall back on doing an unlocked resolve at runtime.
|
|
7
9
|
require 'rubygems'
|
|
8
10
|
require 'bundler'
|
|
9
11
|
Bundler.setup(:default)
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
# json
|
|
16
|
+
#
|
|
13
17
|
# try yajl-ruby first, and json after that
|
|
18
|
+
|
|
14
19
|
begin
|
|
15
20
|
require 'yajl'
|
|
16
21
|
rescue LoadError
|
|
@@ -24,26 +29,29 @@ end
|
|
|
24
29
|
|
|
25
30
|
require 'rufus-json'
|
|
26
31
|
|
|
27
|
-
$:.unshift 'lib'
|
|
28
32
|
|
|
33
|
+
# ruote-kit
|
|
34
|
+
|
|
35
|
+
$:.unshift 'lib'
|
|
29
36
|
require 'ruote-kit'
|
|
30
37
|
|
|
31
|
-
# Chance to configure ruote-kit
|
|
32
|
-
RuoteKit.configure do |config|
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
#config.mode = :transient
|
|
39
|
+
# ruote
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
config.run_worker = true
|
|
41
|
+
require 'ruote/storage/fs_storage'
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
RuoteKit.engine = Ruote::Engine.new(
|
|
44
|
+
Ruote::Worker.new(
|
|
45
|
+
Ruote::FsStorage.new(
|
|
46
|
+
"ruote_work_#{RuoteKit.env}")))
|
|
47
|
+
|
|
48
|
+
RuoteKit.engine.register do
|
|
49
|
+
catchall
|
|
44
50
|
end
|
|
45
51
|
|
|
46
52
|
|
|
53
|
+
# rack middlewares, business as usual...
|
|
54
|
+
|
|
47
55
|
use Rack::CommonLogger
|
|
48
56
|
use Rack::Lint
|
|
49
57
|
use Rack::ShowExceptions
|
|
@@ -1,55 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
# license is MIT, see LICENSE.txt
|
|
3
|
+
|
|
1
4
|
require 'sinatra/respond_to'
|
|
2
5
|
require 'haml'
|
|
3
6
|
|
|
4
|
-
Sinatra::Application.register Sinatra::RespondTo
|
|
5
|
-
|
|
6
7
|
module RuoteKit
|
|
7
8
|
class Application < Sinatra::Application
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
register Sinatra::RespondTo
|
|
11
|
+
|
|
12
|
+
# delay these a bit
|
|
13
|
+
|
|
10
14
|
configure do
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
# we want to support Rails
|
|
17
|
+
|
|
18
|
+
if defined?(Rails)
|
|
13
19
|
set :environment, Rails.env
|
|
14
20
|
disable :raise_errors unless Rails.env == 'development'
|
|
15
21
|
end
|
|
16
|
-
|
|
17
|
-
RuoteKit.ensure_engine!
|
|
18
22
|
end
|
|
19
23
|
|
|
20
|
-
set :
|
|
24
|
+
set :limit, 100
|
|
25
|
+
|
|
26
|
+
set :views, File.join(File.dirname(__FILE__), 'views')
|
|
21
27
|
|
|
22
|
-
use
|
|
23
|
-
|
|
28
|
+
use(
|
|
29
|
+
Rack::Static,
|
|
30
|
+
:urls => %w[ /_ruote/images /_ruote/javascripts /_ruote/stylesheets ],
|
|
31
|
+
:root => File.join(File.dirname(__FILE__), 'public'))
|
|
32
|
+
use(
|
|
33
|
+
Rack::MethodOverride)
|
|
34
|
+
|
|
35
|
+
Dir[File.join(File.dirname(__FILE__), 'helpers/*.rb')].each { |r| load r }
|
|
24
36
|
|
|
25
37
|
helpers do
|
|
26
|
-
include RuoteKit::Helpers::
|
|
27
|
-
include RuoteKit::Helpers::
|
|
28
|
-
include RuoteKit::Helpers::
|
|
29
|
-
include RuoteKit::Helpers::NavigationHelpers
|
|
38
|
+
include RuoteKit::Helpers::LinkHelpers
|
|
39
|
+
include RuoteKit::Helpers::JsonHelpers
|
|
40
|
+
include RuoteKit::Helpers::MiscHelpers
|
|
30
41
|
include RuoteKit::Helpers::RenderHelpers
|
|
42
|
+
include RuoteKit::Helpers::PaginationHelpers
|
|
31
43
|
end
|
|
32
44
|
|
|
33
45
|
before do
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
|
|
47
|
+
# we allow the Accept header to be set to 'application/json'
|
|
48
|
+
|
|
49
|
+
if env['HTTP_ACCEPT'] && env['HTTP_ACCEPT'] == 'application/json'
|
|
50
|
+
format :json
|
|
51
|
+
end
|
|
36
52
|
end
|
|
37
53
|
|
|
38
|
-
unless defined?(
|
|
39
|
-
|
|
54
|
+
unless defined?(Rails)
|
|
55
|
+
|
|
56
|
+
# handle 404s ourselves when not in Rails
|
|
57
|
+
|
|
40
58
|
not_found do
|
|
41
|
-
|
|
59
|
+
http_error(404)
|
|
42
60
|
end
|
|
43
61
|
end
|
|
44
62
|
|
|
45
63
|
get '/_ruote/?' do
|
|
64
|
+
|
|
46
65
|
respond_to do |format|
|
|
47
|
-
|
|
48
|
-
format.
|
|
66
|
+
|
|
67
|
+
format.html do
|
|
68
|
+
haml :index
|
|
69
|
+
end
|
|
70
|
+
format.json do
|
|
71
|
+
json :misc, 'ruote-kit' => 'welcome', 'version' => RuoteKit::VERSION
|
|
72
|
+
end
|
|
49
73
|
end
|
|
50
74
|
end
|
|
51
75
|
|
|
52
|
-
Dir[
|
|
76
|
+
Dir[File.join(File.dirname(__FILE__), 'resources/*.rb')].each { |r| load r }
|
|
53
77
|
end
|
|
54
78
|
end
|
|
55
79
|
|