[Groonga-commit] groonga/groonga-query-log at f04a378 [master] Move Analyzer under Command module

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 21 15:18:27 JST 2017


Kouhei Sutou	2017-11-21 15:18:27 +0900 (Tue, 21 Nov 2017)

  New Revision: f04a378fb7ed4c28098b7a1e0339ae897d0db365
  https://github.com/groonga/groonga-query-log/commit/f04a378fb7ed4c28098b7a1e0339ae897d0db365

  Message:
    Move Analyzer under Command module

  Modified files:
    bin/groonga-query-log-analyze
    lib/groonga/query-log.rb
    lib/groonga/query-log/parser.rb
  Renamed files:
    lib/groonga/query-log/command/analyzer.rb
      (from lib/groonga/query-log/analyzer.rb)
    lib/groonga/query-log/command/analyzer/reporter.rb
      (from lib/groonga/query-log/analyzer/reporter.rb)
    lib/groonga/query-log/command/analyzer/reporter/console.rb
      (from lib/groonga/query-log/analyzer/reporter/console.rb)
    lib/groonga/query-log/command/analyzer/reporter/html.rb
      (from lib/groonga/query-log/analyzer/reporter/html.rb)
    lib/groonga/query-log/command/analyzer/reporter/json-stream.rb
      (from lib/groonga/query-log/analyzer/reporter/json-stream.rb)
    lib/groonga/query-log/command/analyzer/reporter/json.rb
      (from lib/groonga/query-log/analyzer/reporter/json.rb)
    lib/groonga/query-log/command/analyzer/sized-grouped-operations.rb
      (from lib/groonga/query-log/analyzer/sized-grouped-operations.rb)
    lib/groonga/query-log/command/analyzer/sized-statistics.rb
      (from lib/groonga/query-log/analyzer/sized-statistics.rb)
    lib/groonga/query-log/command/analyzer/streamer.rb
      (from lib/groonga/query-log/analyzer/streamer.rb)
    lib/groonga/query-log/statistic.rb
      (from lib/groonga/query-log/analyzer/statistic.rb)
    test/command/test-analyzer.rb
      (from test/test-analyzer.rb)

  Modified: bin/groonga-query-log-analyze (+3 -4)
===================================================================
--- bin/groonga-query-log-analyze    2017-11-20 15:58:37 +0900 (c62642e)
+++ bin/groonga-query-log-analyze    2017-11-21 15:18:27 +0900 (d743272)
@@ -1,8 +1,7 @@
 #!/usr/bin/env ruby
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
-# Copyright (C) 2014  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2014-2017  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -18,7 +17,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-require "groonga/query-log"
+require "groonga/query-log/command/analyzer"
 
-analyzer = Groonga::QueryLog::Analyzer.new
+analyzer = Groonga::QueryLog::Command::Analyzer.new
 exit(analyzer.run(ARGV))

  Modified: lib/groonga/query-log.rb (+1 -4)
===================================================================
--- lib/groonga/query-log.rb    2017-11-20 15:58:37 +0900 (2b1d9f7)
+++ lib/groonga/query-log.rb    2017-11-21 15:18:27 +0900 (ef735ee)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2012-2017  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -17,7 +15,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 require "groonga/query-log/version"
-require "groonga/query-log/analyzer"
 require "groonga/query-log/parser"
 require "groonga/query-log/replayer"
 require "groonga/query-log/server-verifier"

  Renamed: lib/groonga/query-log/command/analyzer.rb (+9 -7) 94%
===================================================================
--- lib/groonga/query-log/analyzer.rb    2017-11-20 15:58:37 +0900 (0a8e96e)
+++ lib/groonga/query-log/command/analyzer.rb    2017-11-21 15:18:27 +0900 (ae69c1f)
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2016  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -19,15 +19,16 @@ require "optparse"
 require "json"
 require "groonga/query-log/command-line-utils"
 require "groonga/query-log/parser"
