Class: Codeowners::Cli::InteractiveRunner

Inherits:
Object
  • Object
show all
Includes:
InteractiveOps
Defined in:
lib/codeowners/cli/interactive_runner.rb

Overview

Interactive session to resolve codeowners list issues

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from InteractiveOps

#ask, #yes?

Instance Attribute Details

#autocommit=(value) ⇒ Object (writeonly)

Sets the attribute autocommit

Parameters:

  • value

    the value to set the attribute autocommit to.



12
13
14
# File 'lib/codeowners/cli/interactive_runner.rb', line 12

def autocommit=(value)
  @autocommit = value
end

#default_owner=(value) ⇒ Object (writeonly)

Sets the attribute default_owner

Parameters:

  • value

    the value to set the attribute default_owner to.



12
13
14
# File 'lib/codeowners/cli/interactive_runner.rb', line 12

def default_owner=(value)
  @default_owner = value
end

#validate_owners=(value) ⇒ Object (writeonly)

Sets the attribute validate_owners

Parameters:

  • value

    the value to set the attribute validate_owners to.



12
13
14
# File 'lib/codeowners/cli/interactive_runner.rb', line 12

def validate_owners=(value)
  @validate_owners = value
end

Instance Method Details

#run_with(checker) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/codeowners/cli/interactive_runner.rb', line 14

def run_with(checker)
  resolver = InteractiveResolver.new(checker, @validate_owners, @default_owner)
  checker.fix!.each do |(error_type, inconsistencies, meta)|
    resolver.handle(error_type, inconsistencies, meta)
  end
  resolver.print_epilogue
  return unless resolver.made_changes?

  write_changes(checker)
  checker.commit_changes! if @autocommit || yes?('Commit changes?')
end