Module: Keela::ConfigFile
- Defined in:
- lib/keela/config_file.rb
Overview
Loads configuration from a YAML file.
Looks for config files in this order:
1. keela.yml
2. .keela.yml
Supported keys:
- extensions: Array of file extensions to scan
- directory_patterns: Array of glob patterns for directories to scan
- exclude_patterns: Array of glob patterns for files to exclude
- excluded_path: Path to YAML file of excluded items
- baseline_path: Path to baseline YAML file
- required_directory: Directory that must exist for scanning to proceed
Example:
# keela.yml
directory_patterns:
- "app/**/*.%<ext>s"
- "lib/**/*.%<ext>s"
- "ee/app/**/*.%<ext>s"
- "ee/lib/**/*.%<ext>s"
extensions:
- rb
- haml
- erb
Constant Summary collapse
- CONFIG_FILENAMES =
%w[keela.yml .keela.yml].freeze
- ALLOWED_KEYS =
%w[ extensions directory_patterns include_patterns exclude_patterns excluded_path baseline_path required_directory ].freeze
Class Method Summary collapse
-
.load(path: nil) ⇒ Boolean
Load configuration from a YAML file.
Class Method Details
.load(path: nil) ⇒ Boolean
Load configuration from a YAML file.
52 53 54 55 56 57 58 59 |
# File 'lib/keela/config_file.rb', line 52 def load(path: nil) config_path = path || find_config_file return false unless config_path && File.exist?(config_path) config = YAML.load_file(config_path) || {} apply_config(config) true end |