lib/cc/cli/prepare.rb in codeclimate-0.69.0 vs lib/cc/cli/prepare.rb in codeclimate-0.70.0

- old
+ new

@@ -1,14 +1,14 @@ -require "cc/cli/config" -require "cc/resolv" require "fileutils" require "ipaddr" require "json" require "net/http" require "pathname" require "uri" +require "cc/resolv" + module CC module CLI class Prepare < Command ARGUMENT_LIST = "[--allow-internal-ips]".freeze SHORT_HELP = "Run the commands in your prepare step.".freeze @@ -27,17 +27,11 @@ IPAddr.new("127.0.0.1"), IPAddr.new("0:0:0:0:0:0:0:1"), ].freeze 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") + ::CC::Resolv.with_fixed_dns { fetch_all } rescue FetchError, InternalHostError => ex fatal(ex.message) end private @@ -45,14 +39,14 @@ def allow_internal_ips? @args.include?("--allow-internal-ips") end def fetches - @fetches ||= config[:prepare] && config[:prepare].fetch + @fetches ||= config.prepare.fetch end def config - @config ||= CC::Yaml.parse(filesystem.read_path(CODECLIMATE_YAML)) + @config ||= CC::Config.load end def fetch_all fetches.each do |entry| fetch(entry.url, entry.path)