Class: EY::CLI::Recipes

Inherits:
Thor show all
Defined in:
lib/engineyard/cli/recipes.rb

Constant Summary

Constants inherited from Thor

Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::THOR_RESERVED_WORDS, Thor::UndefinedTaskError, Thor::VERSION

Instance Attribute Summary

Attributes included from Thor::Base

#args, #options, #parent_options

Instance Method Summary collapse

Methods inherited from Thor

check_unknown_options!, check_unknown_options?, command_help, default_command, desc, #help, help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommands

Methods included from Thor::Base

included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses

Instance Method Details

#applyObject



22
23
24
25
# File 'lib/engineyard/cli/recipes.rb', line 22

def apply
  environment = fetch_environment(options[:environment], options[:account])
  apply_recipes(environment)
end

#downloadObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/engineyard/cli/recipes.rb', line 110

def download
  if File.exist?('cookbooks')
    raise EY::Error, "Cannot download recipes, cookbooks directory already exists."
  end

  environment = fetch_environment(options[:environment], options[:account])

  recipes = environment.download_recipes
  cmd = "tar xzf '#{recipes.path}' cookbooks"

  if system(cmd)
    ui.info "Recipes downloaded successfully for #{environment.name}"
  else
    raise EY::Error, "Could not unarchive recipes.\nCommand `#{cmd}` exited with an error."
  end
end

#uploadObject



52
53
54
55
56
57
58
# File 'lib/engineyard/cli/recipes.rb', line 52

def upload
  environment = fetch_environment(options[:environment], options[:account])
  upload_recipes(environment, options[:file])
  if options[:apply]
    apply_recipes(environment)
  end
end