Class: Baseline::Install

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

Constant Summary collapse

STUBS =
{
  ".rubocop.yml" => <<~YAML,
  ".erb_lint.yml" => <<~YAML
    inherit_gem:
      rubykatzen-baseline: config/erb_lint.yml

    # Generate .erb_lint_todo.yml, then uncomment inherit_from below:
    #   bundle exec erb_lint --enable-all-linters --lint-all
    # inherit_from:
    #   - .erb_lint_todo.yml
  YAML
}.freeze

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