Class: Cerberus::SCM::Bazaar

Inherits:
Base
  • Object
show all
Defined in:
lib/cerberus/scm/bzr.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



30
31
32
# File 'lib/cerberus/scm/bzr.rb', line 30

def current_revision
  @revision
end

#has_changes?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/cerberus/scm/bzr.rb', line 26

def has_changes?
  @revision.to_i > @old_revision.to_i
end

#installed?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cerberus/scm/bzr.rb', line 7

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

#last_authorObject



38
39
40
# File 'lib/cerberus/scm/bzr.rb', line 38

def last_author
  @author
end

#last_commit_messageObject



34
35
36
# File 'lib/cerberus/scm/bzr.rb', line 34

def last_commit_message
  @message
end

#update!Object



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

def update!
  if test(?d, File.join(@path, '.bzr'))
    extract_last_commit_info
    @old_revision = @revision
    # Revert in an attempt to avoid conflicts from local file changes
    execute("revert", "--no-backup 2>&1")
    @status = execute("update", "2>&1")
  else
    @old_revision = 0
    FileUtils.rm_rf(@path) if test(?d, @path)
    @status = execute("checkout", nil, @config[:scm, :url])
  end
  extract_last_commit_info
end