<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>models/system_status.rb</filename>
    </added>
    <added>
      <filename>test/evoke_api_test.rb</filename>
    </added>
    <added>
      <filename>test/evoke_status_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,4 +5,6 @@ require 'evoke'
 
 use Rack::CommonLogger, File.new(&quot;#{File.dirname(__FILE__)}/log/#{ENV['APP_ENV']}.log&quot;, 'a+')
 
-map(&quot;/&quot;) { run Evoke }
+use Evoke::Api
+use Evoke::Status
+run Sinatra::Base</diff>
      <filename>config.ru</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ require 'yaml'
 Configuration = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
 
 LIBS = %w[rubygems logger config/database rest_client delayed_job haml sass
-  sinatra chicago sinatra/authorization]
+  sinatra/base chicago sinatra/authorization]
 LIBS.each { |lib| require lib }
 require_local_lib('../models')
 </diff>
      <filename>config/boot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,103 +1,105 @@
 require File.join(File.dirname(__FILE__), 'config', 'boot')
 
-class Evoke &lt; Sinatra::Base
-  register Sinatra::Chicago
-  helpers Sinatra::Chicago::Helpers
-  helpers Sinatra::Chicago::Responders
-  helpers Sinatra::Authorization
-
-  error do
-    $stdout.puts &quot;Sorry there was a nasty error - #{request.env['sinatra.error'].inspect}&quot;
-  end
-
-  # Resource management
-
-  not_found { throw :halt, [404, json_response('')] }
-
-  def valid_record(record, options={})
-    options = {:status =&gt; 200, :response =&gt; record}.merge(options)
-    status(options[:status])
-    json_response(options[:response])
-  end
-
-  def invalid_record(record)
-    # Need a simple logging facility
-    # $stdout.puts &quot;ERROR: record #{record.inspect} says #{record.errors.full_messages.inspect}&quot;
-    throw :halt, [422, json_response(:errors =&gt; record.errors.full_messages)]
-  end
-
-  def manage_resource(resource, options={})
-    raise Sinatra::NotFound unless resource
-    yield(resource) if block_given?
-    valid_record(resource, options)
-  rescue ActiveRecord::RecordInvalid =&gt; e
-    invalid_record(e.record)
-  end
-
-  # Actions
-
-  get &quot;/callbacks/:guid&quot; do
-    manage_resource(Callback.by_guid(params['guid']))
-  end
-
-  post &quot;/callbacks&quot; do
-    manage_resource(Callback.new(params), :status =&gt; 201) do |callback|
-      callback.save!
-      CallbackRunner.make_job_from_callback!(callback)
+module Evoke
+  class Api &lt; Sinatra::Base
+    register Sinatra::Chicago
+    helpers Sinatra::Chicago::Helpers
+    helpers Sinatra::Chicago::Responders
+
+    error do
+      $stdout.puts &quot;Sorry there was a nasty error - #{request.env['sinatra.error'].inspect}&quot;
     end
-  end
 
-  put &quot;/callbacks/:guid&quot; do
-    manage_resource(Callback.by_guid(params['guid'])) do |callback|
-      attributes = params.reject {|k,v| k == &quot;guid&quot;}
-      callback.update_attributes!(attributes)
-      CallbackRunner.replace_job_for_callback!(callback)
+    # Resource management
+
+    not_found { throw :halt, [404, json_response('')] }
+
+    def valid_record(record, options={})
+      options = {:status =&gt; 200, :response =&gt; record}.merge(options)
+      status(options[:status])
+      json_response(options[:response])
+    end
+
+    def invalid_record(record)
+      # Need a simple logging facility
+      # $stdout.puts &quot;ERROR: record #{record.inspect} says #{record.errors.full_messages.inspect}&quot;
+      throw :halt, [422, json_response(:errors =&gt; record.errors.full_messages)]
+    end
+
+    def manage_resource(resource, options={})
+      raise Sinatra::NotFound unless resource
+      yield(resource) if block_given?
+      valid_record(resource, options)
+    rescue ActiveRecord::RecordInvalid =&gt; e
+      invalid_record(e.record)
     end
-  end
 
-  delete &quot;/callbacks/:guid&quot; do
-    manage_resource(Callback.by_guid(params['guid']), :response =&gt; nil) do |callback|
-      callback.destroy
+    # Actions
+
+    get &quot;/callbacks/:guid&quot; do
+      manage_resource(Callback.by_guid(params['guid']))
     end
