[logaling-commit] logaling/logaling-command [change-glossarysourcepath-fullpath-to-relativepath] Extract FileBasedProject class

Back to archive index

SHIMADA Koji null+****@clear*****
Wed Nov 21 15:27:48 JST 2012


SHIMADA Koji	2012-11-21 15:27:48 +0900 (Wed, 21 Nov 2012)

  New Revision: 98af45220e5de929b07d6516da1cf47cee18933a
  https://github.com/logaling/logaling-command/commit/98af45220e5de929b07d6516da1cf47cee18933a

  Log:
    Extract FileBasedProject class

  Modified files:
    lib/logaling/project.rb

  Modified: lib/logaling/project.rb (+10 -34)
===================================================================
--- lib/logaling/project.rb    2012-11-21 15:19:26 +0900 (a5f5a0c)
+++ lib/logaling/project.rb    2012-11-21 15:27:48 +0900 (e7d49a7)
@@ -118,7 +118,7 @@ module Logaling
     end
   end
 
-  class ImportedProject < Project
+  class FileBasedProject < Project
     def name
       File.basename(@path).split(/\./).first
     end
@@ -133,13 +133,10 @@ module Logaling
       glossary_source_language == source_language && glossary_target_language == target_language
     end
 
-    def glossary_source_path
+    def expand_path
       @repository.expand_path(@path)
     end
-
-    def imported?
-      true
-    end
+    alias_method :glossary_source_path, :expand_path
 
     def normal_project?
       false
@@ -150,7 +147,13 @@ module Logaling
     end
   end
 
-  class PersonalProject < Project
+  class ImportedProject < FileBasedProject
+    def imported?
+      true
+    end
+  end
+
+  class PersonalProject < FileBasedProject
     class << self
       def create(relative_root_path, glossary_name, source_language, target_language, repository=nil)
         project_name = [glossary_name, source_language, target_language, 'yml'].join('.')
@@ -169,25 +172,6 @@ module Logaling
       end
     end
 
-    def name
-      File.basename(@path).split(/\./).first
-    end
-
-    def glossary_sources
-      name, source_language, target_language, type = File.basename(@path).split(/\./)
-      [GlossarySource.create(@path, glossary(source_language, target_language))]
-    end
-
-    def has_glossary?(source_language, target_language)
-      glossary_source_language, glossary_target_language = File.basename(@path).split(/\./)[1..2]
-      glossary_source_language == source_language && glossary_target_language == target_language
-    end
-
-    def expand_path
-      @repository.expand_path(@path)
-    end
-    alias_method :glossary_source_path, :expand_path
-
     def initialize_glossary(source_language, target_language)
       glossary(source_language, target_language).initialize_glossary_source
     end
@@ -195,13 +179,5 @@ module Logaling
     def personal?
       true
     end
-
-    def normal_project?
-      false
-    end
-
-    def source_directory_path
-      File.dirname(glossary_source_path)
-    end
   end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
下載 



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