Module: RubyLens::DefaultOutput

Defined in:
lib/rubylens/default_output.rb

Overview

Safety policy shared by every generator's default output path: an existing file is only replaced when the given check recognizes it as our own kind of artifact, and the path plus its temporary-file pattern are added to the repository's local Git excludes.

Class Method Summary collapse

Class Method Details

.resolve(root:, name:, description:) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/rubylens/default_output.rb', line 14

def resolve(root:, name:, description:)
  output = File.join(root, name)
  if File.exist?(output) && !yield(output)
    raise Error, "default #{description} path already exists and is not a RubyLens #{description}"
  end

  GitRepository.new(root).exclude_local(output, description: description)
  output
end