Class: Cerberus::SCM::Darcs

Inherits:
Base
  • Object
show all
Defined in:
lib/cerberus/scm/darcs.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #url

Constructor Details

This class inherits a constructor from Cerberus::SCM::Base

Instance Method Details

#current_revisionObject



31
32
33
# File 'lib/cerberus/scm/darcs.rb', line 31

def current_revision
  @date
end

#has_changes?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/cerberus/scm/darcs.rb', line 24

def has_changes?
  return false if @status =~ /No remote changes to pull in!/
  return true if @status =~ /We have the following new \(to them\) patches:/
  return true if @status =~ /Copying patch \d+ of \d+\.\.\. done!/
  return false
end

#installed?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/cerberus/scm/darcs.rb', line 6

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

#last_authorObject



39
40
41
# File 'lib/cerberus/scm/darcs.rb', line 39

def last_author
  @author
end

#last_commit_messageObject



35
36
37
# File 'lib/cerberus/scm/darcs.rb', line 35

def last_commit_message
  @message
end

#outputObject



43
44
45
# File 'lib/cerberus/scm/darcs.rb', line 43

def output
  @status
end

#update!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cerberus/scm/darcs.rb', line 10

def update!
  if test(?d, @path + '/_darcs')
    @status = execute('pull', '-v -a')
  else
    FileUtils.rm_rf(@path) if test(?d,@path)
    FileUtils.mkpath(File.basename(@path)) unless test(?d,File.basename(@path))

    encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url])
    @status = execute("get", "--partial #{encoded_url}")
  end

  extract_last_commit_info
end