Permalink
Browse files

Name change: Mongrel => Puma

  • Loading branch information...
evanphx committed Sep 23, 2011
1 parent ec2d820 commit 190a81c55a1cbf215658b8fd6bb7ce2a0326b6c6
View
@@ -5,14 +5,14 @@ Manifest.txt
README.txt
Rakefile
TODO
bin/mongrel_rails
bin/puma_rails
examples/builder.rb
examples/camping/README
examples/camping/blog.rb
examples/camping/tepee.rb
examples/httpd.conf
examples/mime.yaml
examples/mongrel.conf
examples/puma.conf
examples/monitrc
examples/random_thrash.rb
examples/simpletest.rb
@@ -26,32 +26,32 @@ ext/http11/http11_parser.java.rl
ext/http11/http11_parser.rl
ext/http11/http11_parser_common.rl
ext/http11/Http11Service.java
ext/http11/org/jruby/mongrel/Http11.java
ext/http11/org/jruby/mongrel/Http11Parser.java
lib/mongrel.rb
lib/mongrel/camping.rb
lib/mongrel/cgi.rb
lib/mongrel/command.rb
lib/mongrel/configurator.rb
lib/mongrel/const.rb
lib/mongrel/debug.rb
lib/mongrel/gems.rb
lib/mongrel/handlers.rb
lib/mongrel/header_out.rb
lib/mongrel/http_request.rb
lib/mongrel/http_response.rb
lib/mongrel/init.rb
lib/mongrel/mime_types.yml
lib/mongrel/rails.rb
lib/mongrel/stats.rb
lib/mongrel/tcphack.rb
lib/mongrel/uri_classifier.rb
ext/http11/org/jruby/puma/Http11.java
ext/http11/org/jruby/puma/Http11Parser.java
lib/puma.rb
lib/puma/camping.rb
lib/puma/cgi.rb
lib/puma/command.rb
lib/puma/configurator.rb
lib/puma/const.rb
lib/puma/debug.rb
lib/puma/gems.rb
lib/puma/handlers.rb
lib/puma/header_out.rb
lib/puma/http_request.rb
lib/puma/http_response.rb
lib/puma/init.rb
lib/puma/mime_types.yml
lib/puma/rails.rb
lib/puma/stats.rb
lib/puma/tcphack.rb
lib/puma/uri_classifier.rb
setup.rb
tasks/gem.rake
tasks/native.rake
tasks/ragel.rake
test/mime.yaml
test/mongrel.conf
test/puma.conf
test/test_cgi_wrapper.rb
test/test_command.rb
test/test_conditional.rb
View
@@ -3,33 +3,33 @@
# Copyright (c) 2005 Zed A. Shaw
# You can redistribute it and/or modify it under the same terms as Ruby.
#
# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
# Additional work donated by contributors. See http://puma.rubyforge.org/attributions.html
# for more information.
require 'yaml'
require 'etc'
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'mongrel'
require 'mongrel/rails'
require 'puma'
require 'puma/rails'
Mongrel::Gems.require 'gem_plugin'
Puma::Gems.require 'gem_plugin'
# require 'ruby-debug'
# Debugger.start
module Mongrel
module Puma
class Start < GemPlugin::Plugin "/commands"
include Mongrel::Command::Base
include Puma::Command::Base
def configure
options [
["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
["-d", "--daemonize", "Run daemonized in the background", :@daemon, false],
['-p', '--port PORT', "Which port to bind to", :@port, 3000],
['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
['-l', '--log FILE', "Where to write log messages", :@log_file, "log/puma.log"],
['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/puma.pid"],
['-n', '--num-processors INT', "Number of processors active before clients denied", :@num_processors, 1024],
['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, 60],
['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, 0],
@@ -79,15 +79,15 @@ module Mongrel
@generate = File.expand_path(@generate)
STDERR.puts "** Writing config to \"#@generate\"."
open(@generate, "w") {|f| f.write(settings.to_yaml) }
STDERR.puts "** Finished. Run \"mongrel_rails start -C #@generate\" to use the config file."
STDERR.puts "** Finished. Run \"puma_rails start -C #@generate\" to use the config file."
exit 0
end
config = Mongrel::Rails::RailsConfigurator.new(settings) do
config = Puma::Rails::RailsConfigurator.new(settings) do
if defaults[:daemon]
if File.exist? defaults[:pid_file]
log "!!! PID file #{defaults[:pid_file]} already exists. Mongrel could be running already. Check your #{defaults[:log_file]} for errors."
log "!!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start."
log "!!! PID file #{defaults[:pid_file]} already exists. Puma could be running already. Check your #{defaults[:log_file]} for errors."
log "!!! Exiting with error. You must stop puma and clear the .pid before I'll attempt a start."
exit 1
end
@@ -97,7 +97,7 @@ module Mongrel
log "Settings loaded from #{@config_file} (they override command line)." if @config_file
end
log "Starting Mongrel listening at #{defaults[:host]}:#{defaults[:port]}"
log "Starting Puma listening at #{defaults[:host]}:#{defaults[:port]}"
listener do
mime = {}
@@ -107,7 +107,7 @@ module Mongrel
end
if defaults[:debug]
log "Installing debugging prefixed filters. Look in log/mongrel_debug for the files."
log "Installing debugging prefixed filters. Look in log/puma_debug for the files."
debug "/"
end
@@ -129,7 +129,7 @@ module Mongrel
end
config.run
config.log "Mongrel #{Mongrel::Const::MONGREL_VERSION} available at #{@address}:#{@port}"
config.log "Puma #{Puma::Const::PUMA_VERSION} available at #{@address}:#{@port}"
unless config.defaults[:daemon]
config.log "Use CTRL-C to stop."
@@ -164,7 +164,7 @@ module Mongrel
STDERR.puts "** Loading settings from #{@config_file} (they override command line)." unless @daemon || settings[:daemon]
end
settings[:includes] ||= ["mongrel"]
settings[:includes] ||= ["puma"]
# Config file settings will override command line settings
settings.each do |key, value|
@@ -194,9 +194,9 @@ module Mongrel
end
end
def Mongrel::send_signal(signal, pid_file)
def Puma::send_signal(signal, pid_file)
pid = File.read(pid_file).to_i
print "Sending #{signal} to Mongrel at PID #{pid}..."
print "Sending #{signal} to Puma at PID #{pid}..."
begin
Process.kill(signal, pid)
rescue Errno::ESRCH
@@ -208,14 +208,14 @@ module Mongrel
class Stop < GemPlugin::Plugin "/commands"
include Mongrel::Command::Base
include Puma::Command::Base
def configure
options [
['-c', '--chdir PATH', "Change to dir before starting (will be expanded).", :@cwd, "."],
['-f', '--force', "Force the shutdown (kill -9).", :@force, false],
['-w', '--wait SECONDS', "Wait SECONDS before forcing shutdown", :@wait, "0"],
['-P', '--pid FILE', "Where the PID file is located.", :@pid_file, "log/mongrel.pid"]
['-P', '--pid FILE', "Where the PID file is located.", :@pid_file, "log/puma.pid"]
]
end
@@ -236,22 +236,22 @@ module Mongrel
sleep 1
end
Mongrel::send_signal("KILL", @pid_file) if File.exist? @pid_file
Puma::send_signal("KILL", @pid_file) if File.exist? @pid_file
else
Mongrel::send_signal("TERM", @pid_file)
Puma::send_signal("TERM", @pid_file)
end
end
end
class Restart < GemPlugin::Plugin "/commands"
include Mongrel::Command::Base
include Puma::Command::Base
def configure
options [
['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, '.'],
['-s', '--soft', "Do a soft restart rather than a process exit restart", :@soft, false],
['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/puma.pid"]
]
end
@@ -267,18 +267,18 @@ module Mongrel
def run
if @soft
Mongrel::send_signal("HUP", @pid_file)
Puma::send_signal("HUP", @pid_file)
else
Mongrel::send_signal("USR2", @pid_file)
Puma::send_signal("USR2", @pid_file)
end
end
end
end
GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
GemPlugin::Manager.instance.load "puma" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
if not Mongrel::Command::Registry.instance.run ARGV
if not Puma::Command::Registry.instance.run ARGV
exit 1
end
View
@@ -456,7 +456,7 @@ VALUE HttpParser_body(VALUE self) {
void Init_http11()
{
VALUE mMongrel = rb_define_module("Mongrel");
VALUE mPuma = rb_define_module("Puma");
DEF_GLOBAL(request_method, "REQUEST_METHOD");
DEF_GLOBAL(request_uri, "REQUEST_URI");
@@ -465,10 +465,10 @@ void Init_http11()
DEF_GLOBAL(http_version, "HTTP_VERSION");
DEF_GLOBAL(request_path, "REQUEST_PATH");
eHttpParserError = rb_define_class_under(mMongrel, "HttpParserError", rb_eIOError);
eHttpParserError = rb_define_class_under(mPuma, "HttpParserError", rb_eIOError);
rb_global_variable(&eHttpParserError);
VALUE cHttpParser = rb_define_class_under(mMongrel, "HttpParser", rb_cObject);
VALUE cHttpParser = rb_define_class_under(mPuma, "HttpParser", rb_cObject);
rb_define_alloc_func(cHttpParser, HttpParser_alloc);
rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
rb_define_method(cHttpParser, "reset", HttpParser_reset, 0);
View
@@ -1,49 +0,0 @@
# Standard libraries
require 'socket'
require 'tempfile'
require 'yaml'
require 'time'
require 'etc'
require 'uri'
require 'stringio'
# Compiled Mongrel extension
# support multiple ruby version (fat binaries under windows)
begin
RUBY_VERSION =~ /(\d+.\d+)/
require "#{$1}/http11"
rescue LoadError
require 'http11'
end
# Gem conditional loader
require 'mongrel/gems'
require 'thread'
# Ruby Mongrel
require 'mongrel/handlers'
require 'mongrel/command'
require 'mongrel/tcphack'
require 'mongrel/configurator'
require 'mongrel/uri_classifier'
require 'mongrel/const'
require 'mongrel/http_request'
require 'mongrel/header_out'
require 'mongrel/http_response'
require 'mongrel/server'
# Mongrel module containing all of the classes (include C extensions)
# for running a Mongrel web server. It contains a minimalist HTTP server
# with just enough functionality to service web application requests
# fast as possible.
module Mongrel
# Thrown at a thread when it is timed out.
class TimeoutError < RuntimeError; end
class BodyReadError < RuntimeError; end
end
Mongrel::Gems.require "mongrel_experimental",
">=#{Mongrel::Const::MONGREL_VERSION}"
View
@@ -1,10 +0,0 @@
# Copyright (c) 2005 Zed A. Shaw
# You can redistribute it and/or modify it under the same terms as Ruby.
#
# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
# for more information.
require 'mongrel/gems'
Mongrel::Gems.require 'gem_plugin'
# File is just a stub that makes sure the mongrel_plugins gem is loaded and ready
View
@@ -0,0 +1,49 @@
# Standard libraries
require 'socket'
require 'tempfile'
require 'yaml'
require 'time'
require 'etc'
require 'uri'
require 'stringio'
# Compiled Puma extension
# support multiple ruby version (fat binaries under windows)
begin
RUBY_VERSION =~ /(\d+.\d+)/
require "#{$1}/http11"
rescue LoadError
require 'http11'
end
# Gem conditional loader
require 'puma/gems'
require 'thread'
# Ruby Puma
require 'puma/handlers'
require 'puma/command'
require 'puma/tcphack'
require 'puma/configurator'
require 'puma/uri_classifier'
require 'puma/const'
require 'puma/http_request'
require 'puma/header_out'
require 'puma/http_response'
require 'puma/server'
# Puma module containing all of the classes (include C extensions)
# for running a Puma web server. It contains a minimalist HTTP server
# with just enough functionality to service web application requests
# fast as possible.
module Puma
# Thrown at a thread when it is timed out.
class TimeoutError < RuntimeError; end
class BodyReadError < RuntimeError; end
end
Puma::Gems.require "puma_experimental",
">=#{Puma::Const::PUMA_VERSION}"
Oops, something went wrong.

0 comments on commit 190a81c

Please sign in to comment.