class EY::CLI::Recipes
Public Instance Methods
apply()
click to toggle source
# File lib/engineyard/cli/recipes.rb, line 22 def apply environment = fetch_environment(options[:environment], options[:account]) apply_recipes(environment) end
apply_recipes(environment)
click to toggle source
# File lib/engineyard/cli/recipes.rb, line 61 def apply_recipes(environment) environment.run_custom_recipes ui.info "Uploaded recipes started for #{environment.name}" end
cookbooks_dir_archive_path()
click to toggle source
# File lib/engineyard/cli/recipes.rb, line 77 def cookbooks_dir_archive_path unless FileTest.exist?("cookbooks") raise EY::Error, "Could not find chef recipes. Please run from the root of your recipes repo." end recipes_file = Tempfile.new("recipes") cmd = "tar czf '#{recipes_file.path}' cookbooks/" if FileTest.exist?("data_bags") cmd = cmd + " data_bags/" end unless system(cmd) raise EY::Error, "Could not archive recipes.\nCommand `#{cmd}` exited with an error." end recipes_file.path end
download()
click to toggle source
# 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
upload()
click to toggle source
# 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
upload_recipes(environment, filename)
click to toggle source
# File lib/engineyard/cli/recipes.rb, line 66 def upload_recipes(environment, filename) if filename && filename != '' environment.upload_recipes_at_path(filename) ui.info "Recipes file #{filename} uploaded successfully for #{environment.name}" else path = cookbooks_dir_archive_path environment.upload_recipes_at_path(path) ui.info "Recipes in cookbooks/ uploaded successfully for #{environment.name}" end end