Sha256: febade4456ec2b719e21f6d55438045655612b8d2fe7644882641906975609b3

Contents?: true

Size: 1013 Bytes

Versions: 1

Compression:

Stored size: 1013 Bytes

Contents

require 'rake'
require 'rake/file_utils_ext'

module Container
  module Backup
    class Step
      include Rake::FileUtilsExt

      def initialize(container_info, directory, backup, params_hash)
        @container_info = container_info
        @directory = directory
        @backup = backup
        @params = params_hash
      end

      def params
        @params
      end

      def container
        @container_info.keys.first
      end

      def image
        @container_info.values.first
      end

      def backup_path
        [@directory, container, self.class.name.split('::').last.downcase].join('/')
      end

      def perform
        @backup ? backup : restore
      end

      def backup
        puts "Backup path: #{backup_path}"
        puts "Backup: #{self.class} container: #{container} params: #{@params}"
      end

      def restore
        puts "Backup path: #{backup_path}"
        puts "Restore: #{self.class} container: #{container} params: #{@params}"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
container-backup-0.1.0 lib/container/step.rb