about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-02 17:37:22 -0800
committerEric Wong <normalperson@yhbt.net>2011-02-02 17:37:22 -0800
commit9e7a8114fb0fcc56b475d17f158eaa5b7f1f7bdd (patch)
tree7918d54946cb23294f87e5d8a07b27b298262c82
parente597e594ad88dc02d70f7d3521d0d3bdc23739bb (diff)
downloadunicorn-9e7a8114fb0fcc56b475d17f158eaa5b7f1f7bdd.tar.gz
for i in `git ls-files '*.rb'`; do ruby -w -c $i; done
-rw-r--r--lib/unicorn/app/exec_cgi.rb6
-rw-r--r--lib/unicorn/http_server.rb1
-rw-r--r--lib/unicorn/tee_input.rb2
-rw-r--r--test/exec/test_exec.rb3
-rw-r--r--test/rails/test_rails.rb2
-rw-r--r--test/unit/test_request.rb6
-rw-r--r--test/unit/test_server.rb11
7 files changed, 13 insertions, 18 deletions
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index f7b4249..c259403 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -85,9 +85,9 @@ module Unicorn::App
       ENV['GATEWAY_INTERFACE'] = 'CGI/1.1'
       env.keys.grep(/^HTTP_/) { |key| ENV[key] = env[key] }
 
-      a = IO.new(0).reopen(inp)
-      b = IO.new(1).reopen(out)
-      c = IO.new(2).reopen(err)
+      $stdin.reopen(inp)
+      $stdout.reopen(out)
+      $stderr.reopen(err)
       exec(*args)
     end
 
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 3a6e51e..3a35d7d 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -424,7 +424,6 @@ class Unicorn::HttpServer
 
     if pid
       old_pid = "#{pid}.oldbin"
-      prev_pid = pid.dup
       begin
         self.pid = old_pid  # clear the path for a new pid file
       rescue ArgumentError
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index a038a84..6d37f87 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -118,7 +118,7 @@ private
   end
 
   def tee(buffer)
-    if buffer && (n = buffer.size) > 0
+    if buffer && buffer.size > 0
       @tmp.write(buffer)
       @tmp.seek(0, IO::SEEK_END) # workaround FreeBSD/OSX + MRI 1.8.x bug
     end
diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb
index 581d5d5..0f6b083 100644
--- a/test/exec/test_exec.rb
+++ b/test/exec/test_exec.rb
@@ -797,7 +797,6 @@ EOF
 
   def test_daemonize_redirect_fail
     pid_file = "#{@tmpdir}/test.pid"
-    log = Tempfile.new('unicorn_test_log')
     ucfg = Tempfile.new('unicorn_test_config')
     ucfg.syswrite("pid #{pid_file}\"\n")
     err = Tempfile.new('stderr')
@@ -1040,7 +1039,7 @@ EOF
       lock_path = "#{Dir::tmpdir}/unicorn_test." \
                   "#{Unicorn::Const::DEFAULT_LISTEN}.lock"
       begin
-        lock = File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
+        File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
         yield
       rescue Errno::EEXIST
         lock_path = nil
diff --git a/test/rails/test_rails.rb b/test/rails/test_rails.rb
index 4b3857f..ab8f0a2 100644
--- a/test/rails/test_rails.rb
+++ b/test/rails/test_rails.rb
@@ -265,7 +265,7 @@ logger Logger.new('#{COMMON_TMP.path}')
 
     if @pid
       Process.kill(:QUIT, @pid)
-      pid2, status = Process.waitpid2(@pid)
+      _, status = Process.waitpid2(@pid)
       assert status.success?
     end
 
diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb
index 67ac1b9..bd452a5 100644
--- a/test/unit/test_request.rb
+++ b/test/unit/test_request.rb
@@ -121,7 +121,7 @@ class RequestTest < Test::Unit::TestCase
 
   def test_no_content_stringio
     client = MockRequest.new("GET / HTTP/1.1\r\nHost: foo\r\n\r\n")
-    res = env = nil
+    env = nil
     assert_nothing_raised { env = @request.read(client) }
     assert_equal StringIO, env['rack.input'].class
   end
@@ -130,7 +130,7 @@ class RequestTest < Test::Unit::TestCase
     client = MockRequest.new("PUT / HTTP/1.1\r\n" \
                              "Content-Length: 0\r\n" \
                              "Host: foo\r\n\r\n")
-    res = env = nil
+    env = nil
     assert_nothing_raised { env = @request.read(client) }
     assert_equal StringIO, env['rack.input'].class
   end
@@ -139,7 +139,7 @@ class RequestTest < Test::Unit::TestCase
     client = MockRequest.new("PUT / HTTP/1.1\r\n" \
                              "Content-Length: 1\r\n" \
                              "Host: foo\r\n\r\n")
-    res = env = nil
+    env = nil
     assert_nothing_raised { env = @request.read(client) }
     assert_equal Unicorn::TeeInput, env['rack.input'].class
   end
diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb
index 41d3e02..88d7aba 100644
--- a/test/unit/test_server.rb
+++ b/test/unit/test_server.rb
@@ -10,7 +10,7 @@ require 'test/test_helper'
 
 include Unicorn
 
-class TestHandler
+class TestHandler
 
   def call(env)
     while env['rack.input'].read(4096)
@@ -19,7 +19,7 @@ class TestHandler
     rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e
       $stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n")
       raise e
-   end
+  end
 end
 
 
@@ -169,7 +169,6 @@ class WebServerTest < Test::Unit::TestCase
 
   def test_client_malformed_body
     sock = nil
-    buf = nil
     bs = 15653984
     assert_nothing_raised do
       sock = TCPSocket.new('127.0.0.1', @port)
@@ -271,7 +270,7 @@ class WebServerTest < Test::Unit::TestCase
   def test_file_streamed_request
     body = "a" * (Unicorn::Const::MAX_BODY * 2)
     long = "PUT /test HTTP/1.1\r\nContent-length: #{body.length}\r\n\r\n" + body
-    do_test(long, Unicorn::Const::CHUNK_SIZE * 2 -400)
+    do_test(long, Unicorn::Const::CHUNK_SIZE * 2 - 400)
   end
 
   def test_file_streamed_request_bad_body
@@ -279,13 +278,11 @@ class WebServerTest < Test::Unit::TestCase
     long = "GET /test HTTP/1.1\r\nContent-ength: #{body.length}\r\n\r\n" + body
     assert_raises(EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,
                   Errno::EBADF) {
-      do_test(long, Unicorn::Const::CHUNK_SIZE * 2 -400)
+      do_test(long, Unicorn::Const::CHUNK_SIZE * 2 - 400)
     }
   end
 
   def test_listener_names
     assert_equal [ "127.0.0.1:#@port" ], Unicorn.listener_names
   end
-
 end
-