Class: Ey::Core::Cli::Recipes::Upload

Inherits:
Subcommand
  • Object
show all
Includes:
Helpers::Archive, Helpers::Chef
Defined in:
lib/ey-core/cli/recipes/upload.rb

Instance Method Summary collapse

Methods included from Helpers::Chef

#run_chef, #upload_recipes

Methods included from Helpers::Archive

#archive_directory, #gzip, #ungzip, #untar

Methods inherited from Subcommand

#handle_core_error, #run_handle, #setup

Methods included from Helpers::Core

#core_account, #core_accounts, #core_application_for, #core_applications, #core_client, #core_environment_for, #core_environment_variables, #core_environments, #core_operator_and_environment_for, #core_server_for, #core_url, #core_yaml, #eyrc_yaml, included, #longest_length_by_name, #operator, #unauthenticated_core_client, #write_core_yaml

Instance Method Details

#handleObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ey-core/cli/recipes/upload.rb', line 52

def handle
  operator, environment = core_operator_and_environment_for(options)
  path = option(:file) || "cookbooks/"

  puts "Uploading custom recipes for #{environment.name}".green

  begin
    upload_recipes(environment, path)
    puts "Uploading custom recipes complete".green
  rescue => e
    puts e.message
    abort "There was a problem uploading the recipes".red
  end

  if switch_active?(:apply)
    opts = {}
    opts[:no_wait] = switch_active?(:no_wait)
    opts[:verbose] = switch_active?(:verbose)
    opts[:watch]   = option(:watch)
    run_chef("main", environment, opts)
  end
end