Class: DependencyWiring::Mercurial
- Inherits:
-
SCM
- Object
- SCM
- DependencyWiring::Mercurial
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
Instance Method Details
#clone ⇒ Object
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_opts ⇒ Object
34
35
36
|
# File 'lib/dependency_wiring/mercurial.rb', line 34
def default_opts
{ branch: 'default' }
end
|
#pull ⇒ Object
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_s ⇒ Object
30
31
32
|
# File 'lib/dependency_wiring/mercurial.rb', line 30
def to_s
"hg(#{@src}, #{@opts}) -> #{@dest}"
end
|
#update ⇒ Object
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
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
|
#wire ⇒ Object
24
25
26
27
28
|
# File 'lib/dependency_wiring/mercurial.rb', line 24
def wire
super
pull
update
end
|