ruote-kit 2.1.4

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 (73) hide show
  1. data/.document +0 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +10 -0
  4. data/README.rdoc +132 -0
  5. data/Rakefile +57 -0
  6. data/config.ru +21 -0
  7. data/lib/ruote-kit/application.rb +50 -0
  8. data/lib/ruote-kit/configuration.rb +52 -0
  9. data/lib/ruote-kit/helpers/engine_helpers.rb +24 -0
  10. data/lib/ruote-kit/helpers/form_helpers.rb +11 -0
  11. data/lib/ruote-kit/helpers/launch_item_parser.rb +59 -0
  12. data/lib/ruote-kit/helpers/navigation_helpers.rb +54 -0
  13. data/lib/ruote-kit/helpers/render_helpers.rb +103 -0
  14. data/lib/ruote-kit/helpers.rb +9 -0
  15. data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
  16. data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
  17. data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
  18. data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
  19. data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
  20. data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +191 -0
  21. data/lib/ruote-kit/public/_ruote/javascripts/fluo-can.js +1111 -0
  22. data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +149 -0
  23. data/lib/ruote-kit/public/_ruote/javascripts/fluo-json.js +183 -0
  24. data/lib/ruote-kit/public/_ruote/javascripts/fluo-tred.js +515 -0
  25. data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +226 -0
  26. data/lib/ruote-kit/public/_ruote/stylesheets/base.css +336 -0
  27. data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +30 -0
  28. data/lib/ruote-kit/public/_ruote/stylesheets/style.css +393 -0
  29. data/lib/ruote-kit/resources/expressions.rb +55 -0
  30. data/lib/ruote-kit/resources/processes.rb +52 -0
  31. data/lib/ruote-kit/resources/workitems.rb +64 -0
  32. data/lib/ruote-kit/spec/ruote_helpers.rb +47 -0
  33. data/lib/ruote-kit/vendor/sinatra-respond_to/LICENSE +21 -0
  34. data/lib/ruote-kit/vendor/sinatra-respond_to/README.markdown +102 -0
  35. data/lib/ruote-kit/vendor/sinatra-respond_to/Rakefile +30 -0
  36. data/lib/ruote-kit/vendor/sinatra-respond_to/VERSION.yml +4 -0
  37. data/lib/ruote-kit/vendor/sinatra-respond_to/lib/sinatra/respond_to.rb +206 -0
  38. data/lib/ruote-kit/vendor/sinatra-respond_to/sinatra-respond_to.gemspec +56 -0
  39. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static folder/.keep +0 -0
  40. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static.txt +1 -0
  41. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/test_app.rb +53 -0
  42. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/unreachable_static.txt +1 -0
  43. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/layout.html.haml +2 -0
  44. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.html.haml +1 -0
  45. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.js.erb +3 -0
  46. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.xml.builder +3 -0
  47. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/extension_spec.rb +403 -0
  48. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/spec_helper.rb +18 -0
  49. data/lib/ruote-kit/views/expression.html.haml +38 -0
  50. data/lib/ruote-kit/views/expressions.html.haml +30 -0
  51. data/lib/ruote-kit/views/index.html.haml +1 -0
  52. data/lib/ruote-kit/views/launch_process.html.haml +19 -0
  53. data/lib/ruote-kit/views/layout.html.haml +46 -0
  54. data/lib/ruote-kit/views/process.html.haml +55 -0
  55. data/lib/ruote-kit/views/processes.html.haml +27 -0
  56. data/lib/ruote-kit/views/resource_not_found.html.haml +7 -0
  57. data/lib/ruote-kit/views/workitem.html.haml +39 -0
  58. data/lib/ruote-kit/views/workitems.html.haml +23 -0
  59. data/lib/ruote-kit.rb +105 -0
  60. data/ruote-kit.gemspec +136 -0
  61. data/spec/helpers/render_helpers_spec.rb +211 -0
  62. data/spec/resources/expressions_spec.rb +179 -0
  63. data/spec/resources/index_spec.rb +46 -0
  64. data/spec/resources/processes_spec.rb +259 -0
  65. data/spec/resources/workitems_spec.rb +308 -0
  66. data/spec/ruote-kit_spec.rb +4 -0
  67. data/spec/spec.opts +2 -0
  68. data/spec/spec_helper.rb +152 -0
  69. data/spec/views/launch_process.html.haml_spec.rb +21 -0
  70. data/spec/views/process.html.haml_spec.rb +16 -0
  71. data/spec/views/processes.html.haml_spec.rb +30 -0
  72. data/spec/views/workitems.html.haml_spec.rb +68 -0
  73. metadata +185 -0
