Sha256: 16804023e49af96abc8a6886b2f48e3ba139e8d21c749c354f2c2ff7a7f9cd6f
Contents?: true
Size: 1.32 KB
Versions: 27
Compression:
Stored size: 1.32 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 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 if !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(ENV['FILESYSTEM_DIR']) end def terminal @terminal ||= HighLine.new($stdin, $stdout) end end end end
Version data entries
27 entries across 27 versions & 1 rubygems