Sha256: e957b51fde1a2f7dac934431322dfac7516b3a36cb8d6361e5240dbf18df6419

Contents?: true

Size: 1000 Bytes

Versions: 10

Compression:

Stored size: 1000 Bytes

Contents

require 'cerberus/utils'

class Cerberus::SCM::CVS
  def initialize(path, config = {})
    raise "Path can't be nil" unless path

    @path, @config = path.strip, config
    @encoded_path = (@path.include?(' ') ? "\"#{@path}\"" : @path)
  end

  def installed?
    exec_successful? "#{@config[:bin_path]}cvs --version"
  end

  def update!
    if test(?d, @path + '/CVS')
      @status = execute("update")
    else
      FileUtils.mkpath(@path) unless test(?d,@path)
      @status = execute("checkout", nil, @config[:scm, :url])
    end
  end

  def has_changes?
    @status =~ /^[U|P|C] (.*)/
  end

  def current_revision
    raise NotImplementedError
  end

  def url
    raise NotImplementedError
  end

  def last_commit_message
    raise NotImplementedError
  end

  def last_author
    raise NotImplementedError
  end

  private
  def execute(command, parameters = nil, pre_parameters = nil)
    `#{@config[:bin_path]}cvs #{command} #{pre_parameters} #{@encoded_path} #{parameters}`
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cerberus-0.4.0 lib/cerberus/scm/cvs.rb
cerberus-0.3.6 lib/cerberus/scm/cvs.rb
cerberus-0.4.3 lib/cerberus/scm/cvs.rb
cerberus-0.4.1 lib/cerberus/scm/cvs.rb
cerberus-0.4.2 lib/cerberus/scm/cvs.rb
cerberus-0.4.4 lib/cerberus/scm/cvs.rb
cerberus-0.4.5.1 lib/cerberus/scm/cvs.rb
cerberus-0.4.5 lib/cerberus/scm/cvs.rb
cerberus-0.5 lib/cerberus/scm/cvs.rb
cerberus-0.6 lib/cerberus/scm/cvs.rb