@@ -0,0 +1,152 @@
1
+ ENV['RACK_ENV'] = 'test'
2
+
3
+ begin
4
+ require 'spec'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ gem 'rspec'
8
+ require 'spec'
9
+ end
10
+
11
+ require 'spec/interop/test'
12
+ require 'rack/test'
13
+
14
+ require 'webrat'
15
+
16
+ Test::Unit::TestCase.send :include, Rack::Test::Methods
17
+
18
+ require File.dirname(__FILE__) + '/../vendor/gems/environment' if File.exists?( File.dirname(__FILE__) + '/../vendor/gems/environment.rb' )
19
+ require File.dirname(__FILE__) + '/../lib/ruote-kit'
20
+
21
+ RuoteKit.configure do |config|
22
+
23
+ # In memory is perfect for tests
24
+ config.mode = :transient
25
+
26
+ end
27
+
28
+ require 'ruote-kit/spec/ruote_helpers'
29
+ require 'ruote/log/test_logger'
30
+
31
+ Spec::Runner.configure do |config|
32
+ # == Mock Framework
33
+ #
34
+ # RSpec uses it's own mocking framework by default. If you prefer to
35
+ # use mocha, flexmock or RR, uncomment the appropriate line:
36
+ #
37
+ # config.mock_with :mocha
38
+ # config.mock_with :flexmock
39
+ # config.mock_with :rr
40
+
41
+ # Include our helpers
42
+ config.include Webrat::Matchers, :type => :views
43
+ config.include RuoteKit::Spec::RuoteHelpers
44
+
45
+ RuoteKit::Application.included_modules.each do |klass|
46
+ if klass.name =~ /RuoteKit::Helpers::\w+Helpers/
47
+ config.include klass
48
+ end
49
+ end
50
+
51
+ config.before(:each) do
52
+ RuoteKit.run_engine!
53
+
54
+ @tracer = Tracer.new
55
+ RuoteKit.engine.add_service( 'tracer', @tracer )
56
+
57
+ # Specs use their own worker since we need the trace
58
+ @_spec_worker = Ruote::Worker.new( RuoteKit.engine.storage )
59
+ @_spec_worker.context.add_service( 'tracer', @tracer )
60
+ @_spec_worker.run_in_thread
61
+ end
62
+
63
+ # Purge the engine after every run
64
+ config.after(:each) do
65
+ @_spec_worker.shutdown
66
+
67
+ # Seems in some rubies this block gets called multiple times
68
+ unless RuoteKit.engine.nil?
69
+ RuoteKit.engine.context.plist.lookup('.*').purge!
70
+ RuoteKit.engine.storage.purge! unless RuoteKit.engine.storage.nil?
71
+
72
+ RuoteKit.shutdown_engine( true )
73
+ end
74
+ end
75
+ end
76
+
77
+ def app
78
+ RuoteKit::Application
79
+ end
80
+
81
+ # Sets the local variables that will be accessible in the HAML
82
+ # template
83
+ def assigns
84
+ @assigns ||= { }
85
+ end
86
+
87
+ # Renders the supplied template with Haml::Engine and assigns the
88
+ # @response instance variable
89
+ def render(template_path)
90
+ template = File.read("#{app.views}/#{template_path.sub(/^\//, '')}")
91
+ engine = Haml::Engine.new(template)
92
+ @response = engine.render(self, assigns_for_template)
93
+ end
94
+
95
+ # Convenience method to access the @response instance variable set in
96
+ # the render call
97
+ def response
98
+ @response
99
+ end
100
+
101
+ # Sets the local variables that will be accessible in the HAML
102
+ # template
103
+ def assigns
104
+ @assigns ||= { }
105
+ end
106
+
107
+ # Prepends the assigns keywords with an "@" so that they will be
108
+ # instance variables when the template is rendered.
109
+ def assigns_for_template
110
+ assigns.inject({}) do |memo, kv|
111
+ memo["@#{kv[0].to_s}".to_sym] = kv[1]
112
+ memo
113
+ end
114
+ end
115
+
116
+ class Rack::MockResponse
117
+ def json_body
118
+ Rufus::Json.decode( body )
119
+ end
120
+
121
+ def json?
122
+ begin
123
+ json_body
124
+ return true
125
+ rescue
126
+ return false
127
+ end
128
+ end
129
+
130
+ def html?
131
+ !json?
132
+ end
133
+ end
134
+
135
+
136
+ class Tracer
137
+ def initialize
138
+ @trace = ''
139
+ end
140
+ def to_s
141
+ @trace.to_s.strip
142
+ end
143
+ def << s
144
+ @trace << s
145
+ end
146
+ def clear
147
+ @trace = ''
148
+ end
149
+ def puts s
150
+ @trace << "#{s}\n"
151
+ end
152
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "launch_process.html.haml" do
4
+ it "should have a process definition field" do
5
+ render 'launch_process.html.haml'
6
+
7
+ response.should have_selector('textarea', :name => 'process_definition')
8
+ end
9
+
10
+ it "should have a workitem fields field" do
11
+ render 'launch_process.html.haml'
12
+
13
+ response.should have_selector('textarea', :name => 'process_fields')
14
+ end
15
+
16
+ it "should have a workitem variables field" do
17
+ render 'launch_process.html.haml'
18
+
19
+ response.should have_selector('textarea', :name => 'process_variables')
20
+ end
21
+ end
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "process.html.haml" do
4
+ before(:each) do
5
+ @wfid = launch_test_process
6
+ @process = engine.process( @wfid )
7
+
8
+ assigns[:process] = @process
9
+
10
+ render 'process.html.haml'
11
+ end
12
+
13
+ it "should have the process name" do
14
+ response.should include(@wfid)
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "processes.html.haml" do
4
+ describe "without processes" do
5
+ before(:each) do
6
+ assigns[:processes] = []
7
+
8
+ render 'processes.html.haml'
9
+ end
10
+
11
+ it "should give a nice notice" do
12
+ response.should contain(/No processes are currently running/)
13
+ end
14
+ end
15
+
16
+ describe "with processes" do
17
+ before(:each) do
18
+ @wfid = launch_test_process
19
+ @process = engine.process( @wfid )
20
+
21
+ assigns[:processes] = [ @process ]
22
+
23
+ render 'processes.html.haml'
24
+ end
25
+
26
+ it "should count the processes" do
27
+ response.should contain(/Currently running 1 processes/)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,68 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "workitems.html.haml" do
4
+ describe "rendering no workitems" do
5
+ before(:each) do
6
+ assigns[:workitems] = []
7
+
8
+ render 'workitems.html.haml'
9
+ end
10
+
11
+ it "should note so" do
12
+ response.should have_selector('div.warn p', :content => "No workitems are currently available")
13
+ end
14
+ end
15
+
16
+ describe "rendering all workitems" do
17
+ before(:each) do
18
+ @wfid1 = launch_test_process
19
+ @wfid2 = launch_test_process
20
+
21
+ assigns[:workitems] = store_participant.all
22
+
23
+ render 'workitems.html.haml'
24
+ end
25
+
26
+ it "should have a notice" do
27
+ response.should have_selector('div.notice p', :content => "2 workitems available")
28
+ end
29
+
30
+ it "should show the processes" do
31
+ response.should include(@wfid1)
32
+ response.should include(@wfid2)
33
+ end
34
+ end
35
+
36
+ describe "rendering process workitems" do
37
+ before(:each) do
38
+ @wfid = launch_test_process
39
+
40
+ assigns[:wfid] = @wfid
41
+ assigns[:workitems] = find_workitems( @wfid )
42
+
43
+ render "workitems.html.haml"
44
+ end
45
+
46
+ it "should have a notice" do
47
+ response.should have_selector('div.notice p', :content => "1 workitem available for #{@wfid}")
48
+ end
49
+
50
+ it "should show the process" do
51
+ response.should include(@wfid)
52
+ end
53
+ end
54
+
55
+ describe "rendering filtered workitems" do
56
+ before(:each) do
57
+ assigns[:workitems] = []
58
+ end
59
+
60
+ it "should show the participants used" do
61
+ assigns[:participants] = ['jack']
62
+
63
+ render 'workitems.html.haml'
64
+
65
+ response.should have_selector('div.notice p', :content => "Filtered for participant(s): jack")
66
+ end
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,185 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruote-kit
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.4
5
+ platform: ruby
6
+ authors:
7
+ - kenneth.kalmer@gmail.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-11 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.4
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: haml
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.5
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ruote
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.1.4
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ description: ruote-kit is a RESTful Rack app for the ruote workflow engine
66
+ email: kenneth.kalmer@gmail.com
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - README.rdoc
73
+ files:
74
+ - .document
75
+ - .gitignore
76
+ - Gemfile
77
+ - README.rdoc
78
+ - Rakefile
79
+ - config.ru
80
+ - lib/ruote-kit.rb
81
+ - lib/ruote-kit/application.rb
82
+ - lib/ruote-kit/configuration.rb
83
+ - lib/ruote-kit/helpers.rb
84
+ - lib/ruote-kit/helpers/engine_helpers.rb
85
+ - lib/ruote-kit/helpers/form_helpers.rb
86
+ - lib/ruote-kit/helpers/launch_item_parser.rb
87
+ - lib/ruote-kit/helpers/navigation_helpers.rb
88
+ - lib/ruote-kit/helpers/render_helpers.rb
89
+ - lib/ruote-kit/public/_ruote/images/bg.gif
90
+ - lib/ruote-kit/public/_ruote/images/bg_button_left.gif
91
+ - lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif
92
+ - lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif
93
+ - lib/ruote-kit/public/_ruote/images/bg_button_right.gif
94
+ - lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js
95
+ - lib/ruote-kit/public/_ruote/javascripts/fluo-can.js
96
+ - lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js
97
+ - lib/ruote-kit/public/_ruote/javascripts/fluo-json.js
98
+ - lib/ruote-kit/public/_ruote/javascripts/fluo-tred.js
99
+ - lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css
100
+ - lib/ruote-kit/public/_ruote/stylesheets/base.css
101
+ - lib/ruote-kit/public/_ruote/stylesheets/rk.css
102
+ - lib/ruote-kit/public/_ruote/stylesheets/style.css
103
+ - lib/ruote-kit/resources/expressions.rb
104
+ - lib/ruote-kit/resources/processes.rb
105
+ - lib/ruote-kit/resources/workitems.rb
106
+ - lib/ruote-kit/spec/ruote_helpers.rb
107
+ - lib/ruote-kit/vendor/sinatra-respond_to/LICENSE
108
+ - lib/ruote-kit/vendor/sinatra-respond_to/README.markdown
109
+ - lib/ruote-kit/vendor/sinatra-respond_to/Rakefile
110
+ - lib/ruote-kit/vendor/sinatra-respond_to/VERSION.yml
111
+ - lib/ruote-kit/vendor/sinatra-respond_to/lib/sinatra/respond_to.rb
112
+ - lib/ruote-kit/vendor/sinatra-respond_to/sinatra-respond_to.gemspec
113
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static folder/.keep
114
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static.txt
115
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/test_app.rb
116
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/unreachable_static.txt
117
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/layout.html.haml
118
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.html.haml
119
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.js.erb
120
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.xml.builder
121
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/extension_spec.rb
122
+ - lib/ruote-kit/vendor/sinatra-respond_to/spec/spec_helper.rb
123
+ - lib/ruote-kit/views/expression.html.haml
124
+ - lib/ruote-kit/views/expressions.html.haml
125
+ - lib/ruote-kit/views/index.html.haml
126
+ - lib/ruote-kit/views/launch_process.html.haml
127
+ - lib/ruote-kit/views/layout.html.haml
128
+ - lib/ruote-kit/views/process.html.haml
129
+ - lib/ruote-kit/views/processes.html.haml
130
+ - lib/ruote-kit/views/resource_not_found.html.haml
131
+ - lib/ruote-kit/views/workitem.html.haml
132
+ - lib/ruote-kit/views/workitems.html.haml
133
+ - ruote-kit.gemspec
134
+ - spec/helpers/render_helpers_spec.rb
135
+ - spec/resources/expressions_spec.rb
136
+ - spec/resources/index_spec.rb
137
+ - spec/resources/processes_spec.rb
138
+ - spec/resources/workitems_spec.rb
139
+ - spec/ruote-kit_spec.rb
140
+ - spec/spec.opts
141
+ - spec/spec_helper.rb
142
+ - spec/views/launch_process.html.haml_spec.rb
143
+ - spec/views/process.html.haml_spec.rb
144
+ - spec/views/processes.html.haml_spec.rb
145
+ - spec/views/workitems.html.haml_spec.rb
146
+ has_rdoc: true
147
+ homepage: http://github.com/kennethkalmer/ruote-kit
148
+ licenses: []
149
+
150
+ post_install_message:
151
+ rdoc_options:
152
+ - --charset=UTF-8
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: "0"
160
+ version:
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: "0"
166
+ version:
167
+ requirements: []
168
+
169
+ rubyforge_project:
170
+ rubygems_version: 1.3.5
171
+ signing_key:
172
+ specification_version: 3
173
+ summary: ruote workflow engine, wrapped in a loving rack embrace
174
+ test_files:
175
+ - spec/helpers/render_helpers_spec.rb
176
+ - spec/resources/expressions_spec.rb
177
+ - spec/resources/index_spec.rb
178
+ - spec/resources/processes_spec.rb
179
+ - spec/resources/workitems_spec.rb
180
+ - spec/ruote-kit_spec.rb
181
+ - spec/spec_helper.rb
182
+ - spec/views/launch_process.html.haml_spec.rb
183
+ - spec/views/process.html.haml_spec.rb
184
+ - spec/views/processes.html.haml_spec.rb
185
+ - spec/views/workitems.html.haml_spec.rb