exe/ddev in ddev-0.1.1 vs exe/ddev in ddev-0.1.2

- old
+ new

@@ -1,10 +1,11 @@ #!/usr/bin/env ruby require "thor" require "pty" require "rainbow" +require "config" require_relative "../lib/ddev/version" module Ddev class CLI < Thor @@ -47,10 +48,12 @@ end desc "push", "Upload locally built images to the remote store" option :env, default: "dev", type: :string def push(*images) + load_config! + env = options[:env] images = ALL_IMAGES[env] if images.empty? images = Array(images) push_cmds = [] @@ -201,9 +204,39 @@ if host = ENV["DOCKER_HOST_IP"] opts += " --host tcp://#{host}" end opts + end + + def config_path + path = File.expand_path "../.ddev.yaml", __FILE__ + + unless File.exist? path + raise "Could not find config file at #{path}" + end + + path + end + + def check_settings! + required_keys = %w( + project + ) + + required_keys.each do |key| + unless Settings.send key + error = "Config is missing required key '#{key}'. Please add it " \ + "to #{config_path} and try again." + puts Rainbow(error).red + exit 1 + end + end + end + + def load_config! + Config.load_and_set_settings(config_path) + check_settings! end end end end