Sha256: a096d8d4ea19f49355b510445b11051eb8bcced8763cb41f0d5dd4bfa3108c7e

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

require "fileutils"

module Dato
  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

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.8.3 lib/dato/dump/operation/directory.rb
dato-0.8.2 lib/dato/dump/operation/directory.rb
dato-0.8.1 lib/dato/dump/operation/directory.rb