[logaling-commit] logaling/logaling-command [refactor-structure] Add ImpoertedProject class

Back to archive index

null+****@clear***** null+****@clear*****
Tue Jun 19 16:23:11 JST 2012


SUZUKI Miho	2012-06-19 16:23:11 +0900 (Tue, 19 Jun 2012)

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

  Log:
    Add ImpoertedProject class

  Modified files:
    lib/logaling/project.rb
    lib/logaling/repository.rb

  Modified: lib/logaling/project.rb (+6 -0)
===================================================================
--- lib/logaling/project.rb    2012-06-18 12:41:19 +0900 (0d8a227)
+++ lib/logaling/project.rb    2012-06-19 16:23:11 +0900 (78ce56b)
@@ -38,4 +38,10 @@ module Logaling
       @repository.logaling_db_home
     end
   end
+
+  class ImportedProject < Project
+    def name
+      File.basename(@path).split(/\./).first
+    end
+  end
 end

  Modified: lib/logaling/repository.rb (+5 -1)
===================================================================
--- lib/logaling/repository.rb    2012-06-18 12:41:19 +0900 (9318b17)
+++ lib/logaling/repository.rb    2012-06-19 16:23:11 +0900 (2ee860f)
@@ -79,9 +79,13 @@ module Logaling
     end
 
     def projects
-      (imported_glossaries | registered_projects).sort.map do |project_path|
+      projects = registered_projects.map do |project_path|
         Logaling::Project.new(project_path, self)
       end
+      projects += imported_glossaries.map do |imported_project_path|
+        Logaling::ImportedProject.new(imported_project_path, self)
+      end
+      projects.sort_by(&:path)
     end
 
     def index
-------------- next part --------------
An HTML attachment was scrubbed...
下載 



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