-    # begin
-    #   callback = Callback.by_guid(params['guid'])
-    #   raise Sinatra::NotFound unless callback
-    #   callback.destroy
-    #   status(200)
-    #   json_response(&quot;&quot;)
-    # rescue ActiveRecord::RecordInvalid =&gt; e
-    #   invalid_record(e.record)
-    # end
-  end
-
-  #
-  # Status and stuff
-
-  catch_all_css
-
-  helpers do
-    def authorize(username, password)
-      [username, password] == Configuration[&quot;authorization&quot;].values_at(&quot;username&quot;, &quot;password&quot;)
+
+    post &quot;/callbacks/&quot; do
+      manage_resource(Callback.new(params), :status =&gt; 201) do |callback|
+        callback.save!
+        CallbackRunner.make_job_from_callback!(callback)
+      end
     end
 
-    def truncate(str, n)
-      str.length &gt; n ? &quot;#{str[0..n]}...&quot; : str
+    put &quot;/callbacks/:guid&quot; do
+      manage_resource(Callback.by_guid(params['guid'])) do |callback|
+        attributes = params.reject {|k,v| k == &quot;guid&quot;}
+        callback.update_attributes!(attributes)
+        CallbackRunner.replace_job_for_callback!(callback)
+      end
     end
 
-    def verbal_status_message(callback)
-      if callback.called_back?
-        haml '.okay Already evoked callback', :layout =&gt; false
-      elsif callback.should_have_been_called_back? &amp;&amp; !callback.called_back?
-        haml '.uhoh This callback should have been evoked but has not yet', :layout =&gt; false
-      else
-        haml '.okay Just waiting for callback time', :layout =&gt; false
+    delete &quot;/callbacks/:guid&quot; do
+      manage_resource(Callback.by_guid(params['guid']), :response =&gt; nil) do |callback|
+        callback.destroy
       end
     end
-  end
+  end # Api
+
+  class Status &lt; Sinatra::Base
+    register Sinatra::Chicago
+    helpers Sinatra::Chicago::Helpers
+    helpers Sinatra::Authorization
 
-  get &quot;/status&quot; do
-    login_required
-    @status = Status.new
-    haml :status, :layout =&gt; :application
-  end
+    error do
+      $stdout.puts &quot;Sorry there was a nasty error - #{request.env['sinatra.error'].inspect}&quot;
+    end
+
+    #
+    # Status and stuff
+
+    catch_all_css
+
+    helpers do
+      def authorize(username, password)
+        [username, password] == Configuration[&quot;authorization&quot;].values_at(&quot;username&quot;, &quot;password&quot;)
+      end
+
+      def truncate(str, n)
+        str.length &gt; n ? &quot;#{str[0..n]}...&quot; : str
+      end
+
+      def verbal_status_message(callback)
+        if callback.called_back?
+          haml '.okay Already evoked callback', :layout =&gt; false
+        elsif callback.should_have_been_called_back? &amp;&amp; !callback.called_back?
+          haml '.uhoh This callback should have been evoked but has not yet', :layout =&gt; false
+        else
+          haml '.okay Just waiting for callback time', :layout =&gt; false
+        end
+      end
+    end
+
+    get &quot;/status&quot; do
+      login_required
+      @status = SystemStatus.new
+      haml :status, :layout =&gt; :application
+    end
+  end # Status
 end # Evoke</diff>
      <filename>evoke.rb</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,4 @@ class Test::Unit::TestCase
       end
     end
   end
-
-  def O(*args) OpenStruct.new(*args); end # Shortcut for OpenStruct
-
 end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>models/status.rb</filename>
    </removed>
    <removed>
      <filename>test/evoke_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>2d3e19a514b2f220cea3d75b6a2bb89bfcb34225</id>
    </parent>
  </parents>
  <author>
    <name>Justin Knowlden</name>
    <email>gus@gusg.us</email>
  </author>
  <url>http://github.com/thumblemonks/evoke/commit/6cada5776fd4507c1587830f91c6c4f1a5ddf5b4</url>
  <id>6cada5776fd4507c1587830f91c6c4f1a5ddf5b4</id>
  <committed-date>2009-10-02T15:02:03-07:00</committed-date>
  <authored-date>2009-10-02T15:02:03-07:00</authored-date>
  <message>Broke API and Status handlers into two Sinatra modules. Fun times</message>
  <tree>85a39102bd360f1be30d7d190392fc0b0e2773d6</tree>
  <committer>
    <name>Justin Knowlden</name>
    <email>gus@gusg.us</email>
  </committer>
</commit>
