Class: Repository::ConfigStore
- Inherits:
-
Object
- Object
- Repository::ConfigStore
- Defined in:
- lib/devlogs/repository/config_store.rb
Constant Summary collapse
- CONFIG_FILE =
".devlogs.config.yml"
- DATA_FILE =
".devlogs.data.yml"
- ISSUE_TEMPLATE_FILE =
".issue_template.erb.md"
- LOG_TEMPLATE_FILE =
".log_template.erb.md"
- ISSUE_DIR =
"issues"
- DEFAULT_DIRECTORY_PATH =
"."
- DEFAULT_DIRECTORY_NAME =
".devlogs"
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Class Method Summary collapse
-
.load_from(path = File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) ⇒ Object
Initialization utility method.
Instance Method Summary collapse
-
#data_file_path ⇒ Object
Retrieves the data file.
-
#file_path ⇒ Object
Retrieves .devlogs.config.yml file path.
-
#initialize(dir: File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) ⇒ ConfigStore
constructor
A new instance of ConfigStore.
-
#issue_dir_path ⇒ Object
Issue directory path.
-
#issue_template_file_path ⇒ Object
The issue template file path:.
-
#template_file_path ⇒ Object
The template File.
- #values ⇒ Object
Constructor Details
#initialize(dir: File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) ⇒ ConfigStore
Returns a new instance of ConfigStore.
22 23 24 |
# File 'lib/devlogs/repository/config_store.rb', line 22 def initialize(dir: File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) @dir = dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
11 12 13 |
# File 'lib/devlogs/repository/config_store.rb', line 11 def dir @dir end |
Class Method Details
.load_from(path = File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) ⇒ Object
Initialization utility method
79 80 81 82 83 84 85 |
# File 'lib/devlogs/repository/config_store.rb', line 79 def load_from(path = File.join(DEFAULT_DIRECTORY_PATH, DEFAULT_DIRECTORY_NAME)) exists = File.exist?(path) raise "no repository found #{path}" unless exists new(dir: path) end |
Instance Method Details
#data_file_path ⇒ Object
Retrieves the data file
35 36 37 |
# File 'lib/devlogs/repository/config_store.rb', line 35 def data_file_path File.join(@dir, DATA_FILE) end |
#file_path ⇒ Object
Retrieves .devlogs.config.yml file path
44 45 46 |
# File 'lib/devlogs/repository/config_store.rb', line 44 def file_path File.join(@dir, CONFIG_FILE) end |
#issue_dir_path ⇒ Object
Issue directory path
71 72 73 |
# File 'lib/devlogs/repository/config_store.rb', line 71 def issue_dir_path File.join(@dir, ISSUE_DIR) end |
#issue_template_file_path ⇒ Object
The issue template file path:
62 63 64 |
# File 'lib/devlogs/repository/config_store.rb', line 62 def issue_template_file_path File.join(@dir, ISSUE_TEMPLATE_FILE) end |
#template_file_path ⇒ Object
The template File
FIXME: rename to log_template_file_path
53 54 55 |
# File 'lib/devlogs/repository/config_store.rb', line 53 def template_file_path File.join(@dir, LOG_TEMPLATE_FILE) end |
#values ⇒ Object
26 27 28 |
# File 'lib/devlogs/repository/config_store.rb', line 26 def values @values ||= load_values_from_config_file end |