Sha256: d8ec7078bda9790aee1f9ca4fc339ae83d3b799e9c16199df809203f6092a841

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 lib/buildmaster/cvs_driver.rb
BuildMaster-0.8.1 lib/buildmaster/cvs_driver.rb
BuildMaster-0.7.0 lib/buildmaster/cvs_driver.rb