Sha256: 487e085b78beb78448234e7647fdaa14f163c593520a39b8da7795acd0b9e6de

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

require 'tmpdir'

RSpec.configure do |config|
  config.color_enabled = true
end

class TempDir
  attr_accessor :path

  def initialize(root, subpath)
    @path = File.join(root, subpath)
    Dir.mkdir(@path)
  end

  def tree
    #`cd #{@path}; tree -pugAD`
    #`cd #{@path}; find . -printf "%A@ %p\n"`
    `cd #{@path}; find . -printf "%p\n"`
  end

  def mkdir(path)
    Dir.mkdir(File.join(@path, path))
  end

  def eql? other
    tree == other.tree
  end

  def to_s
    tree
  end

  def self.create(&block)
    Dir.mktmpdir do |dir|
      yield new(dir, "src"), new(dir, "dest")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsync-1.0.8 spec/spec_helper.rb