Class: DependencyWiring::Mercurial

Inherits:
SCM
  • Object
show all
Defined in:
lib/dependency_wiring/mercurial.rb

Instance Attribute Summary

Attributes inherited from SCM

#opts

Attributes included from Wiring

#dest, #src

Instance Method Summary collapse

Methods inherited from SCM

#initialize, #prepare_dest

Methods included from Wiring

#initialize, #prepare_dest

Constructor Details

This class inherits a constructor from DependencyWiring::SCM

Instance Method Details

#cloneObject



7
8
9
10
# File 'lib/dependency_wiring/mercurial.rb', line 7

def clone
  ret = sh_with_code("hg clone #{hg_opts} #{@src} .")
  raise("HG: Cannot clone #{@src} into #{@dest}! Output: #{ret[0]}") if ret[1] != 0
end

#default_optsObject



34
35
36
# File 'lib/dependency_wiring/mercurial.rb', line 34

def default_opts
  { branch: 'default' }
end

#pullObject



12
13
14
15
# File 'lib/dependency_wiring/mercurial.rb', line 12

def pull
  ret = sh_with_code("hg pull #{hg_opts} #{@src}")
  raise("HG: Cannot pull #{@dest}! Output: #{ret[0]}") if ret[1] != 0
end

#to_sObject



30
31
32
# File 'lib/dependency_wiring/mercurial.rb', line 30

def to_s
  "hg(#{@src}, #{@opts}) -> #{@dest}"
end

#updateObject



17
18
19
20
21
22
# File 'lib/dependency_wiring/mercurial.rb', line 17

def update
  ret = sh_with_code("hg update -C #{hg_revision}")
  if ret[1] != 0
    raise("HG: Cannot update #{@dest} to #{hg_revision}! Output: #{ret[0]}") 
  end
end

#valid_destination?Boolean

Returns:

  • (Boolean)


38
39
40
41
# File 'lib/dependency_wiring/mercurial.rb', line 38

def valid_destination?
  ret = sh_with_code('hg su')
  ret[1] == 0
end

#wireObject



24
25
26
27
28
# File 'lib/dependency_wiring/mercurial.rb', line 24

def wire
  super
  pull
  update
end