Permalink
Browse files

RuoteKit.worklist and RuoteKit.dashboard

- RuoteKit.worklist (alias to RuoteKit.store_participant)
- RuoteKit.dashboard (alias to RuoteKit.engine)
  • Loading branch information...
1 parent 4d88655 commit 9f1d32880445d210420d47c3ff5cedf16c7f0b28 @jmettraux jmettraux committed Dec 19, 2011
Showing with 64 additions and 25 deletions.
  1. +2 −0 CHANGELOG.txt
  2. +16 −16 Gemfile.lock
  3. +11 −3 lib/ruote-kit.rb
  4. +35 −6 spec/ruote-kit_configure_spec.rb
View
@@ -4,6 +4,8 @@
== ruote-kit - 2.2.1 not yet released
+- RuoteKit.worklist (alias to RuoteKit.store_participant)
+- RuoteKit.dashboard (alias to RuoteKit.engine)
- ruote-fluo adapted to FF7 (mozDrawText -> fillText)
- Error : actually showing where the error is (red pin)
- Pause/resume expression (breakpoint too)
View
@@ -1,15 +1,15 @@
GIT
remote: git://github.com/jmettraux/ruote.git
- revision: 0a3ee3a78e637a12a4fc79f717117268abab77af
+ revision: 0996f40e2e9dae61ecc3174706f876ae757e00d4
specs:
ruote (2.2.1)
- parslet (= 1.2.1)
+ parslet (= 1.2.3)
rufus-cloche (>= 1.0.1)
rufus-dollar (>= 1.0.4)
rufus-json (>= 1.0.1)
- rufus-mnemo (>= 1.1.0)
- rufus-scheduler (>= 2.0.9)
- rufus-treechecker (>= 1.0.6)
+ rufus-mnemo (>= 1.2.2)
+ rufus-scheduler (>= 2.0.13)
+ rufus-treechecker (>= 1.0.8)
sourcify (= 0.5.0)
PATH
@@ -26,11 +26,11 @@ GEM
specs:
blankslate (2.1.2.4)
diff-lcs (1.1.2)
- file-tail (1.0.5)
- spruz (>= 0.1.0)
+ file-tail (1.0.7)
+ tins (~> 0.3)
haml (3.1.2)
nokogiri (1.4.5)
- parslet (1.2.1)
+ parslet (1.2.3)
blankslate (~> 2.0)
rack (1.3.0)
rack-test (0.5.7)
@@ -43,21 +43,21 @@ GEM
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
- ruby2ruby (1.2.5)
+ ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
- ruby_parser (2.0.6)
+ ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rufus-cloche (1.0.1)
rufus-json (>= 0.2.7)
rufus-dollar (1.0.4)
rufus-json (1.0.1)
- rufus-mnemo (1.2.0)
- rufus-scheduler (2.0.9)
+ rufus-mnemo (1.2.2)
+ rufus-scheduler (2.0.14)
tzinfo (>= 0.3.23)
- rufus-treechecker (1.0.6)
+ rufus-treechecker (1.0.8)
ruby_parser (>= 2.0.5)
- sexp_processor (3.0.5)
+ sexp_processor (3.0.9)
sinatra (1.2.6)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
@@ -68,9 +68,9 @@ GEM
ruby2ruby (>= 1.2.5)
ruby_parser (>= 2.0.5)
sexp_processor (>= 3.0.5)
- spruz (0.2.7)
tilt (1.3.2)
- tzinfo (0.3.28)
+ tins (0.3.4)
+ tzinfo (0.3.31)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
View
@@ -5,7 +5,6 @@
require 'rufus-json'
require 'ruote'
-require 'ruote/part/storage_participant'
require 'ruote-kit/core_ext'
require 'ruote-kit/version'
@@ -18,6 +17,10 @@ class << self
attr_accessor :engine
+ # RuoteKit.engine or RuoteKit.dashboard, whichever you prefer.
+ #
+ alias dashboard engine
+
def env
@env ||= defined?(Rails) ? Rails.env : ENV['RACK_ENV'] || 'development'
end
@@ -28,21 +31,26 @@ def storage_participant
engine.storage_participant
end
+ # RuoteKit.storage_participant or RuoteKit.worklist
+ # (or RuoteKit.engine.storage_participant) whichever you prefer.
+ #
+ alias worklist storage_participant
+
# Given a storage, runs a worker and sets RuoteKit.engine accordingly.
#
# By default, this method won't return (it will 'join' the worker). If you
# need to go on after this call, pass false as second parameter
# (especially useful in an EventMachine setting).
#
def run_worker(storage, join=true)
- RuoteKit.engine = Ruote::Engine.new(Ruote::Worker.new(storage))
+ RuoteKit.engine = Ruote::Dashboard.new(Ruote::Worker.new(storage))
RuoteKit.engine.join if join
end
# Uses the given storage for the RuoteKit.engine (no worker running here).
#
def bind_engine(storage)
- RuoteKit.engine = Ruote::Engine.new(storage)
+ RuoteKit.engine = Ruote::Dashboard.new(storage)
end
end
end
@@ -1,3 +1,4 @@
+
require 'spec_helper'
undef :context if defined?(context)
@@ -24,7 +25,17 @@
# end
# end
- describe 'bind_engine' do
+ describe 'direct engine setting' do
+
+ # stupid illustrative spec
+
+ it 'complies' do
+ RuoteKit.engine = Ruote::Engine.new(Ruote::HashStorage.new)
+ RuoteKit.engine.should_not == nil
+ end
+ end
+
+ describe '.bind_engine' do
before(:each) do
RuoteKit.bind_engine(Ruote::HashStorage.new)
@@ -43,13 +54,31 @@
end
end
- describe 'direct engine setting' do
+ describe '.engine' do
- # stupid illustrative spec
+ it 'returns the Dashboard' do
+ RuoteKit.engine.class.should == Ruote::Dashboard
+ end
+ end
- it 'complies' do
- RuoteKit.engine = Ruote::Engine.new(Ruote::HashStorage.new)
- RuoteKit.engine.should_not == nil
+ describe '.dashboard' do
+
+ it 'returns the Dashboard' do
+ RuoteKit.dashboard.class.should == Ruote::Dashboard
+ end
+ end
+
+ describe '.storage_participant' do
+
+ it 'returns the StorageParticipant' do
+ RuoteKit.storage_participant.class.should == Ruote::StorageParticipant
+ end
+ end
+
+ describe '.worklist' do
+
+ it 'returns the StorageParticipant' do
+ RuoteKit.worklist.class.should == Ruote::StorageParticipant
end
end
end

0 comments on commit 9f1d328

Please sign in to comment.