Class: CC::CLI::Init

Inherits:
Command show all
Includes:
Analyzer
Defined in:
lib/cc/cli/init.rb

Constant Summary

Constants included from Analyzer

Analyzer::UnreadableFileError

Constants inherited from Command

Command::CODECLIMATE_YAML

Instance Method Summary collapse

Methods inherited from Command

command_name, #execute, #fatal, #initialize, #require_codeclimate_yml, #say, #success, #warn

Constructor Details

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

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cc/cli/init.rb', line 10

def run
  if !upgrade? && filesystem.exist?(CODECLIMATE_YAML)
    warn "Config file .codeclimate.yml already present.\nTry running 'validate-config' to check configuration."
    create_default_engine_configs if engines_enabled?
  elsif upgrade? && engines_enabled?
    warn "Config file .codeclimate.yml already configured for the Platform.\nTry running 'validate-config' to check configuration."
    create_default_engine_configs
  else
    generate_all_config
  end
end