Sha256: d7c6196c6cf705aa3cff332816c99ddff4a385ef88a669ea3d27eb7a9979cffe
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
#!/usr/local/bin/ruby require File.join(File.dirname(__FILE__), '..', 'lib', 'gems') require File.expand_path(File.join(File.dirname(__FILE__), "env_handler.rb")) require File.expand_path(File.join(File.dirname(__FILE__), "gem_load_path.rb")) require 'rubygems' require 'fileutils' require 'mack' handler = nil if ARGV.include?("-h") handler = ARGV[ARGV.index("-h") + 1] ARGV.delete("-h") ARGV.delete(handler) end unless handler begin require 'thin' handler = 'thin' rescue Exception => e # puts e.message # puts e.backtrace begin require 'mongrel' handler = 'mongrel' rescue Exception => e handler = 'WEBrick' end end end if handler == "thin" # thin_opts = ["start", ARGV] thin_opts = [] if ARGV[0] == "start" || ARGV[0] == "stop" || ARGV[0] == "restart" thin_opts << ARGV[0] ARGV.shift else thin_opts << "start" end thin_opts << ARGV Thin::Runner.new(thin_opts.flatten.reject{|a| a.match(/^_[\d\.]+_$/)}).run! else require 'logger' port = 3000 if ARGV.include?("-p") port = ARGV[ARGV.index("-p") + 1] end module Mack # Even though it's called, SimpleServer, this might be the only server you need to run # a Mack application. # # This SimpleServer does not use Thin. But does work with anything that Rack has a handler for. class SimpleServer class << self def run(options) r = "Rack::Handler::#{options[:handler].camelcase}" puts "Starting app using: #{r} in #{options[:environment]} mode on port: #{options[:port]}" eval(r).run(Mack::Utils::Server.build_app, :Port => options[:port], :Logger => ::Logger.new(StringIO.new), :AccessLog => []) end end end end Mack::SimpleServer.run(:handler => handler, :port => port, :environment => ENV['MACK_ENV']) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mack-0.8.3 | bin/mackery-server |
mack-0.8.3.1 | bin/mackery-server |