[logaling-commit] logaling/logaling-command [improve-list-command] [#23331325] change list command to show command

アーカイブの一覧に戻る

null+****@clear***** null+****@clear*****
Wed Jan 25 15:38:51 JST 2012


SUZUKI Miho	2012-01-25 15:38:51 +0900 (Wed, 25 Jan 2012)

  New Revision: 8b1301d63209d6b917f4978efd3d7e5bd62dde74

  Log:
    [#23331325] change list command to show command

  Modified files:
    lib/logaling/command.rb
    lib/logaling/glossary_db.rb
    lib/logaling/repository.rb
    spec/logaling/command_spec.rb

  Modified: lib/logaling/command.rb (+3 -3)
===================================================================
--- lib/logaling/command.rb    2012-01-25 14:50:37 +0900 (1d838dd)
+++ lib/logaling/command.rb    2012-01-25 15:38:51 +0900 (8cb9f4e)
@@ -196,8 +196,8 @@ class Logaling::Command < Thor
     say "logaling-command version #{Logaling::Command::VERSION}"
   end
 
-  desc 'list', 'Show list.'
-  def list
+  desc 'show', 'Show terms in glossary.'
+  def show
     required_options = {
       "glossary" => "input glossary name '-g <glossary name>'",
       "source-language" => "input source-language code '-S <source-language code>'",
@@ -206,7 +206,7 @@ class Logaling::Command < Thor
     config = load_config_and_merge_options(required_options)
     run_pager
     repository.index
-    terms = repository.list(config["glossary"], config["source-language"], config["target-language"])
+    terms = repository.show(config["glossary"], config["source-language"], config["target-language"])
     unless terms.empty?
       max_str_size = terms.map{|term| term[:source_term].size}.sort.last
       terms.each do |term|

  Modified: lib/logaling/glossary_db.rb (+1 -1)
===================================================================
--- lib/logaling/glossary_db.rb    2012-01-25 14:50:37 +0900 (44f8ed7)
+++ lib/logaling/glossary_db.rb    2012-01-25 15:38:51 +0900 (af95d68)
@@ -119,7 +119,7 @@ module Logaling
       end
     end
 
-    def list(glossary, source_language, target_language)
+    def translation_list(glossary, source_language, target_language)
       records_raw = Groonga["translations"].select do |record|
         [
           record.glossary == glossary,

  Modified: lib/logaling/repository.rb (+2 -2)
===================================================================
--- lib/logaling/repository.rb    2012-01-25 14:50:37 +0900 (72392e4)
+++ lib/logaling/repository.rb    2012-01-25 15:38:51 +0900 (2327b10)
@@ -60,12 +60,12 @@ module Logaling
       terms
     end
 
-    def list(glossary, source_language, target_language)
+    def show(glossary, source_language, target_language)
       raise GlossaryDBNotFound unless File.exist?(logaling_db_home)
 
       terms = []
       Logaling::GlossaryDB.open(logaling_db_home, "utf8") do |db|
-        terms = db.list(glossary, source_language, target_language)
+        terms = db.translation_list(glossary, source_language, target_language)
       end
       terms
     end

  Modified: spec/logaling/command_spec.rb (+5 -5)
===================================================================
--- spec/logaling/command_spec.rb    2012-01-25 14:50:37 +0900 (013df95)
+++ spec/logaling/command_spec.rb    2012-01-25 15:38:51 +0900 (79d2af2)
@@ -414,7 +414,7 @@ describe Logaling::Command do
     end
   end
 
-  describe "#list" do
+  describe "#show" do
     let(:csv_path) { File.join(File.dirname(glossary_path), "spec.ja.en.csv") }
     before do
       command.new('spec', 'en', 'ja')
@@ -429,10 +429,10 @@ describe Logaling::Command do
 
     context 'when .logaling exists' do
       before do
-        @stdout = capture(:stdout) {command.list}
+        @stdout = capture(:stdout) {command.show}
       end
 
-      it 'should show terms a list' do
+      it 'should show translation list' do
         @stdout.should include "spec"
         @stdout.should include "spec-test"
         @stdout.should include "spec-test-test"
@@ -443,10 +443,10 @@ describe Logaling::Command do
     context 'with arguments glossary' do
       before do
         command.options = base_options.merge("glossary" => "spec", "source-language" => "ja", "target-language" => "en")
-        @stdout = capture(:stdout) {command.list}
+        @stdout = capture(:stdout) {command.show}
       end
 
-      it 'should show terms a list' do
+      it 'should show translation list' do
         @stdout.should include "test_logaling"
         @stdout.should_not include "spec-test-test"
       end




More information about the logaling-commit mailing list
アーカイブの一覧に戻る