SHIMADA Koji
null+****@clear*****
Wed Nov 21 15:34:35 JST 2012
SHIMADA Koji 2012-11-21 15:34:35 +0900 (Wed, 21 Nov 2012) New Revision: 1ce56306c95afa0d321399f36ee559e15c81b447 https://github.com/logaling/logaling-command/commit/1ce56306c95afa0d321399f36ee559e15c81b447 Merged 6a87d99: Merge pull request #90 from logaling/change-glossarysourcepath-fullpath-to-relativepath Log: Rename Repository#make_relative_path to #relative_path Modified files: lib/logaling/project.rb lib/logaling/repository.rb Modified: lib/logaling/project.rb (+2 -2) =================================================================== --- lib/logaling/project.rb 2012-11-21 15:27:48 +0900 (e7d49a7) +++ lib/logaling/project.rb 2012-11-21 15:34:35 +0900 (f44ccdb) @@ -65,7 +65,7 @@ module Logaling # relative_path_from_logaling_home みたいな名前でGlossarySourceにある方が良いかも... def relative_path(glossary_source_file_name) source_path = File.join(source_directory_path, glossary_source_file_name) - @repository.make_relative_path(source_path) + @repository.relative_path(source_path) end def glossary_db_path @@ -83,7 +83,7 @@ module Logaling def glossary_sources all_glossary_source_path.map do |source_path_full| name, source_language, target_language, type = File.basename(source_path_full).split(/\./) - source_path =****@repos*****_relative_path(source_path_full) + source_path =****@repos*****_path(source_path_full) GlossarySource.create(source_path, glossary(source_language, target_language)) end end Modified: lib/logaling/repository.rb (+6 -6) =================================================================== --- lib/logaling/repository.rb 2012-11-21 15:27:48 +0900 (d695f43) +++ lib/logaling/repository.rb 2012-11-21 15:34:35 +0900 (4965676) @@ -51,7 +51,7 @@ module Logaling if glossary_exists?(project_name, source_language, target_language) raise Logaling::GlossaryAlreadyRegistered, "The glossary '#{project_name}' already exists." end - personal_project_path = make_relative_path(personal_glossary_root_path) + personal_project_path = relative_path(personal_glossary_root_path) PersonalProject.create(personal_project_path, project_name, source_language, target_language, self) end @@ -59,7 +59,7 @@ module Logaling unless glossary_exists?(project_name, source_language, target_language) raise Logaling::GlossaryNotFound, "The glossary '#{project_name}' not found." end - personal_project_path = make_relative_path(personal_glossary_root_path) + personal_project_path = relative_path(personal_glossary_root_path) PersonalProject.remove(personal_project_path, project_name, source_language, target_language, self) index rescue Logaling::GlossaryNotFound => e @@ -113,13 +113,13 @@ module Logaling def projects projects = registered_project_paths.map do |project_path| - Logaling::Project.new(make_relative_path(project_path), self) + Logaling::Project.new(relative_path(project_path), self) end projects += personal_glossary_paths.map do |personal_glossary_path| - Logaling::PersonalProject.new(make_relative_path(personal_glossary_path), self) + Logaling::PersonalProject.new(relative_path(personal_glossary_path), self) end projects += imported_glossary_paths.map do |imported_project_path| - Logaling::ImportedProject.new(make_relative_path(imported_project_path), self) + Logaling::ImportedProject.new(relative_path(imported_project_path), self) end projects.sort_by(&:path) end @@ -172,7 +172,7 @@ module Logaling File.expand_path(File.join(@logaling_home, relative_path)) end - def make_relative_path(full_path) + def relative_path(full_path) require 'pathname' path = Pathname.new(full_path) base = Pathname.new(@logaling_home) -------------- next part -------------- An HTML attachment was scrubbed... ダウンロード