./lib/rack/passbook.rb in rack-passbook-0.1.0 vs ./lib/rack/passbook.rb in rack-passbook-0.1.1

- old
+ new

@@ -7,20 +7,27 @@ require 'sequel' module Rack class Passbook < Sinatra::Base - VERSION = '0.1.0' + VERSION = '0.1.1' use Rack::PostBodyContentTypeParser helpers Sinatra::Param Sequel.extension :core_extensions, :migration, :pg_hstore, :pg_hstore_ops autoload :Pass, ::File.join(::File.dirname(__FILE__), 'passbook/models/pass') autoload :Registration, ::File.join(::File.dirname(__FILE__), 'passbook/models/registration') disable :raise_errors, :show_exceptions + + configure do + if ENV['DATABASE_URL'] + DB = Sequel.connect(ENV['DATABASE_URL']) + Sequel::Migrator.run(DB, ::File.join(::File.dirname(__FILE__), "passbook/migrations"), table: 'passbook_schema_info') + end + end before do content_type :json end