Sha256: a3095a50fe2f8be3a7483e00480eab0b9eef9f73e9ef424c7005164ea15c78ac

Contents?: true

Size: 628 Bytes

Versions: 4

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true
require 'fileutils'

module Agave
  module Dump
    module Operation
      class Directory
        attr_reader :context, :path

        def initialize(context, path)
          @context = context
          @path = File.join(context.path, path)
          @operations = []
        end

        def add(operation)
          @operations << operation
        end

        def perform
          FileUtils.remove_dir(path) if Dir.exist?(path)

          FileUtils.mkdir_p(path)

          operations.each(&:perform)
        end

        private

        attr_reader :operations
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
agave-client-0.1.3 lib/agave/dump/operation/directory.rb
agave-client-0.1.2 lib/agave/dump/operation/directory.rb
agave-client-0.1.1 lib/agave/dump/operation/directory.rb
agave-client-0.1.0 lib/agave/dump/operation/directory.rb