[logaling-commit] logaling/logaling-command [change-glossarysourcepath-fullpath-to-relativepath] Add Project#relative_path

Back to archive index

SHIMADA Koji null+****@clear*****
Wed Nov 21 14:18:18 JST 2012


SHIMADA Koji	2012-11-21 14:18:18 +0900 (Wed, 21 Nov 2012)

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

  Log:
    Add Project#relative_path

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

  Modified: lib/logaling/glossary.rb (+3 -4)
===================================================================
--- lib/logaling/glossary.rb    2012-11-21 14:11:02 +0900 (3097e76)
+++ lib/logaling/glossary.rb    2012-11-21 14:18:18 +0900 (f92a11a)
@@ -83,11 +83,10 @@ module Logaling
       if @glossary_source
         @glossary_source
       else
+        FileUtils.mkdir_p(@project.source_directory_path)
+
         file_name = [@name, @source_language, @target_language, 'yml'].join('.')
-        source_dir =****@proje*****_directory_path
-        FileUtils.mkdir_p(source_dir)
-        source_path_full = File.join(source_dir, file_name)
-        source_path =****@proje*****_relative_path(source_path_full)
+        source_path =****@proje*****_path(file_name)
         @glossary_source = Logaling::GlossarySource.create(source_path, self)
       end
     end

  Modified: lib/logaling/project.rb (+5 -0)
===================================================================
--- lib/logaling/project.rb    2012-11-21 14:11:02 +0900 (80cbb79)
+++ lib/logaling/project.rb    2012-11-21 14:18:18 +0900 (264430b)
@@ -63,6 +63,11 @@ module Logaling
     end
     alias_method :source_directory_path, :glossary_source_path
 
+    def relative_path(glossary_source_file_name)
+      source_path = File.join(source_directory_path, glossary_source_file_name)
+      @repository.make_relative_path(source_path)
+    end
+
     def glossary_db_path
       @repository.logaling_db_home
     end
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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