module BuildMaster class CvsInfo attr_reader :root, :repository public def initialize(root, repository) @root = root @repository = repository end def CvsInfo.load(folder) return CvsInfo.new(read("#{folder}/Root").strip!, read("#{folder}/Repository").strip!) end private def CvsInfo.read(file) File.open(file) do |file| return file.gets end end end class CvsDriver include Shell def CvsDriver.from_path(working_directory) return CvsDriver.new(CvsInfo.load("#{working_directory}/CVS"), working_directory) end def initialize(cvs_info, working_directory, &command_runner) @cvs_info = cvs_info @working_directory = working_directory @command_runner = command_runner end def command(command) run_command "cvs -d #{@cvs_info.root} #{command} #{@working_directory}" end def checkout() run_command("cvs -d #{@cvs_info.root} co -d #{@working_directory} #{@cvs_info.repository}") end def update(option='') if (option.length > 0) option = ' ' + option end command("update#{option}") end def tag(name) command("tag #{name}") end def commit(comment) command("commit -m \"#{comment}\"") end end end