[logaling-commit] logaling/logaling-command [master] change list command to use Repository#projects

Back to archive index

null+****@clear***** null+****@clear*****
Thu Jun 28 12:02:20 JST 2012


SUZUKI Miho	2012-06-04 19:56:43 +0900 (Mon, 04 Jun 2012)

  New Revision: 6d8f87c0122c63895f0acf70c7127c4f46f09ad6
  https://github.com/logaling/logaling-command/commit/6d8f87c0122c63895f0acf70c7127c4f46f09ad6

  Merged 7228757: Merge pull request #60 from logaling/refactor-structure

  Log:
    change list command to use Repository#projects

  Modified files:
    lib/logaling/command/application.rb
    lib/logaling/repository.rb

  Modified: lib/logaling/command/application.rb (+4 -5)
===================================================================
--- lib/logaling/command/application.rb    2012-06-04 19:54:12 +0900 (bf904f5)
+++ lib/logaling/command/application.rb    2012-06-04 19:56:43 +0900 (1c0d12a)
@@ -297,16 +297,15 @@ module Logaling::Command
     def list
       check_logaling_home_exists
       @repository.index
-      glossaries =****@repos*****
-      unless glossaries.empty?
+      projects =****@repos*****
+      unless projects.empty?
         run_pager
-        glossaries.each do |glossary|
-          printf("  %s\n", glossary)
+        projects.each do |project|
+          printf("  %s\n", project.name)
         end
       else
         "There is no registered glossary."
       end
-
     rescue Logaling::CommandFailed, Logaling::GlossaryDBNotFound => e
       say e.message
     end

  Modified: lib/logaling/repository.rb (+4 -7)
===================================================================
--- lib/logaling/repository.rb    2012-06-04 19:54:12 +0900 (145686b)
+++ lib/logaling/repository.rb    2012-06-04 19:56:43 +0900 (f18a527)
@@ -17,6 +17,7 @@
 
 require "fileutils"
 require "logaling/glossary_db"
+require "logaling/project"
 
 module Logaling
   class Repository
@@ -91,14 +92,10 @@ module Logaling
       terms
     end
 
-    def list
-      raise Logaling::GlossaryDBNotFound unless File.exist?(logaling_db_home)
-
-      glossaries = []
-      Logaling::GlossaryDB.open(logaling_db_home, "utf8") do |db|
-        glossaries = db.get_all_glossary
+    def projects
+      registered_projects.map do |project_name|
+        Logaling::Project.new(project_name)
       end
-      glossaries
     end
 
     def index
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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