-require "groonga/query-log/analyzer/streamer"
-require "groonga/query-log/analyzer/sized-statistics"
-require "groonga/query-log/analyzer/reporter/console"
-require "groonga/query-log/analyzer/reporter/html"
-require "groonga/query-log/analyzer/reporter/json"
-require "groonga/query-log/analyzer/reporter/json-stream"
+require "groonga/query-log/command/analyzer/streamer"
+require "groonga/query-log/command/analyzer/sized-statistics"
+require "groonga/query-log/command/analyzer/reporter/console"
+require "groonga/query-log/command/analyzer/reporter/html"
+require "groonga/query-log/command/analyzer/reporter/json"
+require "groonga/query-log/command/analyzer/reporter/json-stream"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       include CommandLineUtils
 
@@ -257,5 +258,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/reporter.rb (+2 -0) 99%
===================================================================
--- lib/groonga/query-log/analyzer/reporter.rb    2017-11-20 15:58:37 +0900 (7134b0e)
+++ lib/groonga/query-log/command/analyzer/reporter.rb    2017-11-21 15:18:27 +0900 (b6cb5f1)
@@ -19,6 +19,7 @@
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class Reporter
         include Enumerable
@@ -106,5 +107,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/reporter/console.rb (+4 -4) 98%
===================================================================
--- lib/groonga/query-log/analyzer/reporter/console.rb    2017-11-20 15:58:37 +0900 (b9ab48a)
+++ lib/groonga/query-log/command/analyzer/reporter/console.rb    2017-11-21 15:18:27 +0900 (f47c14c)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2011-2014  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -17,10 +15,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-require "groonga/query-log/analyzer/reporter"
+require "groonga/query-log/command/analyzer/reporter"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class ConsoleReporter < Reporter
         class Color
@@ -295,5 +294,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/reporter/html.rb (+3 -1) 99%
===================================================================
--- lib/groonga/query-log/analyzer/reporter/html.rb    2017-11-20 15:58:37 +0900 (1c91f88)
+++ lib/groonga/query-log/command/analyzer/reporter/html.rb    2017-11-21 15:18:27 +0900 (624b98c)
@@ -16,10 +16,11 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 require "erb"
-require "groonga/query-log/analyzer/reporter"
+require "groonga/query-log/command/analyzer/reporter"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class HTMLReporter < Reporter
         include ERB::Util
@@ -336,5 +337,6 @@ td.name
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/reporter/json-stream.rb (+4 -4) 89%
===================================================================
--- lib/groonga/query-log/analyzer/reporter/json-stream.rb    2017-11-20 15:58:37 +0900 (a328c1f)
+++ lib/groonga/query-log/command/analyzer/reporter/json-stream.rb    2017-11-21 15:18:27 +0900 (c569139)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2014  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2014-2017  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -16,10 +14,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-require "groonga/query-log/analyzer/reporter"
+require "groonga/query-log/command/analyzer/reporter"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class JSONStreamReporter < Reporter
         def report_statistic(statistic)
@@ -45,5 +44,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/reporter/json.rb (+4 -4) 90%
===================================================================
--- lib/groonga/query-log/analyzer/reporter/json.rb    2017-11-20 15:58:37 +0900 (2c9e1c4)
+++ lib/groonga/query-log/command/analyzer/reporter/json.rb    2017-11-21 15:18:27 +0900 (5adb195)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2011-2012  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -17,10 +15,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-require "groonga/query-log/analyzer/reporter"
+require "groonga/query-log/command/analyzer/reporter"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class JSONReporter < Reporter
         def report_statistic(statistic)
@@ -50,5 +49,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/sized-grouped-operations.rb (+3 -3) 96%
===================================================================
--- lib/groonga/query-log/analyzer/sized-grouped-operations.rb    2017-11-20 15:58:37 +0900 (cec3160)
+++ lib/groonga/query-log/command/analyzer/sized-grouped-operations.rb    2017-11-21 15:18:27 +0900 (8a9faa3)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2011-2012  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -19,6 +17,7 @@
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class SizedGroupedOperations < Array
         def initialize
@@ -80,5 +79,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/sized-statistics.rb (+4 -4) 96%
===================================================================
--- lib/groonga/query-log/analyzer/sized-statistics.rb    2017-11-20 15:58:37 +0900 (ca8d414)
+++ lib/groonga/query-log/command/analyzer/sized-statistics.rb    2017-11-21 15:18:27 +0900 (b120923)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2011-2012  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -17,10 +15,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-require "groonga/query-log/analyzer/sized-grouped-operations"
+require "groonga/query-log/command/analyzer/sized-grouped-operations"
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class SizedStatistics < Array
         attr_reader :n_responses, :n_slow_responses, :n_slow_operations
