Class: CC::CLI::Engines::Disable

Inherits:
EngineCommand show all
Defined in:
lib/cc/cli/engines/disable.rb

Constant Summary collapse

ARGUMENT_LIST =
"<engine_name>".freeze
SHORT_HELP =
"Disable an engine in your codeclimate.yml.".freeze
HELP =
"#{SHORT_HELP}\n" \
"\n"\
"    <engine_name>    Engine to disable in your codeclimate.yml".freeze

Constants included from Analyzer

Analyzer::UnreadableFileError

Constants inherited from Command

Command::CODECLIMATE_YAML, Command::NAMESPACE

Instance Method Summary collapse

Methods inherited from Command

[], abstract!, abstract?, all, command_name, #execute, help, inherited, #initialize, #require_codeclimate_yml, short_help, synopsis

Methods included from Output

#colorize, #fatal, #rainbow, #say, #success, #terminal, #warn

Constructor Details

This class inherits a constructor from CC::CLI::Command

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cc/cli/engines/disable.rb', line 14

def run
  require_codeclimate_yml

  if !engine_exists?
    say "Engine not found. Run 'codeclimate engines:list' for a list of valid engines."
  elsif !engine_present_in_yaml?
    say "Engine not found in .codeclimate.yml."
  elsif !engine_enabled?
    say "Engine already disabled."
  else
    disable_engine
    update_yaml
    say "Engine disabled."
  end
end