Created
February 26, 2011 01:43
-
-
Save juliend2/844837 to your computer and use it in GitHub Desktop.
config.ru for buggy session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler' | |
Bundler.require | |
require './src/APPNAME.rb' | |
# load the config files (this will be either ours locally or Heroku | |
dbconfig = YAML.load(File.read('config/database.yml')) | |
environment = ENV['DATABASE_URL'] ? 'production' :'development' | |
# attach to the DB and run the create method for the Blog app | |
APPNAME::Models::Base.establish_connection dbconfig[environment] | |
APPNAME.create if APPNAME.respond_to? :create | |
# loop through each folder in 'public' and mount it at '/subfolder-name', e.g. '/css' etc. | |
Dir.chdir('public') do | |
public_dirs = (Dir.glob("*").find_all{|entry| File::directory?(entry)}).collect{|dir| '/' + dir} | |
use Rack::Static, :urls => public_dirs, :root => 'public' | |
end | |
run APPNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment