Class: Mrsk::Cli::Build
- Inherits:
-
Base
- Object
- Thor
- Base
- Mrsk::Cli::Build
show all
- Defined in:
- lib/mrsk/cli/build.rb
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?, #initialize
Instance Method Details
#create ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/mrsk/cli/build.rb', line 38
def create
run_locally do
begin
debug "Using builder: #{MRSK.builder.name}"
execute *MRSK.builder.create
rescue SSHKit::Command::Failed => e
if e.message =~ /stderr=(.*)/
error "Couldn't create remote builder: #{$1}"
false
else
raise
end
end
end
end
|
#deliver ⇒ Object
3
4
5
6
|
# File 'lib/mrsk/cli/build.rb', line 3
def deliver
invoke :push
invoke :pull
end
|
#details ⇒ Object
63
64
65
66
67
68
|
# File 'lib/mrsk/cli/build.rb', line 63
def details
run_locally do
puts "Builder: #{MRSK.builder.name}"
puts capture(*MRSK.builder.info)
end
end
|
#pull ⇒ Object
30
31
32
33
34
35
|
# File 'lib/mrsk/cli/build.rb', line 30
def pull
on(MRSK.hosts) do
execute *MRSK.auditor.record("build pull image #{MRSK.version}"), verbosity: :debug
execute *MRSK.builder.pull
end
end
|
#push ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/mrsk/cli/build.rb', line 9
def push
cli = self
run_locally do
begin
MRSK.with_verbosity(:debug) { execute *MRSK.builder.push }
rescue SSHKit::Command::Failed => e
if e.message =~ /(no builder)|(no such file or directory)/
error "Missing compatible builder, so creating a new one first"
if cli.create
MRSK.with_verbosity(:debug) { execute *MRSK.builder.push }
end
else
raise
end
end
end
end
|
#remove ⇒ Object
55
56
57
58
59
60
|
# File 'lib/mrsk/cli/build.rb', line 55
def remove
run_locally do
debug "Using builder: #{MRSK.builder.name}"
execute *MRSK.builder.remove
end
end
|