about processes and engines

it’s barley a task manager

In the comments of the previous post, Karl asked me about ruote : “how to resume execution of the workflow from a web application ?”.

Though Karl’s questions was more about receivers, I took the time to explore a sample ruote application.

Barley is a [for fun] task manager. It takes its name from the barely repeatable processes, of course, it can’t compare with the excellent Thingamy work processor.

Barley is a Sinatra web application wrapping a ruote workflow engine. Ruote can run many process instances issued from different process definitions, but barley’s processes are all instantiated from a single process definition.

The cursor expression does most of the work. It runs in sequence a ‘trace’ participant and a ‘next’ participant. Then if the field ‘next’ is set in the workitem (most likely it has been chosen by the ‘current’ participant), the cursor is rewound and the task ends up on the ‘next’ participant’s desk.

PDEF = Ruote.process_definition :name => 'barley' do
  cursor do
    participant '${f:next}'
    rewind :if => '${f:next}'

If the ‘next’ field is empty, the cursor will be over, letting the process terminate.

Barley simply lets users push tasks around. There is no explicit “delegation”, “escalation” or whatever…

For the rest, look at the barley itself, it’s all in one single file, a workflow engine, two participants and the webservice, with the haml template at the bottom.

Torsten has deployed a demo instance at (he also has a version hooked to twitter auth).

You can install it and run it locally with :

  curl -o barley.rb
  gem install sinatra haml json ruote
  ruby barley.rb

Then head to


to remove ruote and its dependencies from your gems :

  gem uninstall ruote rufus-json rufus-cloche rufus-dollar rufus-lru rufus-mnemo rufus-scheduler rufus-treechecker


Written by John Mettraux

January 29, 2010 at 8:22 am

Posted in ruby, ruote, workflow

4 Responses

Subscribe to comments with RSS.

  1. Another demo instance running as Passenger:

    Barley on Twitter:
    ( Demo at )

    Thanks for the fun!


    January 29, 2010 at 4:50 pm

  2. […] it’s barley a task manager « processi […]

  3. Thanks for providing an example of using Ruote within a web application.

    I ran into a couple of problems getting this running, so I thought I would post the solutions in case they help someone else.

    Using “curl -o barley.rb” to retrieve the source code did not work. Curl returned a “301 Moved Permanently” response. I ended up using “curl -o barley.rb” to get the source code.

    The html produced by barely.rb did not render properly in my browser (Mac Firefox). The tag in the had an embedded tag in it. I fixed this problem by removing the %style (line 187).

    Other than that, barely seemed to work as expected.

    BTW – I am using Haml 4.0.3, Sinatra 1.4.3 and Ruote

    Denis Ahearn

    June 13, 2013 at 3:48 pm

Comments are closed.

%d bloggers like this: