Module: Seo::CLI::Config

Defined in:
lib/seo/cli/config.rb

Constant Summary collapse

CONFIG_FILE =
".seo.yml"
DEFAULTS =
{
  "include" => [
    "**/*.html.erb",
    "**/*.html.haml",
    "**/*.html.slim",
    "**/*.html",
    "**/*.jinja",
    "**/*.jinja2",
    "**/*.twig",
    "**/*.blade.php",
    "**/*.njk"
  ],
  "exclude" => [
    "vendor/**",
    "node_modules/**",
    "tmp/**",
    ".git/**"
  ],
  "checks"   => %w[meta headings images links canonical opengraph schema],
  "provider" => "anthropic",
  "api_key"  => nil
}.freeze

Class Method Summary collapse

Class Method Details

.loadObject



33
34
35
36
37
38
39
# File 'lib/seo/cli/config.rb', line 33

def self.load
  if File.exist?(CONFIG_FILE)
    DEFAULTS.merge(YAML.safe_load_file(CONFIG_FILE) || {})
  else
    DEFAULTS
  end
end

.write_defaultObject



41
42
43
# File 'lib/seo/cli/config.rb', line 41

def self.write_default
  File.write(CONFIG_FILE, YAML.dump(DEFAULTS))
end