Class: RubocopPr::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_pr/cli.rb,
lib/rubocop_pr/cli/process_cop.rb

Overview

Cunner from CLI interface

Defined Under Namespace

Classes: ProcessCop

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = []) ⇒ CLI

Returns a new instance of CLI.



8
9
10
11
12
13
# File 'lib/rubocop_pr/cli.rb', line 8

def initialize(argv = [])
  @options = Options.new(argv).parse
  @git = Git.new(post_checkout: @options.post_checkout, origin: @options.git_origin)
  @repository = Repository.all.fetch(@options.repository)
  @rubocop = RubocopPr::Rubocop.new(branch: @options.rubocop_todo_branch, git: @git)
end

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



6
7
8
# File 'lib/rubocop_pr/cli.rb', line 6

def git
  @git
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/rubocop_pr/cli.rb', line 6

def options
  @options
end

#repositoryObject (readonly)

Returns the value of attribute repository.



6
7
8
# File 'lib/rubocop_pr/cli.rb', line 6

def repository
  @repository
end

#rubocopObject (readonly)

Returns the value of attribute rubocop.



6
7
8
# File 'lib/rubocop_pr/cli.rb', line 6

def rubocop
  @rubocop
end

Instance Method Details

#run!Object



15
16
17
18
19
20
# File 'lib/rubocop_pr/cli.rb', line 15

def run!
  EnvironmentChecker.call(repository, options)
  run
  git.checkout Rubocop::TODO_FILENAME
  git.checkout(options.master_branch)
end