Sha256: 8f116dfc53b16019565610b9023200c120a1f5cd9a973fd53ea3f6f9569ff4f0

Contents?: true

Size: 542 Bytes

Versions: 4

Compression:

Stored size: 542 Bytes

Contents

require 'tmpdir'

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

4 entries across 4 versions & 1 rubygems

Version Path
rsync-1.0.7 spec/spec_helper.rb
rsync-0.0.6 spec/spec_helper.rb
rsync-0.0.5 spec/spec_helper.rb
rsync-0.0.4 spec/spec_helper.rb