OSDN Git Service

unuse pg
authornomeu <nomeu@users.sourceforge.jp>
Thu, 18 Oct 2012 02:15:03 +0000 (11:15 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Thu, 18 Oct 2012 02:19:27 +0000 (11:19 +0900)
Gemfile
Gemfile.lock
lib/bowl.rb

diff --git a/Gemfile b/Gemfile
index 431c5ea..17fcf7d 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,6 @@ source 'http://rubygems.org'
 
 gem 'activerecord', '3.0.6'
 
-gem 'pg', '0.10.1'
 gem 'activegroonga', '1.0.4'
 
 gem 'zipruby'
index c19977d..ce0eb5e 100644 (file)
@@ -18,7 +18,6 @@ GEM
     builder (2.1.2)
     diff-lcs (1.1.2)
     i18n (0.5.0)
-    pg (0.10.1)
     pkg-config (1.1.2)
     rroonga (1.2.4)
       pkg-config
@@ -39,6 +38,5 @@ PLATFORMS
 DEPENDENCIES
   activegroonga (= 1.0.4)
   activerecord (= 3.0.6)
-  pg (= 0.10.1)
   rspec (= 2.6.0)
   zipruby
index 9cbcb15..b5abdb7 100644 (file)
@@ -120,6 +120,7 @@ class Bowl
   end
 
   def save_arc_0
+    response_code = nil
     http = Net::HTTP.new('bowlroll.net')
     http.start do
       request = Net::HTTP::Post.new('/Php/upDlDownload.php')
@@ -132,11 +133,15 @@ class Bowl
       http.request(request) do |response|
         p response.code
         p response['content-type']
-        open(arc_path, 'wb') { |f|
-          response.read_body { |buf| f.write buf }
-        }
+        response_code = response.code.to_i
+        if response_code == 200
+          open(arc_path, 'wb') { |f|
+            response.read_body { |buf| f.write buf }
+          }
+        end
       end
     end
+    response_code == 200
   end
 
   def save_arc
@@ -150,7 +155,6 @@ class Bowl
       return false
     end
     save_arc_0
-    true
   end
 end
 
@@ -193,6 +197,7 @@ class Bowl20110904 < Bowl
   end
 
   def save_arc_0
+    response_code = nil
     http = Net::HTTP.new('bowlroll.net')
     http.start do
       request = Net::HTTP::Post.new('/Php/p3UpDlTop.php')
@@ -205,10 +210,14 @@ class Bowl20110904 < Bowl
       http.request(request) do |response|
         p response.code
         p response['content-type']
-        open(arc_path, 'wb') { |f|
-          response.read_body { |buf| f.write buf }
-        }
+        response_code = response.code.to_i
+        if response_code == 200
+          open(arc_path, 'wb') { |f|
+            response.read_body { |buf| f.write buf }
+          }
+        end
       end
     end
+    response_code == 200
   end
 end