<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/auth.rb</filename>
    </added>
    <added>
      <filename>lib/models/auth.rb</filename>
    </added>
    <added>
      <filename>lib/password.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -2,7 +2,7 @@
 CREDITS
 =======
 
-OpenWFEru is an open source Ruby workflow / BPM engine made in Japan. Its nickname is &quot;ruote&quot; ('wheel' in Italian).
+OpenWFEru is an open source Ruby workflow / BPM engine made in Japan. Its nickname is &quot;ruote&quot; ('wheels' in Italian).
 
 ruote-rest is a RESTful wrapper around ruote and a worklist.
 
@@ -10,28 +10,18 @@ ruote-rest is a RESTful wrapper around ruote and a worklist.
 The main project team
 ---------------------
 
-John Mettraux ( project lead ( john &gt;at&lt; openwfe.org ) )
+John Mettraux ( project lead ( john &gt;at&lt; gmail.com ) )
 Kenneth Kalmer - enhanced authentication, daemonization
 
 
 Contributors
 ------------
 
+Gonzalo Suarez - enhanced authentication
+Nando Sola - enhanced authentication
 Nicholas Petrella - participant patches
 
 
-Sponsors
---------
-
-(none)
-
-
-Donators
---------
-
-(none)
-
-
 Feedback
 --------
 
