Class: Logaling::PersonalProject

Inherits:
FileBasedProject show all
Defined in:
lib/logaling/project.rb

Instance Attribute Summary

Attributes inherited from Project

#path, #repository

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FileBasedProject

#absolute_path, #bilingualr_pair, #glossary_sources, #has_glossary?, #name, #normal_project?, #source_directory_path

Methods inherited from Project

find_dotfile, find_path, #glossaries, #glossary, #glossary_db_path, #glossary_source_path, #glossary_sources, #has_glossary?, #imported?, #initialize, #name, #normal_project?, #relative_path, #same?, #type

Constructor Details

This class inherits a constructor from Logaling::Project

Class Method Details

.create(relative_root_path, glossary_name, source_language, target_language, repository = nil) ⇒ Object



180
181
182
183
184
185
186
# File 'lib/logaling/project.rb', line 180

def create(relative_root_path, glossary_name, source_language, target_language, repository=nil)
  project_name = [glossary_name, source_language, target_language, 'yml'].join('.')
  project_path = File.join(relative_root_path, project_name)
  project = PersonalProject.new(project_path, repository)
  project.initialize_glossary(source_language, target_language)
  project
end

.remove(relative_root_path, glossary_name, source_language, target_language, repository) ⇒ Object



188
189
190
191
192
193
194
# File 'lib/logaling/project.rb', line 188

def remove(relative_root_path, glossary_name, source_language, target_language, repository)
  project_name = [glossary_name, source_language, target_language, 'yml'].join('.')
  project_path = File.join(relative_root_path, project_name)
  project = PersonalProject.new(project_path, repository)
  FileUtils.rm_rf(repository.expand_path(project_path), :secure => true)
  project
end

Instance Method Details

#initialize_glossary(source_language, target_language) ⇒ Object



197
198
199
# File 'lib/logaling/project.rb', line 197

def initialize_glossary(source_language, target_language)
  glossary(source_language, target_language).initialize_glossary_source
end

#personal?Boolean

Returns:

  • (Boolean)


201
202
203
# File 'lib/logaling/project.rb', line 201

def personal?
  true
end