[Groonga-commit] groonga/heroku-buildpack-groonga at cff8e96 [master] Use blocks instead of exception handling

Zurück zum Archiv-Index

Ryo Sugimoto null+****@clear*****
Mon Aug 11 09:58:12 JST 2014


Ryo Sugimoto	2014-08-11 09:58:12 +0900 (Mon, 11 Aug 2014)

  New Revision: cff8e9671b7d8aea5636c399f24b02cc9572ff3c
  https://github.com/groonga/heroku-buildpack-groonga/commit/cff8e9671b7d8aea5636c399f24b02cc9572ff3c

  Message:
    Use blocks instead of exception handling

  Modified files:
    bin/compile

  Modified: bin/compile (+6 -6)
===================================================================
--- bin/compile    2014-08-10 12:50:51 +0900 (9c11f50)
+++ bin/compile    2014-08-11 09:58:12 +0900 (3e23c19)
@@ -17,13 +17,13 @@ def detect_latest_version
   releases = open(uri) do |json|
     JSON.load(json)
   end
-  begin
-    releases[0]["assets"][0]["name"]
-    latest_tag_name = releases[0]["tag_name"]
-  rescue
-    latest_tag_name = releases[1]["tag_name"]
+  latest_heroku_avaliable_release = releases.find do |release|
+    assets = release["assets"] || []
+    assets.any? do |asset|
+      asset["name"].start_with?("heroku-groonga-")
+    end
   end
-  latest_tag_name.sub(/\Av/, "")
+  latest_heroku_avaliable_release["tag_name"].sub(/\Av/, "")
 end
 
 def sh(*command_line)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index