@@ -49,7 +39,7 @@ The 'ru' was added by Jamandru Reynolds (http://geometron.net)
 Tools / Libraries
 -----------------
 
-- Rack http://rack.rubyforge.org/
+- Rack  http://rack.rubyforge.org/
 - Ruby on Rails  http://rubyonrails.org (active record)
 - Json  http://json.org  http://json.rubyforge.org
 </diff>
      <filename>CREDITS.txt</filename>
    </modified>
    <modified>
      <diff>@@ -129,3 +129,4 @@ Post any suggestions/corrections at the list
     http://groups.google.com/group/openwferu-users
 
 Thanks John for this great project
+</diff>
      <filename>README.newauth</filename>
    </modified>
    <modified>
      <diff>@@ -9,11 +9,9 @@ require 'rake/packagetask'
 require 'rake/testtask'
 
 
-RUOTE_REST_VERSION = '0.9.19'
-
+RUOTE_REST_VERSION = '0.9.21'
 
 RUOTE_LIB = '~/ruote/lib'
-VENDOR_LIB = 'vendor'
 
 #
 # tasks
@@ -45,10 +43,21 @@ end
 
 
 #
+# VERSION
+
+task :change_version do
+
+  version = ARGV.pop
+  `sedip &quot;s/VERSION = '.*'/VERSION = '#{version}'/&quot; Rakefile`
+  `sedip &quot;s/VERSION = '.*'/VERSION = '#{version}'/&quot; lib/ruote_rest.rb`
+  exit 0 # prevent rake from triggering other tasks
+end
+
+
+#
 # other tasks
 
-load 'tasks/ruote.rake'
-load 'tasks/mysql.rake'
+Dir.new('tasks').entries.each { |e| load(&quot;tasks/#{e}&quot;) if e.match(/\.rake$/) }
 
 
 #
@@ -79,6 +88,9 @@ Rake::PackageTask.new('ruote-rest', RUOTE_REST_VERSION) do |pkg|
   end
 end
 
+#
+# bin distribution
+#
 desc &quot;packages a 'distribution' of ruote-rest&quot;
 task :distribute do
 </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -7,57 +7,61 @@ require 'openwfe/representations'
 
 module RuoteRest
 
-configure do
+  def self.engine
+    @engine
+  end
+  def self.engine= (e)
+    @engine = e
+  end
 
-  log_dir = File.join( RUOTE_BASE_DIR, 'logs' )
-  FileUtils.mkdir log_dir unless File.exist?( log_dir )
+  configure do
 
-  ac = {}
+    log_dir = File.join( RUOTE_BASE_DIR, 'logs' )
+    FileUtils.mkdir log_dir unless File.exist?( log_dir )
 
-  ac[:engine_name] = 'ruote_rest'
+    ac = {}
 
-  ac[:work_directory] = File.join( RUOTE_BASE_DIR, &quot;work_#{$env}&quot; )
+    ac[:engine_name] = 'ruote_rest'
 
-  ac[:logger] = Logger.new &quot;#{log_dir}/ruote_#{$env}.log&quot;, 10, 1024000
-  ac[:logger].level = ($env == 'production') ? Logger::INFO : Logger::DEBUG
+    ac[:work_directory] = File.join( RUOTE_BASE_DIR, &quot;work_#{$env}&quot; )
 
-  ac[:remote_definitions_allowed] = true
-    #
-    # are [remote] process definitions pointed at via a URL allowed ?
+    ac[:logger] = Logger.new &quot;#{log_dir}/ruote_#{$env}.log&quot;, 10, 1024000
+    ac[:logger].level = ($env == 'production') ? Logger::INFO : Logger::DEBUG
 
-  ac[:definition_in_launchitem_allowed] = true
-    #
-    # are process definitions embedded in the launchitem allowed ?
-    #
-    # (this is a dangerous, you really have to trust the clients)
+    ac[:remote_definitions_allowed] = true
+      #
+      # are [remote] process definitions pointed at via a URL allowed ?
 
-  #
-  # instantiating the workflow / BPM engine
+    ac[:definition_in_launchitem_allowed] = true
+      #
+      # are process definitions embedded in the launchitem allowed ?
+      #
+      # (this is a dangerous, you really have to trust the clients)
 
-  #engine_class = OpenWFE::Engine
     #
-    # a transient, in-memory engine
+    # instantiating the workflow / BPM engine
 
-  engine_class = OpenWFE::FsPersistedEngine
-    #
-    # file system based persistence
+    #engine_class = OpenWFE::Engine
+      #
+      # a transient, in-memory engine
 
-  engine = engine_class.new(ac)
+    engine_class = OpenWFE::FsPersistedEngine
+      #
+      # file system based persistence
 
-  #engine.init_service(:s_history, OpenWFE::Extras::DbHistory)
-  engine.init_service(:s_history, OpenWFE::Extras::QueuedDbHistory)
-    #
-    # tracking history
+    engine = engine_class.new(ac)
 
-  #engine.reload; sleep 0.350
-    #
-    # let the engine reschedule/repause stuff in the expool
-    # (now done at the end of conf/participants.rb)
+    #engine.init_service(:s_history, OpenWFE::Extras::DbHistory)
+    engine.init_service(:s_history, OpenWFE::Extras::QueuedDbHistory)
+      #
+      # tracking history
 
-  class &lt;&lt; application
-    attr_reader :engine
-  end
-  application.instance_variable_set(:@engine, engine)
+    #engine.reload; sleep 0.350
+      #
+      # let the engine reschedule/repause stuff in the expool
+      # (now done at the end of conf/participants.rb)
 
+    RuoteRest.engine = engine
+  end
 end
-end
+</diff>
      <filename>conf/engine.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,31 +4,31 @@
 
 module RuoteRest
 
-configure do
+  configure do
 
-  #
-  # other participants
-
-  application.engine.register_participant :kilroy do
-    puts 'Kilroy was here'
-  end
+    #
+    # other participants
 
-  #
-  # loading active participants
+    RuoteRest.engine.register_participant :kilroy do
+      puts 'Kilroy was here'
+    end
 
-  Participants.init_all(
-    application.engine,
-    &quot;#{RUOTE_BASE_DIR}/conf/participants_#{application.environment}.yaml&quot;)
+    #
+    # loading active participants
 
-  #
-  # participants loaded, now notify engine it can reschedule
-  # time[out] oriented expressions (sleep, when, participant, ...)
+    Participants.init_all(
+      RuoteRest.engine,
+      &quot;#{RUOTE_BASE_DIR}/conf/participants_#{application.environment}.yaml&quot;)
 
-  application.engine.reload
-  sleep 0.350
     #
-    # let the engine reschedule/repause stuff in the expool
-end
+    # participants loaded, now notify engine it can reschedule
+    # time[out] oriented expressions (sleep, when, participant, ...)
+
+    RuoteRest.engine.reload
+    sleep 0.350
+      #
+      # let the engine reschedule/repause stuff in the expool
+  end
 
 end
 </diff>
      <filename>conf/participants.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,3 @@
-#
 #--
 # Copyright (c) 2008-2009, John Mettraux, OpenWFE.org
 # All rights reserved.
@@ -28,134 +27,133 @@
 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
-#++
 #
+# Made in Japan.
+#++
 
-#
-# &quot;made in Japan&quot;
-#
-# John Mettraux at openwfe.org
-#
 
+class Rufus::Sixjo::Context
 
-#
-# parses the representation sent in the request body
-#
-def rparse (type)
+  #
+  # parses the representation sent in the request body
+  #
+  def rparse (type)
 
-  representation = request.body.read
+    representation = request.body.read
 
-  format = determine_in_format
+    format = determine_in_format
 
-  send(&quot;parse_#{type}_#{format}&quot;, representation) \
-    rescue throw :done, [ 400, &quot;failed to parse incoming representation&quot; ]
-end
+    send(&quot;parse_#{type}_#{format}&quot;, representation) \
+      rescue throw :done, [ 400, &quot;failed to parse incoming representation&quot; ]
+  end
 
-#
-# the entry point for rendering any ruote-rest object
-#
-# (pronounce with a &quot;rolling r&quot;)
-#
-def rrender (type, object, options={})
+  #
+  # the entry point for rendering any ruote-rest object
+  #
+  # (pronounce with a &quot;rolling r&quot;)
+  #
+  def rrender (type, object, options={})
 
-  format, ctype = determine_out_format(options)
+    format, ctype = determine_out_format(options)
 
-  ctype = 'text/plain' if params[:plain]
-    # useful for debugging
+    ctype = 'text/plain' if params[:plain]
+      # useful for debugging
 
-  response.status = options.delete(:status) || 200
-  response.content_type = ctype
+    response.status = options.delete(:status) || 200
+    response.content_type = ctype
 
-  options.each { |k, v| response.header[k] = v }
+    options.each { |k, v| response.header[k] = v }
 
-  set_etag(object.etag) \
-    if object.respond_to?(:etag) and object.etag
-  set_last_modified(object.timestamp) \
-    if object.respond_to?(:timestamp) and object.timestamp
-      #
-      # where the conditional GET happens...
+    set_etag(object.etag) \
+      if object.respond_to?(:etag) and object.etag
+    set_last_modified(object.timestamp) \
+      if object.respond_to?(:timestamp) and object.timestamp
+        #
+        # where the conditional GET happens...
 
 
-  unless format == 'js'
+    unless format == 'js'
 
-    body = send(&quot;render_#{type}_#{format}&quot;, object)
+      body = send(&quot;render_#{type}_#{format}&quot;, object)
 
-    body = body.gsub(&quot;, &quot;, &quot;,\n &quot;) if format == 'json' and ctype == 'text/plain'
-      # a bit more readable for 'text/plain' output
+      body = body.gsub(&quot;, &quot;, &quot;,\n &quot;) if format == 'json' and ctype == 'text/plain'
+        # a bit more readable for 'text/plain' output
 
-    return body
-  end
+      return body
+    end
 
-  varname = params[:var] || 'ruote_js'
-  method = &quot;render_#{type}_json&quot;
+    varname = params[:var] || 'ruote_js'
+    method = &quot;render_#{type}_json&quot;
 
-  &quot;var #{varname} = #{send(method, object)}&quot;
-end
+    &quot;var #{varname} = #{send(method, object)}&quot;
+  end
 
-#
-# simply reads the &quot;Content-Type&quot; header
-#
-def determine_in_format
+  #
+  # simply reads the &quot;Content-Type&quot; header
+  #
+  def determine_in_format
 
-  ct = request.env['CONTENT_TYPE']
+    ct = request.env['CONTENT_TYPE']
 
-  return 'form' if ct.index('form-')
-  return 'json' if ct.index('application/json')
-  return 'yaml' if ct.index('application/yaml')
+    return 'form' if ct.index('form-')
+    return 'json' if ct.index('application/json')
+    return 'yaml' if ct.index('application/yaml')
 
-  'xml'
-end
+    'xml'
+  end
 
 
-#
-# some common formats
-#
-FORMATS = {
+  #
+  # some common formats
+  #
+  FORMATS = {
 
-  :xml =&gt; [ 'xml', 'application/xml' ],
-  :html =&gt; [ 'html', 'text/html' ],
-  :json =&gt; [ 'json', 'application/json' ],
-  :js =&gt; [ 'js', 'text/javascript' ],
-  :yaml =&gt; [ 'yaml', 'application/yaml' ],
-  :atom =&gt; [ 'atom', 'application/atom+xml' ]
+    :xml =&gt; [ 'xml', 'application/xml' ],
+    :html =&gt; [ 'html', 'text/html' ],
+    :json =&gt; [ 'json', 'application/json' ],
+    :js =&gt; [ 'js', 'text/javascript' ],
+    :yaml =&gt; [ 'yaml', 'application/yaml' ],
+    :atom =&gt; [ 'atom', 'application/atom+xml' ]
 
-} unless defined?(FORMATS)
+  } unless defined?(FORMATS)
 
-FTYPES = FORMATS.keys.collect { |k| k.to_s } \
-  unless defined?(FTYPES)
+  FTYPES = FORMATS.keys.collect { |k| k.to_s } \
+    unless defined?(FTYPES)
 
-#
-# determines the format the client is expecting
-#
-def determine_out_format (options={})
+  #
+  # determines the format the client is expecting
+  #
+  def determine_out_format (options={})
 
-  f = options[:format] || params[:format] || request.env['_FORMAT']
+    f = options[:format] || params[:format] || request.env['_FORMAT']
 
-  return FORMATS[:xml] if f == 'xml'
-  return FORMATS[:json] if f == 'json'
-  return FORMATS[:js] if f == 'js'
-  return FORMATS[:yaml] if f == 'yaml'
-  return FORMATS[:atom] if f == 'atom'
+    return FORMATS[:xml] if f == 'xml'
+    return FORMATS[:json] if f == 'json'
+    return FORMATS[:js] if f == 'js'
+    return FORMATS[:yaml] if f == 'yaml'
+    return FORMATS[:atom] if f == 'atom'
 
-  accept = request.env['HTTP_ACCEPT'] || ''
+    accept = request.env['HTTP_ACCEPT'] || ''
 
-  return FORMATS[:html] if accept.index('text/html')
-  return FORMATS[:yaml] if accept.index('yaml')
-  return FORMATS[:json] if accept.index('json')
-  return FORMATS[:js] if accept.index('js')
-  return FORMATS[:atom] if accept.index('atom')
+    return FORMATS[:html] if accept.index('text/html')
+    return FORMATS[:yaml] if accept.index('yaml')
+    return FORMATS[:json] if accept.index('json')
+    return FORMATS[:js] if accept.index('js')
+    return FORMATS[:atom] if accept.index('atom')
 
-  FORMATS[:xml]
-end
+    FORMATS[:xml]
+  end
 
-#
-# Returns true if the string is something like &quot;xxx.json&quot; or &quot;yyy.xml&quot;
-#
-def has_filetype? (s)
+  #
+  # Returns true if the string is something like &quot;xxx.json&quot; or &quot;yyy.xml&quot;
+  #
+  def has_filetype? (s)
+
+    ss = s.split('.')
+    return false if ss.length != 2
 
-  ss = s.split('.')
-  return false if ss.length != 2
+    FTYPES.include?(ss.last)
+  end
 
-  FTYPES.include?(ss.last)
 end
 </diff>
      <filename>lib/inout.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ module RuoteRest
 
   get '/errors' do
 
-    logs = application.engine.get_error_journal.get_error_logs
+    logs = RuoteRest.engine.get_error_journal.get_error_logs
 
     errors = logs.values.inject([]) { |a, log| a = a + log }
     errors = errors.sort_by { |err| err.fei.wfid }
@@ -49,7 +49,7 @@ module RuoteRest
 
     wfid = params[:wfid]
 
-    errors = application.engine.get_error_journal.get_error_log(wfid)
+    errors = RuoteRest.engine.get_error_journal.get_error_log(wfid)
 
     errors.extend(ArrayEtagMixin)
 
@@ -65,7 +65,7 @@ module RuoteRest
 
     error = find_error
 
-    application.engine.replay_at_error(error)
+    RuoteRest.engine.replay_at_error(error)
 
     'replayed'
   end
@@ -81,7 +81,7 @@ module RuoteRest
       wfid = params[:wfid]
       error_id = params[:error_id]
 
-      errors = application.engine.get_error_journal.get_error_log(wfid)
+      errors = RuoteRest.engine.get_error_journal.get_error_log(wfid)
 
       errors.find { |e| e.error_id == error_id }
     end</diff>
      <filename>lib/res/errors.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,7 @@ module RuoteRest
   get '/expressions/:wfid' do
 
     #wfid = params[:wfid]
-    #es = application.engine.process_stack wfid, true
+    #es = RuoteRest.engine.process_stack wfid, true
     #throw :done, [ 404, &quot;no process #{wfid}&quot; ] unless es
 
     ps = get_process_status
@@ -55,7 +55,7 @@ module RuoteRest
 
     e = rparse(:expression)
 
-    application.engine.update_expression e
+    RuoteRest.engine.update_expression e
 
     render_ok(e.href(request), &quot;expression at #{e.href} updated&quot;)
   end
@@ -75,7 +75,7 @@ module RuoteRest
     tree = rparse(:expression_tree)
     e = find_expression
 
-    application.engine.update_expression_tree(e, tree)
+    RuoteRest.engine.update_expression_tree(e, tree)
 
     render_ok(e.href(request), &quot;expression at #{e.href} updated&quot;)
   end
@@ -84,7 +84,7 @@ module RuoteRest
 
     e = find_expression
 
-    application.engine.cancel_expression e
+    RuoteRest.engine.cancel_expression e
 
     render_ok(
       request.href(:expressions, params[:wfid]),</diff>
      <filename>lib/res/expressions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ module RuoteRest
 
   get '/participants' do
 
-    rrender :participants, application.engine.participants
+    rrender :participants, RuoteRest.engine.participants
   end
 
   get '/participants/:pid' do
@@ -50,7 +50,7 @@ module RuoteRest
 
     Participants.add(regex, pclass, store_name)
 
-    rrender(:participants, application.engine.participants, :status =&gt; 201)
+    rrender(:participants, RuoteRest.engine.participants, :status =&gt; 201)
   end
 
   delete '/participants/:pid' do
@@ -75,7 +75,7 @@ module RuoteRest
 
         pid = Rack::Utils.unescape(pid) # no need :)
 
-        regex, part = application.engine.participants.find do |pr, pa|
+        regex, part = RuoteRest.engine.participants.find do |pr, pa|
           pr.original_string == pid
         end
 </diff>
      <filename>lib/res/participants.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,11 +48,11 @@ module RuoteRest
     lookup_options[:recursive] = true if has?(:recursive)
     lookup_options[:to_string] = true if has?(:to_string)
 
-    processes = application.engine.process_statuses
+    processes = RuoteRest.engine.process_statuses
 
     if not lookup_options.empty?
 
-      wfids = application.engine.lookup_processes(lookup_options)
+      wfids = RuoteRest.engine.lookup_processes(lookup_options)
 
       processes = processes.inject({}) do |h, (wfid, ps)|
         h[wfid] = ps if wfids.delete(wfid); h
@@ -69,7 +69,7 @@ module RuoteRest
 
     launchitem = rparse :launchitem
 
-    fei = application.engine.launch(launchitem)
+    fei = RuoteRest.engine.launch(launchitem)
 
     rrender(
       :fei, fei,
@@ -105,7 +105,7 @@ module RuoteRest
   get '/processes/:wfid/variables' do
 
     variables = if params[:wfid] == '0'
-      application.engine.get_variables
+      RuoteRest.engine.get_variables
     else
       get_process_status.variables
     end
@@ -130,9 +130,9 @@ module RuoteRest
     process = rparse :process
 
     if process[:paused]
-      application.engine.pause_process pstatus.wfid
+      RuoteRest.engine.pause_process pstatus.wfid
     else
-      application.engine.resume_process pstatus.wfid
+      RuoteRest.engine.resume_process pstatus.wfid
     end
 
     rrender :process, get_process_status
@@ -145,7 +145,7 @@ module RuoteRest
 
     wfid = params[:wfid]
 
-    application.engine.cancel_process wfid
+    RuoteRest.engine.cancel_process wfid
 
     sleep 0.350
 
@@ -162,7 +162,7 @@ module RuoteRest
 
       wfid = params[:wfid]
 
-      application.engine.process_status(wfid) ||
+      RuoteRest.engine.process_status(wfid) ||
         throw(:done, [ 404, &quot;no process '#{wfid}'&quot; ])
     end
 </diff>
      <filename>lib/res/processes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -62,7 +62,7 @@ module RuoteRest
 
       owi.fei = wi.full_fei
 
-      application.engine.reply(owi)
+      RuoteRest.engine.reply(owi)
       wi.destroy
 
       response.location = request.href(:workitems)</diff>
      <filename>lib/res/workitems.rb</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,8 @@ require 'rufus/sixjo'
 
 module RuoteRest
   extend Rufus::Sixjo
+
+  VERSION = '0.9.21'
 end
 
 </diff>
      <filename>lib/ruote_rest.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,8 @@ pid = nil
 
 opts = OptionParser.new
 
+# TODO : add option for basic auth realm
+
 opts.banner = 'Usage: ruby lib/start.rb [options]'
 opts.separator('')
 opts.separator('options:')
@@ -39,28 +41,27 @@ opts.parse!(ARGV)
 RUOTE_BASE_DIR = File.expand_path( File.dirname( File.dirname(__FILE__) ) )
 
 if daemonize
-  if RUBY_VERSION &lt; &quot;1.9&quot;
+  if RUBY_VERSION &lt; '1.9'
     exit if fork
     Process.setsid
     exit if fork
-    Dir.chdir &quot;/&quot;
+    Dir.chdir '/'
     File.umask 0000
-    STDIN.reopen &quot;/dev/null&quot;
-    STDOUT.reopen &quot;/dev/null&quot;, &quot;a&quot;
-    STDERR.reopen &quot;/dev/null&quot;, &quot;a&quot;
+    STDIN.reopen '/dev/null'
+    STDOUT.reopen '/dev/null', 'a'
+    STDERR.reopen '/dev/null', 'a'
   else
     Process.daemon
   end
 
   if pid
-    File.open(pid, 'w'){ |f| f.write(&quot;#{Process.pid}&quot;) }
+    File.open(pid, 'w'){ |f| f.write(Process.pid.to_s) }
     at_exit { File.delete(pid) if File.exist?(pid) }
   end
 end
 
 begin
 
-  #$:.unshift &quot;#{RUOTE_BASE_DIR}/vendor&quot; # if any
   if File.exist?(&quot;#{RUOTE_BASE_DIR}/vendor/frozen.rb&quot;)
     require &quot;#{RUOTE_BASE_DIR}/vendor/frozen&quot;
   elsif File.exist?(&quot;#{RUOTE_BASE_DIR}/vendorf/frozen.rb&quot;)
@@ -87,8 +88,13 @@ begin
     use Rack::CommonLogger
     use Rack::ShowExceptions
 
-    run new_sixjo_rack_app(
-      Rack::File.new(File.join(RUOTE_BASE_DIR, 'public')), :environment =&gt; $env)
+    # TODO insert whitelisting middleware
+    # TODO insert basic auth middleware
+    # unless 'test'
+
+    run RuoteRest.new_sixjo_rack_app(
+      Rack::File.new(File.join(RUOTE_BASE_DIR, 'public')),
+      :environment =&gt; $env)
   end
 
   puts &quot;.. [#{Time.now}] ruote-rest listening on port #{port}&quot;
@@ -97,7 +103,7 @@ begin
     trap(:INT) do
       puts &quot;\n.. [#{Time.now}] stopping webserver and workflow engine ...&quot;
       server.stop
-      $rr.engine.stop
+      RuoteRest.engine.stop
       sleep 1
       puts &quot;.. [#{Time.now}] stopped.&quot;
     end
@@ -109,10 +115,14 @@ rescue =&gt; e
   raise e unless daemonize
 
   # Write our backtrace
-  filename = File.join( RUOTE_BASE_DIR, &quot;backtrace-#{Time.now.strftime(&quot;%Y%m%d%H%M%S&quot;)}.log&quot; )
-  File.open( filename, 'w+' ) do |f|
+
+  filename = File.join(
+    RUOTE_BASE_DIR, &quot;backtrace-#{Time.now.strftime('%Y%m%d%H%M%S')}.log&quot;)
+
+  File.open(filename, 'w+') do |f|
     f.write(&quot;Exception caught: #{e.class}: #{e.message}&quot;)
     f.write(e.backtrace.join(&quot;\n  &quot;))
     f.write(&quot;\n\n&quot;)
   end
 end
+</diff>
      <filename>lib/start.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ end
 
 namespace :mysql do
 
-  desc &quot;Sets up a mysql database for ruote-rest&quot;
+  desc 'Sets up a mysql database for ruote-rest'
   task :setup do
 
     #
@@ -48,7 +48,6 @@ namespace :mysql do
       :encoding =&gt; 'utf8')
 
     $:.unshift RUOTE_LIB
-    $:.unshift VENDOR_LIB
 
     require 'openwfe/extras/participants/ar_participants'
     OpenWFE::Extras::ArWorkitemTables.up
@@ -56,6 +55,10 @@ namespace :mysql do
     require 'openwfe/extras/expool/db_history'
     OpenWFE::Extras::HistoryTables.up
 
+    require 'conf/auth_models.rb'
+    RuoteRest::UserTables.up
+    RuoteRest::HostTables.up
+
     #require 'vendor/openwfe/extras/expool/db_errorjournal'
     #OpenWFE::Extras::ProcessErrorTables.up
 
@@ -63,5 +66,20 @@ namespace :mysql do
     #OpenWFE::Extras::ExpressionTables.up
   end
 
+  desc 'Populates the authentication data tables'
+  task :populate do
+
+    require 'active_record/fixtures'
+
+    fixtures = ENV['fixtures'] ?
+      ENV['fixtures'].split(/,/) :
+      Dir.glob(File.join(File.dirname(__FILE__), 'fixtures', '*.yml'))
+
+    fixtures.each do |fixture_file|
+      Fixtures.create_fixtures(
+        'tasks/fixtures', File.basename(fixture_file, '.*'))
+    end
+  end
+
 end
 </diff>
      <filename>tasks/mysql.rake</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@ class StErrorsTest &lt; Test::Unit::TestCase
 
     get '/errors'
 
-    #p @response
+    #puts @response.body
 
     assert_equal(
       'application/xml',
@@ -35,7 +35,7 @@ class StErrorsTest &lt; Test::Unit::TestCase
 
   def test_1
 
-    fei = $app.engine.launch &lt;&lt;-EOS
+    fei = RuoteRest.engine.launch &lt;&lt;-EOS
 &lt;process-definition name=&quot;st_errors&quot; revision=&quot;t1&quot;&gt;
   &lt;participant ref=&quot;tonto&quot; /&gt;
 &lt;/process-definition&gt;</diff>
      <filename>test/st_errors.rb</filename>
    </modified>
    <modified>
      <diff>@@ -172,11 +172,11 @@ class StExpressionsTest &lt; Test::Unit::TestCase
       [&quot;process-definition&quot;,
        {&quot;name&quot;=&gt;&quot;TestStExpressions&quot;, &quot;revision&quot;=&gt;&quot;0&quot;},
         [[&quot;sequence&quot;, {}, [[&quot;nada&quot;, {}, []], [&quot;surfbis&quot;, {}, []]]]]],
-      $app.engine.process_status(fei.wfid).all_expressions.tree)
+      RuoteRest.engine.process_status(fei.wfid).all_expressions.tree)
 
     # over.
 
-    $app.engine.cancel_process(fei)
+    RuoteRest.engine.cancel_process(fei)
 
     sleep 0.350
   end</diff>
      <filename>test/st_expressions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ class StHistoryTest &lt; Test::Unit::TestCase
 
   def test_0
 
-    fei = $app.engine.launch &lt;&lt;-EOS
+    fei = RuoteRest.engine.launch &lt;&lt;-EOS
       class Test0 &lt; OpenWFE::ProcessDefinition
         sequence do
           alpha</diff>
      <filename>test/st_history.rb</filename>
    </modified>
    <modified>
      <diff>@@ -67,7 +67,7 @@ class StParticipantsTest &lt; Test::Unit::TestCase
 
     #p @response.status
     #puts @response.body
-    
+
     assert_equal 201, @response.status
     assert_not_equal '', @response.body
 
@@ -86,7 +86,7 @@ class StParticipantsTest &lt; Test::Unit::TestCase
 
     assert_equal(
       [ 'one', 'two', 'three' ],
-      $app.engine.get_participant_map.lookup_participant('carlito').params)
+      RuoteRest.engine.get_participant_map.lookup_participant('carlito').params)
   end
 
 end</diff>
      <filename>test/st_participants.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,32 +114,32 @@ class StProcessesTest &lt; Test::Unit::TestCase
 
   def test_process_lookup
     running_expressions = []
-    running_expressions &lt;&lt; $app.engine.launch(OpenWFE.process_definition(:name =&gt; 'one') do
+    running_expressions &lt;&lt; RuoteRest.engine.launch(OpenWFE.process_definition(:name =&gt; 'one') do
       sequence do
         _set :var =&gt; 'v', :val =&gt; 'val0'
         alpha
       end
     end)
-    running_expressions &lt;&lt; $app.engine.launch(OpenWFE.process_definition(:name =&gt; 'two') do
+    running_expressions &lt;&lt; RuoteRest.engine.launch(OpenWFE.process_definition(:name =&gt; 'two') do
       sequence do
         _set :var =&gt; 'v', :val =&gt; 'val1'
         alpha
       end
     end)
-    running_expressions &lt;&lt; $app.engine.launch(OpenWFE.process_definition(:name =&gt; 'three') do
+    running_expressions &lt;&lt; RuoteRest.engine.launch(OpenWFE.process_definition(:name =&gt; 'three') do
       sequence do
         _set :field =&gt; 'f', :val =&gt; 'val0'
         alpha
       end
     end)
-    running_expressions &lt;&lt; $app.engine.launch(OpenWFE.process_definition(:name =&gt; 'four') do
+    running_expressions &lt;&lt; RuoteRest.engine.launch(OpenWFE.process_definition(:name =&gt; 'four') do
       sequence do
         _set :field =&gt; 'nes', :val =&gt; { 'ted' =&gt; 'val0', 'tod' =&gt; 'val1' }
         alpha
       end
     end)
 
-    running_expressions &lt;&lt; $app.engine.launch(OpenWFE.process_definition(:name =&gt; 'five') do
+    running_expressions &lt;&lt; RuoteRest.engine.launch(OpenWFE.process_definition(:name =&gt; 'five') do
       sequence do
         _set :field =&gt; 'object', :val =&gt; 77
         alpha
@@ -171,7 +171,7 @@ class StProcessesTest &lt; Test::Unit::TestCase
     # over.
 
     running_expressions.each do |fei|
-      $app.engine.cancel_process(fei)
+      RuoteRest.engine.cancel_process(fei)
     end
 
     sleep 0.350
@@ -184,7 +184,7 @@ class StProcessesTest &lt; Test::Unit::TestCase
       #
       # this fixes an AR 2.2.2 issue, grumpf...
 
-    #$app.engine.register_participant :alpha, OpenWFE::HashParticipant
+    #RuoteRest.engine.register_participant :alpha, OpenWFE::HashParticipant
 
     li = OpenWFE::LaunchItem.new &lt;&lt;-EOS
       class TestStProcesses2 &lt; OpenWFE::ProcessDefinition
@@ -219,7 +219,7 @@ class StProcessesTest &lt; Test::Unit::TestCase
 
     assert_not_nil @response.body.index('&lt;paused&gt;false&lt;/paused&gt;')
 
-    $app.engine.cancel_process(fei)
+    RuoteRest.engine.cancel_process(fei)
 
     sleep 0.450
 
@@ -231,7 +231,7 @@ class StProcessesTest &lt; Test::Unit::TestCase
   #
   def test_3
 
-    #$app.engine.register_participant :alpha, OpenWFE::HashParticipant
+    #RuoteRest.engine.register_participant :alpha, OpenWFE::HashParticipant
 
     li = OpenWFE::LaunchItem.new &lt;&lt;-EOS
       class TestStProcesses3 &lt; OpenWFE::ProcessDefinition
@@ -256,7 +256,7 @@ class StProcessesTest &lt; Test::Unit::TestCase
 
   def test_cancel_process_over_json
 
-    fei = $app.engine.launch(%{
+    fei = RuoteRest.engine.launch(%{
       &lt;process-definition name=&quot;test&quot;&gt;
         &lt;alpha/&gt;
       &lt;/process-definition&gt;</diff>
      <filename>test/st_processes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,14 +19,14 @@ class StWorkitemsTest &lt; Test::Unit::TestCase
 
     #$OWFE_LOG.level = Logger::DEBUG
 
-    #$app.engine.get_participant_map.add_observer :all do |channel, args|
+    #RuoteRest.engine.get_participant_map.add_observer :all do |channel, args|
     #  p [ :pmap, channel, args.to_s ]
     #end
-    #$app.engine.get_expression_pool.add_observer :all do |channel, args|
+    #RuoteRest.engine.get_expression_pool.add_observer :all do |channel, args|
     #  p [ :expool, channel, args.to_s ]
     #end
 
-    fei = $app.engine.launch %{
+    fei = RuoteRest.engine.launch %{
       class Test0 &lt; OpenWFE::ProcessDefinition
         sequence do
           alpha
@@ -38,9 +38,9 @@ class StWorkitemsTest &lt; Test::Unit::TestCase
     sleep 0.450
     #sleep 5
 
-    #ps = $app.engine.process_status(fei)
+    #ps = RuoteRest.engine.process_status(fei)
     #p ps.errors.size
-    #p $app.engine.participants.collect { |r, p| [ r, p.class ] }
+    #p RuoteRest.engine.participants.collect { |r, p| [ r, p.class ] }
 
     assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size
 </diff>
      <filename>test/st_workitems.rb</filename>
    </modified>
    <modified>
      <diff>@@ -57,9 +57,9 @@ module TestBase
     #
     # initting the participant
 
-    $rr.engine.get_participant_map.participants.clear
+    RuoteRest.engine.get_participant_map.participants.clear
 
-    Participants.init_all($app.engine, 'conf/participants_test.yaml')
+    Participants.init_all(RuoteRest.engine, 'conf/participants_test.yaml')
   end
 
   #def teardown</diff>
      <filename>test/testbase.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@
 &lt;hr/&gt;
 
 &lt;div class=&quot;footer&quot;&gt;
+
   &lt;div class=&quot;h_left&quot; style=&quot;float: left;&quot;&gt;
     &lt;a href=&quot;/service&quot;&gt;GET /service&lt;/a&gt; | 
     &lt;a href=&quot;/processes&quot;&gt;GET /processes&lt;/a&gt; | 
@@ -26,6 +27,7 @@
     &lt;% end %&gt;
   &lt;/div&gt;
   &lt;div style=&quot;clear: both;&quot;&gt;&lt;/div&gt;
+
 &lt;/div&gt;
 
 &lt;/body&gt;</diff>
      <filename>views/footer.erb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>conf/auth.rb</filename>
    </removed>
    <removed>
      <filename>conf/auth_models.rb</filename>
    </removed>
    <removed>
      <filename>conf/authentication.yaml</filename>
    </removed>
    <removed>
      <filename>conf/password.rb</filename>
    </removed>
    <removed>
      <filename>tasks/authmodel.rake</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>1efec8b540666a051c94bc716e99f412a17700f0</id>
    </parent>
  </parents>
  <author>
    <name>John Mettraux</name>
    <email>jmettraux@gmail.com</email>
  </author>
  <url>http://github.com/jmettraux/ruote-rest/commit/941063df2ba4c57d7f7159b83a0f2085c9e13b8d</url>
  <id>941063df2ba4c57d7f7159b83a0f2085c9e13b8d</id>
  <committed-date>2009-05-11T15:35:15-07:00</committed-date>
  <authored-date>2009-04-03T03:04:10-07:00</authored-date>
  <message>restructuration done.

next steps : wire auth in + auth tests in

Signed-off-by: Kenneth Kalmer &lt;kenneth.kalmer@gmail.com&gt;</message>
  <tree>3c1295c284866a9dd8898148b25270f23110f774</tree>
  <committer>
    <name>Kenneth Kalmer</name>
    <email>kenneth.kalmer@gmail.com</email>
  </committer>
</commit>
