Class: Baseline::Install

Inherits:
Object
  • Object
show all
Defined in:
lib/baseline/install.rb

Constant Summary collapse

STUBS =
{
  ".rubocop.yml" => "    inherit_gem:\n      rubykatzen-baseline: config/rubocop.yml\n\n    # Generate project-specific excludes, then uncomment inherit_from below:\n    #   bundle exec rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000\n    # inherit_from:\n    #   - .rubocop_todo.yml\n  YAML\n  \".erb_lint.yml\" => <<~YAML,\n    inherit_gem:\n      rubykatzen-baseline: config/erb_lint.yml\n\n    # Find cops with violations, then create .erb_lint_todo.yml (see README):\n    #   bundle exec erb_lint --lint-all\n    # inherit_from:\n    #   - .erb_lint_todo.yml\n  YAML\n}.freeze\n",

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Install

Returns a new instance of Install.



26
27
28
# File 'lib/baseline/install.rb', line 26

def initialize(root)
  @root = root
end

Instance Method Details

#callObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/baseline/install.rb', line 30

def call
  STUBS.each do |relative_path, content|
    target = File.join(@root, relative_path)
    if File.exist?(target)
      warn "skip #{relative_path} (already exists)"
      next
    end

    File.write(target, content)
    warn "create #{relative_path}"
  end
end