<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>config.ru</filename>
    </added>
    <added>
      <filename>giftsmas_integration.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,6 @@
 #!/usr/bin/env ruby
 require 'rubygems'
+require 'erb'
 require 'sinatra/base'
 require 'cgi'
 require 'models'
@@ -10,7 +11,7 @@ PersonSplitter = /,/ unless defined?(PersonSplitter)
 
 class Sinatra::Base
   set(:appfile=&gt;'giftsmas.rb', :views=&gt;'views')
-  enable :sessions
+  enable :sessions, :static
   disable :run
 
   def h(text)
@@ -47,7 +48,7 @@ class Sinatra::Base
       redirect('/login', 303) if !session[:user_id] or !(@user = User[session[:user_id]])
       unless %w'/choose_event /add_event'.include?(request.env['REQUEST_PATH'])
         @event = Event[session[:event_id]] if session[:event_id]
-        redirect('/choose_event', 303) if !session[:event_id] or !(@event = Event[session[:event_id]])
+        redirect('/choose_event', 303) unless @event
       end
     end
   end
@@ -139,19 +140,7 @@ class GiftsmasSE &lt; Sinatra::Base
   scaffold_all_models :only=&gt;[Event, Gift, Person]
 end
 
-class FileServer
-  def initialize(app, root)
-    @app = app
-    @rfile = Rack::File.new(root)
-  end
-  def call(env)
-    res = @rfile.call(env)
-    res[0] == 200 ? res : @app.call(env)
-  end
-end
-
-app = Rack::Builder.app do
-  use FileServer, 'public'
+GiftsmasApp = Rack::Builder.app do
   map &quot;/&quot; do
     run Giftsmas
   end
@@ -159,11 +148,3 @@ app = Rack::Builder.app do
     run GiftsmasSE
   end
 end
-
-puts &quot;Starting&quot;
-Rack::Handler.get('mongrel').run(app, :Host=&gt;'0.0.0.0', :Port=&gt;3002) do |server|
-  trap(:INT) do
-    server.stop
-    puts &quot;Stopping&quot;
-  end
-end</diff>
      <filename>giftsmas.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ end
 begin
   load File.join(File.dirname(__FILE__), 'config.rb')
 rescue LoadError
-  DB = Sequel.connect(&quot;postgres:///giftsmas#{'_test' if GIFTSMAS_ENV != :production}&quot;)
+  DB = Sequel.connect(ENV['DATABASE_URL'] || &quot;postgres:///giftsmas#{'_test' if GIFTSMAS_ENV != :production}&quot;)
 end
 
 %w'user event person gift'.each{|x| require &quot;models/#{x}&quot;}</diff>
      <filename>models.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 --- 
 :port: 9571
-:adapter: giftsmas
+:adapter: giftsmas_integration
 :handler: mongrel
 :logfile: spec/style.log
 :pidfile: spec/style.pid</diff>
      <filename>spec/style.yaml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7965966f0d0232d809c4cbbe1789648e25ddfe52</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Evans</name>
    <email>code@jeremyevans.net</email>
  </author>
  <url>http://github.com/jeremyevans/giftsmas/commit/f45269c9fb967414864f87ac4cac717899bcd08b</url>
  <id>f45269c9fb967414864f87ac4cac717899bcd08b</id>
  <committed-date>2009-06-26T08:27:19-07:00</committed-date>
  <authored-date>2009-06-26T08:27:19-07:00</authored-date>
  <message>Various minor fixes

Require erb directly, since future versions of Sinatra may not
require it.

Enable :static for Sinatra, instead of using our own FileServer.

giftsmas.rb no longer runs by itself, there is now a config.ru
file to allow rackup to run it, and a giftsmas_integration.rb file
for ruby-style to run the test suite.

If a DATABASE_URL environment variable exists, use that if no
config.rb is available.  This may allow directly using giftsmas on
heroku, though I didn't test it.</message>
  <tree>79a60aca37cc842835c7e3d3ffb857c95c72a241</tree>
  <committer>
    <name>Jeremy Evans</name>
    <email>code@jeremyevans.net</email>
  </committer>
</commit>
