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.8.0 lib/dato/dump/operation/directory.rb
dato-0.7.18 lib/dato/dump/operation/directory.rb
dato-0.7.17 lib/dato/dump/operation/directory.rb
dato-0.7.16 lib/dato/dump/operation/directory.rb
dato-0.7.15 lib/dato/dump/operation/directory.rb
dato-0.7.14 lib/dato/dump/operation/directory.rb
dato-0.7.13 lib/dato/dump/operation/directory.rb
dato-0.7.10 lib/dato/dump/operation/directory.rb
dato-0.7.9 lib/dato/dump/operation/directory.rb
dato-0.7.8 lib/dato/dump/operation/directory.rb
dato-0.7.7 lib/dato/dump/operation/directory.rb
dato-0.7.6 lib/dato/dump/operation/directory.rb
dato-0.7.5 lib/dato/dump/operation/directory.rb
dato-0.7.4 lib/dato/dump/operation/directory.rb
dato-0.7.3 lib/dato/dump/operation/directory.rb
dato-0.7.2 lib/dato/dump/operation/directory.rb
dato-0.7.1 lib/dato/dump/operation/directory.rb
dato-0.7.0 lib/dato/dump/operation/directory.rb
dato-0.6.18 lib/dato/dump/operation/directory.rb
dato-0.6.17 lib/dato/dump/operation/directory.rb