summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-05 03:26:51 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-05 03:37:49 +0000
commited9cc7ba22bab5b3f7262d869a8bc03f14b2d4cb (patch)
tree48ae9035f8d61550f92e5eed332a3839996f1a9a
parent798ea473865e6d4a4ed2a35987ba40d2fcbfaf6f (diff)
...than "test ?r" and "test ?w"

Not everybody comes from a Unix shell programming background,
even though they *should* ;)
-rw-r--r--Rakefile4
-rw-r--r--lib/unicorn/configurator.rb4
-rw-r--r--test/unit/test_http_parser.rb2
3 files changed, 5 insertions, 5 deletions
diff --git a/Rakefile b/Rakefile
index 469ed3d..a9a872e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -176,11 +176,11 @@ end
 # optional rake-compiler support in case somebody needs to cross compile
 begin
   mk = "ext/unicorn_http/Makefile"
-  if test ?r, mk
+  if File.readable?(mk)
     warn "run 'gmake -C ext/unicorn_http clean' and\n" \
          "remove #{mk} before using rake-compiler"
   else
-    unless test ?r, "ext/unicorn_http/unicorn_http.c"
+    unless File.readable?("ext/unicorn_http/unicorn_http.c")
       abort "run 'gmake ragel' or 'make ragel' to generate the Ragel source"
     end
     spec = Gem::Specification.load('unicorn.gemspec')
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 86e58a0..e4305c2 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -56,7 +56,7 @@ module Unicorn
       [ :pid, :stderr_path, :stdout_path ].each do |var|
         String === (path = set[var]) or next
         path = File.expand_path(path)
-        test(?w, path) || test(?w, File.dirname(path)) or \
+        File.writable?(path) || File.writable?(File.dirname(path)) or \
               raise ArgumentError, "directory for #{var}=#{path} not writable"
       end
 
@@ -341,7 +341,7 @@ module Unicorn
       path = File.expand_path(path)
       if config_file &&
          config_file[0] != ?/ &&
-         ! test(?r, "#{path}/#{config_file}")
+         ! File.readable?("#{path}/#{config_file}")
         raise ArgumentError,
               "config_file=#{config_file} would not be accessible in" \
               " working_directory=#{path}"
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb
index b7c8a1c..e528be7 100644
--- a/test/unit/test_http_parser.rb
+++ b/test/unit/test_http_parser.rb
@@ -550,6 +550,6 @@ class HttpParserTest < Test::Unit::TestCase
       diff = after - before
       assert(diff < 10000, "memory grew more than 10M: #{diff}")
     end
-  end if RUBY_PLATFORM =~ /linux/ && test(?r, LINUX_PROC_PID_STATUS)
+  end if RUBY_PLATFORM =~ /linux/ && File.readable?(LINUX_PROC_PID_STATUS)
 
 end