[Groonga-commit] droonga/droonga-engine at b610cf0 [master] Fix indent level

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Jan 6 10:56:51 JST 2015


YUKI Hiroshi	2015-01-06 10:56:51 +0900 (Tue, 06 Jan 2015)

  New Revision: b610cf08e821653f820e8aeaa618fac9fa14b4d1
  https://github.com/droonga/droonga-engine/commit/b610cf08e821653f820e8aeaa618fac9fa14b4d1

  Message:
    Fix indent level

  Modified files:
    lib/droonga/serf/downloader.rb

  Modified: lib/droonga/serf/downloader.rb (+75 -75)
===================================================================
--- lib/droonga/serf/downloader.rb    2015-01-06 10:54:32 +0900 (e232eba)
+++ lib/droonga/serf/downloader.rb    2015-01-06 10:56:51 +0900 (473cd8b)
@@ -26,92 +26,92 @@ require "droonga/loggable"
 module Droonga
   class Serf
     class Downloader
-    include Loggable
+      include Loggable
 
-    class DownloadFailed < StandardError
-    end
-
-    MAX_RETRY_COUNT = 5
-    RETRY_INTERVAL  = 10
+      class DownloadFailed < StandardError
+      end
 
-    def initialize(output_path)
-      @output_path = output_path
-      @retry_count = 0
-    end
+      MAX_RETRY_COUNT = 5
+      RETRY_INTERVAL  = 10
 
-    def download
-      detect_platform
-      version = "0.6.3"
-      url_base = "https://dl.bintray.com/mitchellh/serf"
-      base_name = "#{version}_#{@os}_#{@architecture}.zip"
-      connection = Faraday.new(url_base) do |builder|
-        builder.response(:follow_redirects)
-        builder.adapter(Faraday.default_adapter)
+      def initialize(output_path)
+        @output_path = output_path
+        @retry_count = 0
       end
-      response = connection.get(base_name)
-      absolete_output_path = @output_path.expand_path
-      Dir.mktmpdir do |dir|
-        Archive::Zip.extract(StringIO.new(response.body),
-                             dir,
-                             :directories => false)
-        FileUtils.mv("#{dir}/serf", absolete_output_path.to_s)
-        FileUtils.chmod(0755, absolete_output_path.to_s)
-      end
-    rescue Archive::Zip::UnzipError => archive_error
-      logger.warn("Downloaded zip file is broken.")
-      if @retry_count < MAX_RETRY_COUNT
-        @retry_count += 1
-        sleep(RETRY_INTERVAL * @retry_count)
-        download
-      else
-        raise DownloadFailed.new("Couldn't download serf executable. Try it later.")
-      end
-    rescue Faraday::ConnectionFailed => network_error
-      logger.warn("Connection failed.")
-      if @retry_count < MAX_RETRY_COUNT
-        @retry_count += 1
-        sleep(RETRY_INTERVAL * @retry_count)
-        download
-      else
-        raise DownloadFailed.new("Couldn't download serf executable. Try it later.")
+
+      def download
+        detect_platform
+        version = "0.6.3"
+        url_base = "https://dl.bintray.com/mitchellh/serf"
+        base_name = "#{version}_#{@os}_#{@architecture}.zip"
+        connection = Faraday.new(url_base) do |builder|
+          builder.response(:follow_redirects)
+          builder.adapter(Faraday.default_adapter)
+        end
+        response = connection.get(base_name)
+        absolete_output_path = @output_path.expand_path
+        Dir.mktmpdir do |dir|
+          Archive::Zip.extract(StringIO.new(response.body),
+                               dir,
+                               :directories => false)
+          FileUtils.mv("#{dir}/serf", absolete_output_path.to_s)
+          FileUtils.chmod(0755, absolete_output_path.to_s)
+        end
+      rescue Archive::Zip::UnzipError => archive_error
+        logger.warn("Downloaded zip file is broken.")
+        if @retry_count < MAX_RETRY_COUNT
+          @retry_count += 1
+          sleep(RETRY_INTERVAL * @retry_count)
+          download
+        else
+          raise DownloadFailed.new("Couldn't download serf executable. Try it later.")
+        end
+      rescue Faraday::ConnectionFailed => network_error
+        logger.warn("Connection failed.")
+        if @retry_count < MAX_RETRY_COUNT
+          @retry_count += 1
+          sleep(RETRY_INTERVAL * @retry_count)
+          download
+        else
+          raise DownloadFailed.new("Couldn't download serf executable. Try it later.")
+        end
       end
-    end
 
-    private
-    def detect_platform
-      detect_os
-      detect_architecture
-    end
+      private
+      def detect_platform
+        detect_os
+        detect_architecture
+      end
 
-    def detect_os
-      case RUBY_PLATFORM
-      when /linux/
-        @os = "linux"
-      when /freebsd/
-        @os = "freebsd"
-      when /darwin/
-        @os = "darwin"
-      when /mswin|mingw/
-        @os = "windows"
-      else
-        raise "Unsupported OS: #{RUBY_PLATFORM}"
+      def detect_os
+        case RUBY_PLATFORM
+        when /linux/
+          @os = "linux"
+        when /freebsd/
+          @os = "freebsd"
+        when /darwin/
+          @os = "darwin"
+        when /mswin|mingw/
+          @os = "windows"
+        else
+          raise "Unsupported OS: #{RUBY_PLATFORM}"
+        end
       end
-    end
 
-    def detect_architecture
-      case RUBY_PLATFORM
-      when /x86_64|x64/
-        @architecture = "amd64"
-      when /i\d86/
-        @architecture = "386"
-      else
-        raise "Unsupported architecture: #{RUBY_PLATFORM}"
+      def detect_architecture
+        case RUBY_PLATFORM
+        when /x86_64|x64/
+          @architecture = "amd64"
+        when /i\d86/
+          @architecture = "386"
+        else
+          raise "Unsupported architecture: #{RUBY_PLATFORM}"
+        end
       end
-    end
 
-    def log_tag
-      "serf-downloader"
-    end
+      def log_tag
+        "serf-downloader"
+      end
     end
   end
 endi
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index