Sha256: b57c7adf8ae2ada7b4f3479f0397a9bbe947edce46b19f948861740aa5684f11
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
$:.unshift File.dirname(__FILE__) require 'cotta_file' module BuildMaster class CottaDir attr_reader :path, :system def initialize(system, path) @system = system @path = path @name = @path.basename.to_s end def cotta return Cotta.new(@system) end def name return @path.basename.to_s end def exists? return @system.dir_exists?(@path) end def parent if (@name == '.') return nil end return CottaDir.new(@system, @path.parent) end def dir(name) return CottaDir.new(@system, @path.join(name)) end def file(name) return CottaFile.new(@system, @path.join(name)) end def mkdirs if (not exists?) parent.mkdirs @system.mkdir @path end end def delete list.each {|children| children.delete} @system.delete_dir(@path) end def list @system.list(@path).collect do |item| candidate = dir(item) if (not candidate.exists?) candidate = file(item) end candidate end end def ==(other) return @path == other.path && @system == other.system end def to_s return "#{super}-#@system-#@path" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BuildMaster-0.9.0 | lib/buildmaster/cotta/cotta_dir.rb |