$:.unshift File.dirname(__FILE__) require 'physical_system' require 'cotta_dir' require 'cotta_file' require 'pathname' require 'cotta_pathname' require 'command_interface' module BuildMaster class Cotta attr_accessor :command_interface def initialize(system=PhysicalSystem.new) @system = system @command_interface = CommandInterface.new end def shell(command_line, &block) @system.shell(command_line, &block) end def command_interface=(value) if (value) @command_interface = value else @command_interface = CommandInterface.new end end def dir(path) return nil unless path return CottaDir.new(@system, Pathname.new(path)) end def Cotta::dir(path) return nil unless path return Cotta.new.dir(File.expand_path(path)) end def file(path) return nil unless path return CottaFile.new(@system, Pathname.new(path)) end def Cotta::file(path) return nil unless path return Cotta.new.file(File.expand_path(path)) end def Cotta::parent_of(path) return Cotta.file(path).parent end def entry(path) entry = file(path) unless (entry.exists?) entry = dir(path) raise "#{path} exists as niether file nor directory" unless entry.exists? end return entry end def environment!(variable) @system.environment!(variable) end def environment(variable, default = '') @system.environment(variable, default) end end end