lib/heel/server.rb in heel-3.0.2 vs lib/heel/server.rb in heel-3.1.0

- old
+ new

@@ -25,14 +25,10 @@ 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 ||= [] @@ -69,15 +65,15 @@ def default_directory ENV["HEEL_DEFAULT_DIRECTORY"] || File.join(::Heel::Server.home_directory,".heel") end def pid_file - File.join(default_directory,"heel.pid") + File.join(default_directory,"heel.#{options.port}.pid") end def log_file - File.join(default_directory,"heel.log") + File.join(default_directory,"heel.#{options.port}.log") end def win? RUBY_PLATFORM =~ /mswin|mingw/ end @@ -180,11 +176,11 @@ 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" + @stdout.puts "No pid file exists for server running on port #{options.port}, no process to kill" end @stdout.puts "Done." exit 0 end @@ -198,14 +194,14 @@ end end # make sure that if we are daemonizing the process is not running def ensure_not_running - if options.daemonize and File.exist?(pid_file) then + if File.exist?(pid_file) then @stdout.puts "ERROR: PID File #{pid_file} already exists. Heel may already be running." @stdout.puts "ERROR: Check the Log file #{log_file}" - @stdout.puts "ERROR: Heel will not start until the .pid file is cleared (`heel --kill' to clean it up)." + @stdout.puts "ERROR: Heel will not start until the .pid file is cleared (`heel --kill --port #{options.port}' to clean it up)." exit 1 end end def launch_browser @@ -267,11 +263,11 @@ end # run the heel server with the current options. def run - error_version_help_kill merge_options + error_version_help_kill setup_heel_dir ensure_not_running server_thread = start_server