Sha256: 1d348807d8ca5b764949e6a8763e3464b5eb8c4f0553a8fe8aee395ad776e200

Contents?: true

Size: 628 Bytes

Versions: 26

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

26 entries across 26 versions & 1 rubygems

Version Path
dato-0.6.16 lib/dato/dump/operation/directory.rb
dato-0.6.15 lib/dato/dump/operation/directory.rb
dato-0.6.14 lib/dato/dump/operation/directory.rb
dato-0.6.12 lib/dato/dump/operation/directory.rb
dato-0.6.11 lib/dato/dump/operation/directory.rb
dato-0.6.10 lib/dato/dump/operation/directory.rb