@@ -156,5 +155,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Renamed: lib/groonga/query-log/command/analyzer/streamer.rb (+3 -3) 93%
===================================================================
--- lib/groonga/query-log/analyzer/streamer.rb    2017-11-20 15:58:37 +0900 (0e16f09)
+++ lib/groonga/query-log/command/analyzer/streamer.rb    2017-11-21 15:18:27 +0900 (316773b)
@@ -1,6 +1,4 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2011-2012  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2011-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -19,6 +17,7 @@
 
 module Groonga
   module QueryLog
+    module Command
     class Analyzer
       class Streamer
         def initialize(reporter)
@@ -38,5 +37,6 @@ module Groonga
         end
       end
     end
+    end
   end
 end

  Modified: lib/groonga/query-log/parser.rb (+2 -2)
===================================================================
--- lib/groonga/query-log/parser.rb    2017-11-20 15:58:37 +0900 (27a1383)
+++ lib/groonga/query-log/parser.rb    2017-11-21 15:18:27 +0900 (c0017b2)
@@ -16,7 +16,7 @@
 
 require "English"
 
-require "groonga/query-log/analyzer/statistic"
+require "groonga/query-log/statistic"
 
 module Groonga
   module QueryLog
@@ -92,7 +92,7 @@ module Groonga
       end
 
       def create_statistic(context_id)
-        statistic = Analyzer::Statistic.new(context_id)
+        statistic = Statistic.new(context_id)
         if @slow_operation_threshold
           statistic.slow_operation_threshold = @slow_operation_threshold
         end

  Renamed: lib/groonga/query-log/statistic.rb (+0 -2) 99%
===================================================================
--- lib/groonga/query-log/analyzer/statistic.rb    2017-11-20 15:58:37 +0900 (831216c)
+++ lib/groonga/query-log/statistic.rb    2017-11-21 15:18:27 +0900 (f4954a5)
@@ -18,7 +18,6 @@ require "groonga/command/parser"
 
 module Groonga
   module QueryLog
-    class Analyzer
       class Statistic
         DEFAULT_SLOW_OPERATION_THRESHOLD = 0.1
         DEFAULT_SLOW_RESPONSE_THRESHOLD = 0.2
@@ -189,6 +188,5 @@ module Groonga
           elapsed >= @slow_operation_threshold
         end
       end
-    end
   end
 end

  Renamed: test/command/test-analyzer.rb (+6 -6) 91%
===================================================================
--- test/test-analyzer.rb    2017-11-20 15:58:37 +0900 (efe805f)
+++ test/command/test-analyzer.rb    2017-11-21 15:18:27 +0900 (2e1f3a8)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2014-2017  Kouhei Sutou <kou �� clear-code.com>
 # Copyright (C) 2012  Haruka Yoshihara <yoshihara �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
@@ -17,17 +17,17 @@
 
 require "tempfile"
 require "pathname"
-require "groonga/query-log/analyzer"
+require "groonga/query-log/command/analyzer"
 
-class AnalyzerTest < Test::Unit::TestCase
+class AnalyzerCommandTest < Test::Unit::TestCase
   setup
   def setup_fixtures
-    @fixtures_path = File.join(File.dirname(__FILE__), "fixtures")
+    @fixtures_path = File.join(__dir__, "..", "fixtures")
     @query_log_path = File.join(@fixtures_path, "query.log")
   end
 
   def setup
-    @analyzer = Groonga::QueryLog::Analyzer.new
+    @analyzer = Groonga::QueryLog::Command::Analyzer.new
   end
 
   class TestInputFile < self
@@ -40,7 +40,7 @@ class AnalyzerTest < Test::Unit::TestCase
     end
 
     def test_no_specified
-      assert_raise(Groonga::QueryLog::Analyzer::NoInputError) do
+      assert_raise(Groonga::QueryLog::Command::Analyzer::NoInputError) do
         run_analyzer
       end
     end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171121/bb83ba8e/attachment-0001.htm 



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