Sha256: 1e670baa92b985e49369d4976abd0a86e2f989901eb3dcf90a0a610194ee6870

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module AcquiaToolbelt
  class CLI
    class Files < AcquiaToolbelt::Thor
      # Public: Copy files from one environment to another.
      #
      # Returns a status message from the task.
      desc "copy", "Copy files from one environment to another."
       method_option :origin, :type => :string, :aliases => %w(-o), :required => true,
        :desc => "Source environment for the file copy."
      method_option :target, :type => :string, :aliases => %w(-t), :required => true,
        :desc => "Target environment for the file copy."
      def copy
        if options[:subscription]
          subscription = options[:subscription]
        else
          subscription = AcquiaToolbelt::CLI::API.default_subscription
        end

        source    = options[:origin]
        target    = options[:target]
        file_copy = AcquiaToolbelt::CLI::API.request "sites/#{subscription}/files-copy/#{source}/#{target}", "POST"

        if file_copy["id"]
          ui.success "File copy from #{source} to #{target} has started."
        else
          ui.fail AcquiaToolbelt::CLI::API.display_error(file_copy)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acquia_toolbelt-2.3.1 lib/acquia_toolbelt/cli/file.rb