Class: Workbush::Config
- Inherits:
-
Object
- Object
- Workbush::Config
- Defined in:
- lib/workbush/config.rb
Overview
Handles loading and parsing .workbush.yml configuration files
Constant Summary collapse
- DEFAULT_CONFIG_NAME =
".workbush.yml"
Instance Attribute Summary collapse
-
#copy_directories ⇒ Object
readonly
Returns the value of attribute copy_directories.
-
#copy_files ⇒ Object
readonly
Returns the value of attribute copy_files.
-
#copy_patterns ⇒ Object
readonly
Returns the value of attribute copy_patterns.
-
#post_create_commands ⇒ Object
readonly
Returns the value of attribute post_create_commands.
Class Method Summary collapse
-
.default_template ⇒ String
Generate a default configuration template.
Instance Method Summary collapse
-
#config_exists? ⇒ Boolean
Check if a configuration file was found.
-
#initialize(config_path: nil) ⇒ Config
constructor
Initialize a new Config instance.
Constructor Details
#initialize(config_path: nil) ⇒ Config
Initialize a new Config instance
17 18 19 20 |
# File 'lib/workbush/config.rb', line 17 def initialize(config_path: nil) @config_path = config_path || find_config_file load_config end |
Instance Attribute Details
#copy_directories ⇒ Object (readonly)
Returns the value of attribute copy_directories.
12 13 14 |
# File 'lib/workbush/config.rb', line 12 def copy_directories @copy_directories end |
#copy_files ⇒ Object (readonly)
Returns the value of attribute copy_files.
12 13 14 |
# File 'lib/workbush/config.rb', line 12 def copy_files @copy_files end |
#copy_patterns ⇒ Object (readonly)
Returns the value of attribute copy_patterns.
12 13 14 |
# File 'lib/workbush/config.rb', line 12 def copy_patterns @copy_patterns end |
#post_create_commands ⇒ Object (readonly)
Returns the value of attribute post_create_commands.
12 13 14 |
# File 'lib/workbush/config.rb', line 12 def post_create_commands @post_create_commands end |
Class Method Details
.default_template ⇒ String
Generate a default configuration template
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/workbush/config.rb', line 32 def self.default_template <<~YAML # Files to copy (exact paths relative to worktree root) copy_files: - .env - .env.local - mise.local.toml - config/database.yml # Glob patterns for copying multiple files copy_patterns: - ".env.*" - "*.lock" # Directories to copy copy_directories: - node_modules - vendor/bundle # Commands to run after worktree creation post_create_commands: - mise trust - bundle install - yarn install YAML end |
Instance Method Details
#config_exists? ⇒ Boolean
Check if a configuration file was found
25 26 27 |
# File 'lib/workbush/config.rb', line 25 def config_exists? !@config_path.nil? && File.exist?(@config_path) end |