Sha256: 7571d00339e7dce7d38bba94b9eb7e5000486f6a46d1ed146931354bde6fb823
Contents?: true
Size: 1.54 KB
Versions: 9
Compression:
Stored size: 1.54 KB
Contents
require "highline" require "active_support" require "active_support/core_ext" require "rainbow" module CC module CLI class Command CODECLIMATE_YAML = ".codeclimate.yml".freeze def initialize(args = []) @args = args end def run $stderr.puts "unknown command #{self.class.name.split('::').last.underscore}" end def self.command_name name[/[^:]*$/].split(/(?=[A-Z])/).map(&:downcase).join("-") end def execute run end def success(message) terminal.say colorize(message, :green) end def say(message) terminal.say message end def warn(message) terminal.say(colorize("WARNING: #{message}", :yellow)) end def fatal(message) $stderr.puts colorize(message, :red) exit 1 end def require_codeclimate_yml unless filesystem.exist?(CODECLIMATE_YAML) fatal("No '.codeclimate.yml' file found. Run 'codeclimate init' to generate a config file.") end end private def colorize(string, *args) rainbow.wrap(string).color(*args) end def rainbow @rainbow ||= Rainbow.new end def filesystem @filesystem ||= CC::Analyzer::Filesystem.new( CC::Analyzer::MountedPath.code.container_path ) end def terminal @terminal ||= HighLine.new($stdin, $stdout) end def engine_registry @engine_registry ||= CC::Analyzer::EngineRegistry.new end end end end
Version data entries
9 entries across 9 versions & 1 rubygems