Class: Repository
- Inherits:
-
Object
- Object
- Repository
- Includes:
- TimeHelper
- Defined in:
- lib/devlogs/repository.rb,
lib/devlogs/repository/config.rb,
lib/devlogs/repository/initializer.rb,
lib/devlogs/repository/config_store.rb,
lib/devlogs/repository/sync_manager.rb,
lib/devlogs/repository/config_builder.rb
Overview
FIXME: Create module
Defined Under Namespace
Classes: Config, ConfigBuilder, ConfigStore, Initializer, SyncManager
Constant Summary
Constants included from TimeHelper
TimeHelper::TIME_FORMAT_FILE_PREFIX
Class Method Summary collapse
-
.load(path = File.join(Repository::ConfigStore::DEFAULT_DIRECTORY_PATH, Repository::ConfigStore::DEFAULT_DIRECTORY_NAME)) ⇒ Object
Loads a repository from the provided path.
Instance Method Summary collapse
-
#create ⇒ Object
Creates a new .devlogs entry for recording session completion.
- #create_issue ⇒ Object
-
#initialize(repo_config_store) ⇒ Repository
constructor
Initializes a .devlogs repository with the supplied configuration.
-
#ls(direction = :desc) ⇒ Object
Lists the files in the repository.
-
#ls_issues(direction = :desc) ⇒ Object
Lists the issues in the repository.
-
#sync ⇒ Object
Syncs the directory changes to the (optional) mirror repository specified in the configuration.
Methods included from TimeHelper
Constructor Details
#initialize(repo_config_store) ⇒ Repository
Initializes a .devlogs repository with the supplied configuration
21 22 23 24 |
# File 'lib/devlogs/repository.rb', line 21 def initialize(repo_config_store) @config_store = repo_config_store @repo_config = @config_store.values end |
Class Method Details
.load(path = File.join(Repository::ConfigStore::DEFAULT_DIRECTORY_PATH, Repository::ConfigStore::DEFAULT_DIRECTORY_NAME)) ⇒ Object
Loads a repository from the provided path
70 71 72 73 74 |
# File 'lib/devlogs/repository.rb', line 70 def load(path = File.join(Repository::ConfigStore::DEFAULT_DIRECTORY_PATH, Repository::ConfigStore::DEFAULT_DIRECTORY_NAME)) store = Repository::ConfigStore.load_from(path) new(store) end |
Instance Method Details
#create ⇒ Object
Creates a new .devlogs entry for recording session completion
29 30 31 32 33 34 35 |
# File 'lib/devlogs/repository.rb', line 29 def create entry_file_path = log_manager.create Editor.open(entry_file_path) puts "Writing entry to #{entry_file_path}.." end |
#create_issue ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/devlogs/repository.rb', line 39 def create_issue issue_file_path = issue_manager.create Editor.open(issue_file_path) puts "Writing issue to #{issue_file_path}.." end |
#ls(direction = :desc) ⇒ Object
Lists the files in the repository
56 57 58 |
# File 'lib/devlogs/repository.rb', line 56 def ls(direction = :desc) log_manager.list(direction) end |
#ls_issues(direction = :desc) ⇒ Object
Lists the issues in the repository
61 62 63 |
# File 'lib/devlogs/repository.rb', line 61 def ls_issues(direction = :desc) issue_manager.list(direction) end |
#sync ⇒ Object
Syncs the directory changes to the (optional) mirror repository specified in the configuration.
51 52 53 |
# File 'lib/devlogs/repository.rb', line 51 def sync sync_manager.run if @repo_config.mirror? end |