[logaling-commit] logaling/logaling-command [loga-new-no-project] Change option '--no-project' to '--personal' and optimize valiable name

Back to archive index

null+****@clear***** null+****@clear*****
Thu Aug 9 15:23:20 JST 2012


SUZUKI Miho	2012-08-09 15:23:20 +0900 (Thu, 09 Aug 2012)

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

  Log:
    Change option '--no-project' to '--personal' and optimize valiable name

  Modified files:
    lib/logaling/command/application.rb
    lib/logaling/repository.rb

  Modified: lib/logaling/command/application.rb (+3 -3)
===================================================================
--- lib/logaling/command/application.rb    2012-08-09 15:04:09 +0900 (ffc1b91)
+++ lib/logaling/command/application.rb    2012-08-09 15:23:20 +0900 (a008f7f)
@@ -64,9 +64,9 @@ module Logaling::Command
 
     desc 'new [PROJECT NAME] [SOURCE LANGUAGE] [TARGET LANGUAGE(optional)]', 'Create .logaling'
     method_option "no-register", type: :boolean, default: false
-    method_option "no-project", type: :boolean, default: false
+    method_option "personal", type: :boolean, default: false
     def new(project_name, source_language, target_language=nil)
-      unless options['no-project']
+      unless options['personal']
         unless File.exist?(logaling_config_path)
           FileUtils.mkdir_p(File.join(logaling_config_path, "glossary"))
 
@@ -86,7 +86,7 @@ module Logaling::Command
         end
       else
         # raise error if target is nil 
-        @repository.create_user_glossary(project_name, source_language, target_language)
+        @repository.create_personal_glossary(project_name, source_language, target_language)
       end
     end
 

  Modified: lib/logaling/repository.rb (+9 -9)
===================================================================
--- lib/logaling/repository.rb    2012-08-09 15:04:09 +0900 (6ed91ad)
+++ lib/logaling/repository.rb    2012-08-09 15:23:20 +0900 (f589157)
@@ -44,10 +44,10 @@ module Logaling
       FileUtils.rm_rf(project.path, :secure => true)
     end
 
-    def create_user_glossary(glossary_name, source_language, target_language)
-      FileUtils.mkdir_p(logaling_user_glossaries_path)
+    def create_personal_glossary(glossary_name, source_language, target_language)
+      FileUtils.mkdir_p(personal_path)
       glossary_source_name = [glossary_name, source_language, target_language,'yml'].join('.')
-      FileUtils.touch(File.join(logaling_user_glossaries_path, glossary_source_name))
+      FileUtils.touch(File.join(personal_path, glossary_source_name))
       # raise error if already file exist
       # raise error if same file in /projects
     end
@@ -90,8 +90,8 @@ 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::PersonalProject.new(user_glossary_path, self)
+      projects += personal_glossary_paths.map do |personal_glossary_path|
+        Logaling::PersonalProject.new(personal_glossary_path, self)
       end
       projects += imported_glossary_paths.map do |imported_project_path|
         Logaling::ImportedProject.new(imported_project_path, self)
@@ -141,8 +141,8 @@ module Logaling
       File.join(@path, "projects")
     end
 
-    def logaling_user_glossaries_path
-      File.join(@path, "user_glossaries")
+    def personal_path
+      File.join(@path, "personal")
     end
 
     def cache_path
@@ -153,8 +153,8 @@ module Logaling
       Dir[File.join(logaling_projects_path, "*")]
     end
 
-    def user_glossary_paths
-      Dir[File.join(logaling_user_glossaries_path, "*")]
+    def personal_glossary_paths
+      Dir[File.join(personal_path, "*")]
     end
 
     def imported_glossary_paths
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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