[logaling-commit] logaling/logaling-command [loga-new-no-project] Enable to use glossary without .logaling as well as normal glossary

Back to archive index

null+****@clear***** null+****@clear*****
Wed Aug 8 23:24:30 JST 2012


SUZUKI Miho	2012-08-08 23:24:30 +0900 (Wed, 08 Aug 2012)

  New Revision: 3bb05326b423920dccd4d8d0a2f72cdd839178ef
  https://github.com/logaling/logaling-command/commit/3bb05326b423920dccd4d8d0a2f72cdd839178ef

  Log:
    Enable to use glossary without .logaling as well as normal glossary

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

  Modified: lib/logaling/project.rb (+4 -0)
===================================================================
--- lib/logaling/project.rb    2012-08-08 23:20:14 +0900 (810758c)
+++ lib/logaling/project.rb    2012-08-08 23:24:30 +0900 (87e6478)
@@ -87,5 +87,9 @@ module Logaling
       name, source_language, target_language, type = File.basename(@path).split(/\./)
       [GlossarySource.create(@path, glossary(source_language, target_language))]
     end
+
+    def glossary_source_path
+      File.dirname(@path)
+    end
   end
 end

  Modified: lib/logaling/repository.rb (+11 -0)
===================================================================
--- lib/logaling/repository.rb    2012-08-08 23:20:14 +0900 (107b9ea)
+++ lib/logaling/repository.rb    2012-08-08 23:24:30 +0900 (d0e784d)
@@ -90,6 +90,9 @@ module Logaling
       projects = registered_project_paths.map do |project_path|
         Logaling::Project.new(project_path, self)
       end
+      projects += user_glossary_paths.map do |user_glossary_path|
+        Logaling::ImportedProject.new(user_glossary_path, self)
+      end
       projects += imported_glossary_paths.map do |imported_project_path|
         Logaling::ImportedProject.new(imported_project_path, self)
       end
@@ -138,6 +141,10 @@ module Logaling
       File.join(@path, "projects")
     end
 
+    def logaling_user_glossaries_path
+      File.join(@path, "user_glossaries")
+    end
+
     def cache_path
       File.join(@path, "cache")
     end
@@ -146,6 +153,10 @@ module Logaling
       Dir[File.join(logaling_projects_path, "*")]
     end
 
+    def user_glossary_paths
+      Dir[File.join(logaling_user_glossaries_path, "*")]
+    end
+
     def imported_glossary_paths
       Dir[File.join(cache_path, "*")]
     end
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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