Class: Mrsk::Cli::Build
- Inherits:
-
Base
- Object
- Thor
- Base
- Mrsk::Cli::Build
show all
- Defined in:
- lib/mrsk/cli/build.rb
Defined Under Namespace
Classes: BuildError
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?, #initialize
Instance Method Details
#create ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/mrsk/cli/build.rb', line 50
def create
mutating do
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
end
|
#deliver ⇒ Object
5
6
7
8
9
10
|
# File 'lib/mrsk/cli/build.rb', line 5
def deliver
mutating do
push
pull
end
end
|
#details ⇒ Object
79
80
81
82
83
84
|
# File 'lib/mrsk/cli/build.rb', line 79
def details
run_locally do
puts "Builder: #{MRSK.builder.name}"
puts capture(*MRSK.builder.info)
end
end
|
#pull ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/mrsk/cli/build.rb', line 39
def pull
mutating do
on(MRSK.hosts) do
execute *MRSK.auditor.record("Pulled image with version #{MRSK.config.version}"), verbosity: :debug
execute *MRSK.builder.clean, raise_on_non_zero_exit: false
execute *MRSK.builder.pull
end
end
end
|
#push ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/mrsk/cli/build.rb', line 13
def push
mutating do
cli = self
verify_local_dependencies
run_hook "pre-build"
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
end
|
#remove ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/mrsk/cli/build.rb', line 69
def remove
mutating do
run_locally do
debug "Using builder: #{MRSK.builder.name}"
execute *MRSK.builder.remove
end
end
end
|