Class: Cerberus::SCM::SVN

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

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#current_revisionObject



28
29
30
# File 'lib/cerberus/scm/svn.rb', line 28

def current_revision
  info['Revision'].to_i
end

#has_changes?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/cerberus/scm/svn.rb', line 24

def has_changes?
  @status =~ /[A-Z]\s+[\w\/]+/ ? true : false
end

#installed?Boolean

Returns:

  • (Boolean)


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

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

#last_authorObject



46
47
48
# File 'lib/cerberus/scm/svn.rb', line 46

def last_author
  info['Last Changed Author']
end

#last_commit_messageObject



36
37
38
39
40
41
42
43
44
# File 'lib/cerberus/scm/svn.rb', line 36

def last_commit_message
  message = execute("log", "--limit 1 -v")
  #strip first line that contains command line itself (svn log --limit ...)
  if (idx = message.index('-'*72))
    message[idx..-1]
  else
    message
  end
end

#update!Object



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

def update!
  if test(?d, @path + '/.svn') #check first that it was not locked 
    execute("cleanup") if locked?
    say "Could not unlock svn directory #{@encoded_path}. Please do it manually." if locked? #In case if we could not unlock from command line - ask user to do it
  end

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

#urlObject



32
33
34
# File 'lib/cerberus/scm/svn.rb', line 32

def url
  info['URL']
end