Class: Dotsync::BaseConfig
- Inherits:
-
Object
- Object
- Dotsync::BaseConfig
- Includes:
- PathUtils
- Defined in:
- lib/dotsync/config/base_config.rb
Overview
BaseConfig serves as an abstract class to define the structure and validation rules for configuration files in the Dotsync system.
Direct Known Subclasses
Constant Summary
Constants included from PathUtils
Instance Method Summary collapse
-
#initialize(path = Dotsync.config_path) ⇒ BaseConfig
constructor
Initialize the BaseConfig with the provided path.
- #to_h ⇒ Object
Methods included from PathUtils
#colorize_env_vars, #expand_env_vars, #extract_env_vars, #path_is_parent_or_same?, #relative_to_absolute, #sanitize_path, #translate_tmp_path
Constructor Details
#initialize(path = Dotsync.config_path) ⇒ BaseConfig
Initialize the BaseConfig with the provided path. Loads the TOML configuration file and validates it. Uses ConfigCache for improved performance.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dotsync/config/base_config.rb', line 14 def initialize(path = Dotsync.config_path) absolute_path = File.(path) unless File.exist?(absolute_path) raise Dotsync::ConfigError, "Config file not found: #{absolute_path}\n\n" \ "To create a default configuration file, run:\n" \ " dotsync setup" end @config = load_config(absolute_path) validate! end |
Instance Method Details
#to_h ⇒ Object
28 29 30 |
# File 'lib/dotsync/config/base_config.rb', line 28 def to_h @config end |