Sha256: d774fefdf274daa44a766aa9280f48f312dc5a1666729c4e2dc0668dbafc5bc0

Contents?: true

Size: 1.54 KB

Versions: 30

Compression:

Stored size: 1.54 KB

Contents

require 'ey-core/cli/subcommand'
require 'ey-core/cli/helpers/archive'

module Ey
  module Core
    module Cli
      module Recipes
        class Download < Ey::Core::Cli::Subcommand
          include Ey::Core::Cli::Helpers::Archive

          title "download"
          summary "Download a copy of the custom chef recipes from this environment into the current directory"

          description <<-DESC
The recipes will be unpacked into a directory called "cookbooks" in the
current directory. This is the opposite of 'recipes upload'.

If the cookbooks directory already exists, an error will be raised.
DESC

          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"

          def handle
            if File.exist?("cookbooks")
              raise Ey::Core::Cli::RecipesExist.new(
                "Cannot download recipes, cookbooks directory already exists."
              )
            end

            operator, environment = core_operator_and_environment_for(options)
            
            puts "Downloading recipes".green
            recipes = environment.download_recipes

            puts "Extracting recipes to 'cookbooks/'".green
            untar(ungzip(recipes), './')
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/cli/recipes/download.rb
ey-core-3.6.4 lib/ey-core/cli/recipes/download.rb
ey-core-3.6.3 lib/ey-core/cli/recipes/download.rb
ey-core-3.6.1 lib/ey-core/cli/recipes/download.rb
groove-ey-core-3.6.3 lib/ey-core/cli/recipes/download.rb
groove-ey-core-3.6.2 lib/ey-core/cli/recipes/download.rb
groove-ey-core-3.6.1 lib/ey-core/cli/recipes/download.rb
ey-core-3.5.0 lib/ey-core/cli/recipes/download.rb
ey-core-3.4.4 lib/ey-core/cli/recipes/download.rb
ey-core-3.4.2 lib/ey-core/cli/recipes/download.rb
ey-core-3.4.1 lib/ey-core/cli/recipes/download.rb
ey-core-3.4.0 lib/ey-core/cli/recipes/download.rb
ey-core-3.3.1 lib/ey-core/cli/recipes/download.rb
ey-core-3.3.0 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.6 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.5 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.4 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.3 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.2 lib/ey-core/cli/recipes/download.rb
ey-core-3.2.1 lib/ey-core/cli/recipes/download.rb