Sha256: 1bff8222202fa3778059b01f6b3ac67b00485e88b4b50576947a399ee03f34cd

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

# Example mongrel harness for camping apps with rv
#
# author: Evan Weaver
# url: http://blog.evanweaver.com/articles/2006/12/19/rv-a-tool-for-luxurious-camping
# license: AFL 3.0

require 'mongrel'
require 'mongrel/camping'
LOGFILE = 'mongrel.log'
PIDFILE = 'mongrel.pid'

# or whatever else you want passed in
PORT = ARGV[0].to_i
ADDR = ARGV[1]

# this is your camping app
require 'site'
app = Cheat

# custom database configuration
app::Models::Base.establish_connection :adapter => 'mysql', :user => 'root', :database => 'camping', :host => 'localhost'

app::Models::Base.logger = nil
app::Models::Base.threaded_connections = false
app.create

config = Mongrel::Configurator.new :host => ADDR, :pid_file => PIDFILE do
  listener :port => PORT do
    uri '/', :handler => Mongrel::Camping::CampingHandler.new(app)
    # use the mongrel static server in production instead of the camping controller
    uri '/static/', :handler => Mongrel::DirHandler.new("static/")
    uri '/favicon.ico', :handler => Mongrel::Error404Handler.new('')
    setup_signals
    run
    write_pid_file
    log "#{app} available at #{ADDR}:#{PORT}"
    join
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cheat-1.3.3 lib/cheat/rv_harness.rb
cheat-1.3.2 lib/cheat/rv_harness.rb
cheat-1.3.1 lib/cheat/rv_harness.rb
cheat-1.3.0 lib/cheat/rv_harness.rb