Sha256: ddd87d7103a2b2a1731ac72600e8b2550574b2abe99df98511bc8186f196ca3e

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

class Ey::Core::Cli::Recipes::Upload < Ey::Core::Cli::Recipes
  title "upload"
  summary "Upload custom recipes to an environment"
  option :environment, short: "e", long: "environment", description: "Environment that will receive the recipes.", argument: "environment"
  option :account,     short: "c", long: "account",     description: "Name of the account in which the environment can be found.", argument: "account"
  option :file,        short: "f", long: "file",        description: "Path to recipes", argument: "path"

  switch :apply, short: "a", long: "apply", description: "Apply the recipes immediately after they are uploaded"

  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
      abort "There was a problem uploading the recipes".red
      puts e.inspect
    end

    if switch_active?(:apply)
      run_chef("custom", environment)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ey-core-3.1.2 lib/ey-core/cli/recipes/upload.rb
ey-core-3.1.1 lib/ey-core/cli/recipes/upload.rb
ey-core-3.1.0 lib/ey-core/cli/recipes/upload.rb