Class: CC::CLI::Prepare

Inherits:
Command show all
Defined in:
lib/cc/cli/prepare.rb

Constant Summary collapse

InternalHostError =
Class.new(StandardError)
FetchError =
Class.new(StandardError)
PRIVATE_ADDRESS_SUBNETS =
[
  IPAddr.new("10.0.0.0/8"),
  IPAddr.new("172.16.0.0/12"),
  IPAddr.new("192.168.0.0/16"),
  IPAddr.new("fd00::/8"),
  IPAddr.new("127.0.0.1"),
  IPAddr.new("0:0:0:0:0:0:0:1"),
].freeze

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



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cc/cli/prepare.rb', line 25

def run
  require_codeclimate_yml
  fatal("No fetches configured") unless fetches.present?

  Dir.chdir(CC::Analyzer::MountedPath.code.container_path) do
    ::CC::Resolv.with_fixed_dns { fetch_all }
  end
  success("All fetches fetched")
rescue FetchError, InternalHostError => ex
  fatal(ex.message)
end