[DRE-maint] Re: Mongrel on Debian - wanna join forces?
Gunnar Wolf
gwolf at gwolf.org
Sat Jan 6 07:08:15 CET 2007
Jens Kraemer dijo [Fri, Dec 29, 2006 at 01:31:10PM +0100]:
> > Ok, I have not yet worked with your packages - I'm only downloading
> > them now. I want to work with what you have done, possibly merge it
> > with the little I have done. Please tell me, are the packages
> > available here the latest you have?
> >
> > http://debian.jkraemer.net/apt/pool/main/m/mongrel/
>
> yeah, these are the latest packages.
Ok. I finally started working on this - As of right now, I uploaded
into our SVN tree the files as I had worked with them. I supposed most
(I'd even say that all) of the packaging work you have done is
contained in the debian/ directory - However, I found quite a large
diff between the files you have _outside_ of debian/ and the ones I
have, which I'm attaching to this mail. We worked on the same version,
so this is not as clear-cut as I'd like - Did you make this diff? Or
do we have an upstream which changes the contents without bumping the
version number? Where/how did you get your upstream sources? I
downloaded them from:
http://rubyforge.org/frs/download.php/13231/mongrel-0.3.13.4.gem
Then, just renamed mongrel-0.3.13.4.gem into mongrel-0.3.13.4.tar,
gzipped it and renamed it to mongrel_0.3.13.4.orig.tar.gz
> sounds good. Don't laugh at me, but until now I checked out the mongrel
> source from svn, copied the debian/ subdir into the tree, updated the
> changelog and ran debuild ;-)
Hey, it works not only for you, but for your package's users! ;-)
> So there's plenty room for improvements. How do I create the orig and
> diff tar.gz and from my tree? I also could just send you the whole
> source tree from which I generated the latest debs.
Hmmm... Well, take a look at my debian/rules:
http://svn.debian.org/wsvn/pkg-ruby-extras/packages-wip/mongrel/trunk/debian/rules?op=file&rev=0&sc=0
What do you want in here? First, the unpack target: It unpacks the
gem's data.tar.gz file so it can be built and packaged. Second, the
patch/unpatch targets: They apply (or clean up, although that's not
really needed) the patches via the dpatch infrastructure (mainly,
because our extra step involving unpack. Gems suck ;-) ). And... Well,
the rest is automatic - Debhelper takes care of it.
> > Still, there is much to do before I am ready to upload this to
> > Debian. Today I finally requested to join the pkg-ruby-extras group,
> > although probably Mongrel is outside its scope - Still, if you want me
> > to include Mongrel in the group's repository, I'll be glad to do so.
>
> I'm afraid I got no idea about how a debian package builder usually
> manages his package sources and how the whole get-a-package-
> into-the-distribution process works - so if Mongrel is outside of the
> scope of pkg-ruby-extras, where should it go then?
I'm also new to this team, and it seems the package does belong in
there - at least, there are some pkg-ruby-extras members who are
interested and willing to work with it :) Anyway, regardless of how
this is managed: We will (of course, with your permission) build upon
your fine work. Do you want to be listed as a co-maintainer of this
package (which means sharing some responsabilities, of course,
regarding the package well-keeping), or just to be credited as the
original starter of this effort?
Greetings,
--
Gunnar Wolf - gwolf at gwolf.org - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF
-------------- next part --------------
--- jens/mongrel-0.3.13.4/./test/test_stats.rb 2006-06-30 15:42:12.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./test/test_stats.rb 1969-12-31 18:00:00.000000000 -0600
@@ -13,8 +13,8 @@
def test_sampling_speed
out = StringIO.new
- s = Stats.new("test")
- t = Stats.new("time")
+ s = Mongrel::Stats.new("test")
+ t = Mongrel::Stats.new("time")
100.times { s.sample(rand(20)); t.tick }
--- jens/mongrel-0.3.13.4/./lib/mongrel/command.rb 2006-08-08 04:23:26.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./lib/mongrel/command.rb 1969-12-31 18:00:00.000000000 -0600
@@ -157,6 +157,10 @@
puts "#{Mongrel::Command::BANNER}\nAvailable commands are:\n\n"
self.commands.each do |name|
+ if /mongrel::/ =~ name
+ name = name[9 .. -1]
+ end
+
puts " - #{name[1 .. -1]}\n"
end
@@ -179,8 +183,12 @@
return true
end
- # command exists, set it up and validate it
begin
+ # quick hack so that existing commands will keep working but the Mongrel:: ones can be moved
+ if ["start", "stop", "restart"].include? cmd_name
+ cmd_name = "mongrel::" + cmd_name
+ end
+
command = GemPlugin::Manager.instance.create("/commands/#{cmd_name}", :argv => args)
rescue OptionParser::InvalidOption
STDERR.puts "#$! for command '#{cmd_name}'"
--- jens/mongrel-0.3.13.4/./lib/mongrel/stats.rb 2006-06-30 15:42:12.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./lib/mongrel/stats.rb 1969-12-31 18:00:00.000000000 -0600
@@ -12,76 +12,78 @@
#
# It does all of this very fast and doesn't take up any memory since the samples
# are not stored but instead all the values are calculated on the fly.
-class Stats
- attr_reader :sum, :sumsq, :n, :min, :max
-
- def initialize(name)
- @name = name
- reset
- end
+module Mongrel
+ class Stats
+ attr_reader :sum, :sumsq, :n, :min, :max
+
+ def initialize(name)
+ @name = name
+ reset
+ end
- # Resets the internal counters so you can start sampling again.
- def reset
- @sum = 0.0
- @sumsq = 0.0
- @last_time = Time.new
- @n = 0.0
- @min = 0.0
- @max = 0.0
- end
+ # Resets the internal counters so you can start sampling again.
+ def reset
+ @sum = 0.0
+ @sumsq = 0.0
+ @last_time = Time.new
+ @n = 0.0
+ @min = 0.0
+ @max = 0.0
+ end
- # Adds a sampling to the calculations.
- def sample(s)
- @sum += s
- @sumsq += s * s
- if @n == 0
- @min = @max = s
- else
- @min = s if @min > s
- @max = s if @max < s
+ # Adds a sampling to the calculations.
+ def sample(s)
+ @sum += s
+ @sumsq += s * s
+ if @n == 0
+ @min = @max = s
+ else
+ @min = s if @min > s
+ @max = s if @max < s
+ end
+ @n+=1
end
- @n+=1
- end
- # Dump this Stats object with an optional additional message.
- def dump(msg = "", out=STDERR)
- out.puts "#{msg}: #{self.to_s}"
- end
+ # Dump this Stats object with an optional additional message.
+ def dump(msg = "", out=STDERR)
+ out.puts "#{msg}: #{self.to_s}"
+ end
- # Returns a common display (used by dump)
- def to_s
+ # Returns a common display (used by dump)
+ def to_s
"[#{@name}]: SUM=%0.4f, SUMSQ=%0.4f, N=%0.4f, MEAN=%0.4f, SD=%0.4f, MIN=%0.4f, MAX=%0.4f" % [@sum, @sumsq, @n, mean, sd, @min, @max]
- end
+ end
- # Calculates and returns the mean for the data passed so far.
- def mean
- @sum / @n
- end
+ # Calculates and returns the mean for the data passed so far.
+ def mean
+ @sum / @n
+ end
- # Calculates the standard deviation of the data so far.
- def sd
- # (sqrt( ((s).sumsq - ( (s).sum * (s).sum / (s).n)) / ((s).n-1) ))
- begin
- return Math.sqrt( (@sumsq - ( @sum * @sum / @n)) / (@n-1) )
- rescue Errno::EDOM
- return 0.0
+ # Calculates the standard deviation of the data so far.
+ def sd
+ # (sqrt( ((s).sumsq - ( (s).sum * (s).sum / (s).n)) / ((s).n-1) ))
+ begin
+ return Math.sqrt( (@sumsq - ( @sum * @sum / @n)) / (@n-1) )
+ rescue Errno::EDOM
+ return 0.0
+ end
end
- end
- # Adds a time delta between now and the last time you called this. This
- # will give you the average time between two activities.
- #
- # An example is:
- #
- # t = Stats.new("do_stuff")
- # 10000.times { do_stuff(); t.tick }
- # t.dump("time")
- #
- def tick
- now = Time.now
- sample(now - @last_time)
- @last_time = now
+ # Adds a time delta between now and the last time you called this. This
+ # will give you the average time between two activities.
+ #
+ # An example is:
+ #
+ # t = Stats.new("do_stuff")
+ # 10000.times { do_stuff(); t.tick }
+ # t.dump("time")
+ #
+ def tick
+ now = Time.now
+ sample(now - @last_time)
+ @last_time = now
+ end
end
end
--- jens/mongrel-0.3.13.4/./lib/mongrel/handlers.rb 2006-09-03 14:47:53.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./lib/mongrel/handlers.rb 1969-12-31 18:00:00.000000000 -0600
@@ -324,11 +324,11 @@
def initialize(ops={})
@sample_rate = ops[:sample_rate] || 300
- @processors = Stats.new("processors")
- @reqsize = Stats.new("request Kb")
- @headcount = Stats.new("req param count")
- @respsize = Stats.new("response Kb")
- @interreq = Stats.new("inter-request time")
+ @processors = Mongrel::Stats.new("processors")
+ @reqsize = Mongrel::Stats.new("request Kb")
+ @headcount = Mongrel::Stats.new("req param count")
+ @respsize = Mongrel::Stats.new("response Kb")
+ @interreq = Mongrel::Stats.new("inter-request time")
end
--- jens/mongrel-0.3.13.4/./lib/mongrel/debug.rb 2006-08-25 22:05:05.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./lib/mongrel/debug.rb 1969-12-31 18:00:00.000000000 -0600
@@ -129,7 +129,7 @@
begin
if o.respond_to? :length
len = o.length
- lengths[o.class] ||= Stats.new(o.class)
+ lengths[o.class] ||= Mongrel::Stats.new(o.class)
lengths[o.class].sample(len)
end
rescue Object
--- jens/mongrel-0.3.13.4/./bin/mongrel_rails_service 2006-09-18 05:01:00.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./bin/mongrel_rails_service 1969-12-31 18:00:00.000000000 -0600
@@ -1,4 +1,3 @@
-#! /usr/bin/ruby1.8
###############################################
# mongrel_rails_service
#
--- jens/mongrel-0.3.13.4/./bin/mongrel_rails_svc 2006-09-18 05:01:00.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./bin/mongrel_rails_svc 1969-12-31 18:00:00.000000000 -0600
@@ -1,4 +1,3 @@
-#! /usr/bin/ruby1.8
###############################################
# mongrel_rails_svc
#
--- jens/mongrel-0.3.13.4/./bin/mongrel_rails 2006-09-18 05:01:00.000000000 -0500
+++ gwolf/mongrel-0.3.13.4/./bin/mongrel_rails 1969-12-31 18:00:00.000000000 -0600
@@ -1,4 +1,3 @@
-#! /usr/bin/ruby1.8
# Copyright (c) 2005 Zed A. Shaw
# You can redistribute it and/or modify it under the same terms as Ruby.
#
@@ -11,216 +10,217 @@
require 'mongrel/rails'
require 'etc'
+module Mongrel
+ class Start < GemPlugin::Plugin "/commands"
+ include Mongrel::Command::Base
+
+ def configure
+ options [
+ ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
+ ["-d", "--daemonize", "Whether to run in the background or not", :@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"],
+ ['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024],
+ ['-t', '--timeout TIME', "Timeout all requests after 100th seconds time", :@timeout, 0],
+ ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
+ ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
+ ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"],
+ ['-B', '--debug', "Enable debugging mode", :@debug, false],
+ ['-C', '--config PATH', "Use a config file", :@config_file, nil],
+ ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
+ ['-G', '--generate CONFIG', "Generate a config file for -C", :@generate, nil],
+ ['', '--user USER', "User to run as", :@user, nil],
+ ['', '--group GROUP', "Group to run as", :@group, nil],
+ ['', '--prefix PATH', "URL prefix for Rails app", :@prefix, nil]
+ ]
+ end
+
+ def validate
+ @cwd = File.expand_path(@cwd)
+ valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
+
+ # change there to start, then we'll have to come back after daemonize
+ Dir.chdir(@cwd)
+
+ valid?(@prefix[0].chr == "/" && @prefix[-1].chr != "/", "Prefix must begin with / and not end in /") if @prefix
+ valid_dir? File.dirname(@log_file), "Path to log file not valid: #@log_file"
+ valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file"
+ valid_dir? @docroot, "Path to docroot not valid: #@docroot"
+ valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
+ valid_exists? @config_file, "Config file not there: #@config_file" if @config_file
+ valid_dir? File.dirname(@generate), "Problem accessing directory to #@generate" if @generate
+ valid_user? @user if @user
+ valid_group? @group if @group
+
+ return @valid
+ end
+
+
+ def run
+
+ # command line setting override config file settings
+ settings = { :host => @address, :port => @port, :cwd => @cwd,
+ :log_file => @log_file, :pid_file => @pid_file, :environment => @environment,
+ :docroot => @docroot, :mime_map => @mime_map, :daemon => @daemon,
+ :debug => @debug, :includes => ["mongrel"], :config_script => @config_script,
+ :num_processors => @num_procs, :timeout => @timeout,
+ :user => @user, :group => @group, :prefix => @prefix, :config_file => @config_file
+ }
+
+ if @generate
+ STDERR.puts "** Writing config to #@generate"
+ open(@generate, "w") {|f| f.write(settings.to_yaml) }
+ STDERR.puts "## Exiting. Re-run without -G and WITH -C using your new config file."
+ exit 0
+ end
-class Start < GemPlugin::Plugin "/commands"
- include Mongrel::Command::Base
-
- def configure
- options [
- ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
- ["-d", "--daemonize", "Whether to run in the background or not", :@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"],
- ['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024],
- ['-t', '--timeout TIME', "Timeout all requests after 100th seconds time", :@timeout, 0],
- ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
- ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
- ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"],
- ['-B', '--debug', "Enable debugging mode", :@debug, false],
- ['-C', '--config PATH', "Use a config file", :@config_file, nil],
- ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
- ['-G', '--generate CONFIG', "Generate a config file for -C", :@generate, nil],
- ['', '--user USER', "User to run as", :@user, nil],
- ['', '--group GROUP', "Group to run as", :@group, nil],
- ['', '--prefix PATH', "URL prefix for Rails app", :@prefix, nil]
- ]
- end
-
- def validate
- @cwd = File.expand_path(@cwd)
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
-
- # change there to start, then we'll have to come back after daemonize
- Dir.chdir(@cwd)
-
- valid?(@prefix[0].chr == "/" && @prefix[-1].chr != "/", "Prefix must begin with / and not end in /") if @prefix
- valid_dir? File.dirname(@log_file), "Path to log file not valid: #@log_file"
- valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file"
- valid_dir? @docroot, "Path to docroot not valid: #@docroot"
- valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
- valid_exists? @config_file, "Config file not there: #@config_file" if @config_file
- valid_dir? File.dirname(@generate), "Problem accessing directory to #@generate" if @generate
- valid_user? @user if @user
- valid_group? @group if @group
+ if @config_file
+ conf = YAML.load_file(@config_file)
+ settings = settings.merge! conf
+ STDERR.puts "** Loading settings from #{@config_file} (they override command line)." unless settings[:daemon]
+ end
- return @valid
- end
-
-
- def run
-
- # command line setting override config file settings
- settings = { :host => @address, :port => @port, :cwd => @cwd,
- :log_file => @log_file, :pid_file => @pid_file, :environment => @environment,
- :docroot => @docroot, :mime_map => @mime_map, :daemon => @daemon,
- :debug => @debug, :includes => ["mongrel"], :config_script => @config_script,
- :num_processors => @num_procs, :timeout => @timeout,
- :user => @user, :group => @group, :prefix => @prefix, :config_file => @config_file
- }
-
- if @generate
- STDERR.puts "** Writing config to #@generate"
- open(@generate, "w") {|f| f.write(settings.to_yaml) }
- STDERR.puts "## Exiting. Re-run without -G and WITH -C using your new config file."
- exit 0
- end
-
- if @config_file
- conf = YAML.load_file(@config_file)
- settings = settings.merge! conf
- STDERR.puts "** Loading settings from #{@config_file} (they override command line)." unless settings[:daemon]
- end
-
- config = Mongrel::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."
+ config = Mongrel::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."
+ end
+
+ daemonize
+ log "Daemonized, any open files are closed. Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info."
+ log "Settings loaded from #{@config_file} (they override command line)." if @config_file
end
- daemonize
- log "Daemonized, any open files are closed. Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info."
- 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 Mongrel listening at #{defaults[:host]}:#{defaults[:port]}"
-
- listener do
- mime = {}
- if defaults[:mime_map]
- log "Loading additional MIME types from #{defaults[:mime_map]}"
- mime = load_mime_map(defaults[:mime_map], mime)
- end
+ listener do
+ mime = {}
+ if defaults[:mime_map]
+ log "Loading additional MIME types from #{defaults[:mime_map]}"
+ mime = load_mime_map(defaults[:mime_map], mime)
+ end
+
+ if defaults[:debug]
+ log "Installing debugging prefixed filters. Look in log/mongrel_debug for the files."
+ debug "/"
+ end
+
+ log "Starting Rails with #{defaults[:environment]} environment..."
+ log "Mounting Rails at #{defaults[:prefix]}..." if defaults[:prefix]
+ uri defaults[:prefix] || "/", :handler => rails(:mime => mime, :prefix => defaults[:prefix])
+ log "Rails loaded."
+
+ log "Loading any Rails specific GemPlugins"
+ load_plugins
+
+ if defaults[:config_script]
+ log "Loading #{defaults[:config_script]} external config script"
+ run_config(defaults[:config_script])
+ end
- if defaults[:debug]
- log "Installing debugging prefixed filters. Look in log/mongrel_debug for the files."
- debug "/"
+ setup_rails_signals
end
+ end
- log "Starting Rails with #{defaults[:environment]} environment..."
- log "Mounting Rails at #{defaults[:prefix]}..." if defaults[:prefix]
- uri defaults[:prefix] || "/", :handler => rails(:mime => mime, :prefix => defaults[:prefix])
- log "Rails loaded."
-
- log "Loading any Rails specific GemPlugins"
- load_plugins
-
- if defaults[:config_script]
- log "Loading #{defaults[:config_script]} external config script"
- run_config(defaults[:config_script])
- end
+ config.run
+ config.log "Mongrel available at #{settings[:host]}:#{settings[:port]}"
- setup_rails_signals
+ if config.defaults[:daemon]
+ config.write_pid_file
+ else
+ config.log "Use CTRL-C to stop."
end
- end
- config.run
- config.log "Mongrel available at #{settings[:host]}:#{settings[:port]}"
-
- if config.defaults[:daemon]
- config.write_pid_file
- else
- config.log "Use CTRL-C to stop."
- end
+ config.join
- config.join
-
- if config.needs_restart
- if RUBY_PLATFORM !~ /mswin/
- cmd = "ruby #{__FILE__} start #{original_args.join(' ')}"
- config.log "Restarting with arguments: #{cmd}"
- exec cmd
- else
- config.log "Win32 does not support restarts. Exiting."
+ if config.needs_restart
+ if RUBY_PLATFORM !~ /mswin/
+ cmd = "ruby #{__FILE__} start #{original_args.join(' ')}"
+ config.log "Restarting with arguments: #{cmd}"
+ exec cmd
+ else
+ config.log "Win32 does not support restarts. Exiting."
+ end
end
end
end
-end
-def send_signal(signal, pid_file)
- pid = open(pid_file).read.to_i
- print "Sending #{signal} to Mongrel at PID #{pid}..."
- begin
- Process.kill(signal, pid)
- rescue Errno::ESRCH
- puts "Process does not exist. Not running."
- end
+ def Mongrel::send_signal(signal, pid_file)
+ pid = open(pid_file).read.to_i
+ print "Sending #{signal} to Mongrel at PID #{pid}..."
+ begin
+ Process.kill(signal, pid)
+ rescue Errno::ESRCH
+ puts "Process does not exist. Not running."
+ end
- puts "Done."
-end
+ puts "Done."
+ end
-class Stop < GemPlugin::Plugin "/commands"
- include Mongrel::Command::Base
+ class Stop < GemPlugin::Plugin "/commands"
+ include Mongrel::Command::Base
- def configure
- options [
- ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, "."],
- ['-f', '--force', "Force the shutdown.", :@force, false],
- ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
- ]
- end
+ def configure
+ options [
+ ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, "."],
+ ['-f', '--force', "Force the shutdown.", :@force, false],
+ ['-P', '--pid FILE', "Where the PID file is located", :@pid_file, "log/mongrel.pid"]
+ ]
+ end
- def validate
- @cwd = File.expand_path(@cwd)
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
+ def validate
+ @cwd = File.expand_path(@cwd)
+ valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
- Dir.chdir @cwd
+ Dir.chdir @cwd
- valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
- return @valid
- end
+ valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
+ return @valid
+ end
- def run
- if @force
- send_signal("KILL", @pid_file)
- else
- send_signal("TERM", @pid_file)
+ def run
+ if @force
+ Mongrel::send_signal("KILL", @pid_file)
+ else
+ Mongrel::send_signal("TERM", @pid_file)
+ end
end
end
-end
-class Restart < GemPlugin::Plugin "/commands"
- include Mongrel::Command::Base
+ class Restart < GemPlugin::Plugin "/commands"
+ include Mongrel::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"]
- ]
- end
+ 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"]
+ ]
+ end
- def validate
- @cwd = File.expand_path(@cwd)
- valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
+ def validate
+ @cwd = File.expand_path(@cwd)
+ valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"
- Dir.chdir @cwd
+ Dir.chdir @cwd
- valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
- return @valid
- end
+ valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?"
+ return @valid
+ end
- def run
- if @soft
- send_signal("HUP", @pid_file)
- else
- send_signal("USR2", @pid_file)
+ def run
+ if @soft
+ Mongrel::send_signal("HUP", @pid_file)
+ else
+ Mongrel::send_signal("USR2", @pid_file)
+ end
end
end
end
@@ -228,10 +228,6 @@
GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
-
if not Mongrel::Command::Registry.instance.run ARGV
exit 1
end
-
-
-
More information about the Pkg-ruby-extras-maintainers
mailing list