# File lib/mongrel_console/console.rb, line 69 def get(url="/") Net::HTTP.get("localhost", url, @port) end
# File lib/mongrel_console/console.rb, line 55 def restart(port=@port, env=@env) stop start(port, env) end
# File lib/mongrel_console/console.rb, line 47 def start(port=@port, env=@env) `mongrel_rails start #{port} #{env} -d` end
# File lib/mongrel_console/console.rb, line 60 def status if File.exist? "log/mongrel.pid" pid = open("log/mongrel.pid") {|f| f.read.to_i } puts "Running on port #@port in env #@env with PID #{pid}" else puts "Mongrel not running." end end
# File lib/mongrel_console/console.rb, line 51 def stop `mongrel_rails stop` end
# File lib/mongrel_console/console.rb, line 22 def tail(file="log/#{@env}.log") STDERR.puts "Tailing #{file}. CTRL-C to stop it." cursor = File.size(file) last_checked = Time.now tail_thread = Thread.new do File.open(file, 'r') do |f| loop do if f.mtime > last_checked f.seek cursor last_checked = f.mtime contents = f.read cursor += contents.length print contents end sleep 1 end end end trap("INT") { tail_thread.kill } tail_thread.join nil end
Generated with the Darkfish Rdoc Generator 2.