Sha256: f086815d2625015f8b7406497301db40ccafdf0531de5460e07808905fca9d7b

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 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 CvsClient
  include Shell
  def CvsClient.load(working_directory)
    return CvsClient.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

1 entries across 1 versions & 1 rubygems

Version Path
BuildMaster-0.6.0 lib/buildmaster/cvs_client.rb