Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 82b82a7ba8
Charlie Somerville
executable file 39 lines (29 sloc) 0.986 kb
#!/usr/bin/env ruby
require "optparse"
require "racer"
require "rack"
options = { address: "0.0.0.0", port: 3000, rackup: "#{Dir.pwd}/config.ru" }
OptionParser.new do |opts|
opts.banner = "Usage: racer [options]"
opts.on "-a IP", "--address IP", "Address to listen on" do |a|
options[:address] = a
end
opts.on "-p PORT", "--port PORT", "Port to listen on" do |p|
options[:port] = p.to_i
end
opts.on "-e ENVIRONMENT", "--env ENVIRONMENT", "Rack environment" do |e|
options[:env] = e
end
opts.on "--rackup FILE", "Use specified file as rackup file" do |ru|
options[:rackup] = ru
end
end.parse!
ENV["RACK_ENV"] = options[:env] || ENV["RACK_ENV"] || "development"
app, rack_options = Rack::Builder.parse_file options[:rackup]
puts "Racer #{Racer::VERSION}"
puts "Listening on #{options[:address]}:#{options[:port]}"
begin
Racer.run options[:address], options[:port], app
ensure
puts "Served #{Racer::Stats.total_requests} requests."
end
Jump to Line
Something went wrong with that request. Please try again.