Sha256: 7da10f811fa019233ab6db8059a749f6c9b6b3641419613ed7e8f8d916c96025

Contents?: true

Size: 600 Bytes

Versions: 6

Compression:

Stored size: 600 Bytes

Contents

require 'backup/file_item/base'

module Backup
	module FileItem
    class Local < Backup::FileItem::Base
      def create_directory_once(*directories)
        directories.each do |path|
          FileUtils.mkdir_p(path) unless Dir.exists?(path)
        end
      end

      def create_file_once(file, data)
        date = date.read if date.is_a? File
        File.open(file, "w").puts(data) unless File.exists?(file)
      end

      def read_file(file)
        open(file).read if File.exists? file
      end

      def dir(path, mask = "*")
        Dir["#{path}/#{mask}"]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
encbs-0.1.3 lib/backup/file_item/local.rb
encbs-0.1.2 lib/backup/file_item/local.rb
encbs-0.1.1 lib/backup/file_item/local.rb
encbs-0.1.0 lib/backup/file_item/local.rb
palobr-0.1.0.1 lib/backup/file_item/local.rb
palobr-0.1.0 lib/backup/file_item/local.rb