lib/heel/server.rb in heel-0.5.0 vs lib/heel/server.rb in heel-0.6.0
- old
+ new
@@ -20,10 +20,14 @@
def home_directory # :nodoc:
ENV["HOME"] ||
(ENV["HOMEPATH"] && "#{ENV["HOMEDRIVE"]}#{ENV["HOMEPATH"]}") ||
"/"
end
+
+ def kill_existing_proc
+ Heel::Server.new.kill_existing_proc
+ end
end
def initialize(argv = [])
argv ||= []
@@ -159,12 +163,14 @@
begin
pid = open(pid_file).read.to_i
@stdout.puts "Sending TERM to process #{pid}"
Process.kill("TERM", pid)
rescue Errno::ESRCH
- @stdout.puts "Process does not exist. Removing stale pid file."
+ @stdout.puts "Unable to kill process with pid #{pid}. Process does not exist. Removing stale pid file."
File.unlink(pid_file)
+ rescue Errno::EPERM
+ @stdout.puts "Unable to kill process with pid #{pid}. No permissions to kill process."
end
else
@stdout.puts "No pid file exists, no process to kill"
end
@stdout.puts "Done."
@@ -215,14 +221,14 @@
listener do
uri "/", :handler => stats
uri "/", :handler => Heel::DirHandler.new({:document_root => c_document_root,
:highlighting => c_highlighting })
uri "/", :handler => Heel::ErrorHandler.new
- uri "/css", :handler => Heel::DirHandler.new({:document_root =>
- File.join(APP_RESOURCE_DIR, "css")})
- uri "/icons", :handler => Heel::DirHandler.new({ :document_root =>
- File.join(APP_RESOURCE_DIR, "famfamfam", "icons")})
- uri "/status", :handler => ::Mongrel::StatusHandler.new(:stats_filter => stats)
+ uri "/heel_css", :handler => Heel::DirHandler.new({:document_root =>
+ File.join(APP_DATA_DIR, "css")})
+ uri "/heel_icons", :handler => Heel::DirHandler.new({ :document_root =>
+ File.join(APP_DATA_DIR, "famfamfam", "icons")})
+ uri "/heel_status", :handler => ::Mongrel::StatusHandler.new(:stats_filter => stats)
end
rescue Errno::EADDRINUSE
log "ERROR: Address (#{c_address}:#{c_port}) is already in use, please check running processes or run `heel --kill'"
exit 1
end