percheron 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/percheron/actions/base.rb +8 -2
- data/lib/percheron/actions/build.rb +2 -3
- data/lib/percheron/actions/create.rb +1 -1
- data/lib/percheron/actions/exec_local.rb +43 -0
- data/lib/percheron/actions/start.rb +4 -2
- data/lib/percheron/actions.rb +1 -0
- data/lib/percheron/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 184231c68ed6ae113dd7f46af5290a523b098066
|
4
|
+
data.tar.gz: f9abacfe6fb20d642faecd4719bd1a0294183158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08a95231a9a22eb805451da21768e17addb2da749778f59626ae4cee1b370e040051b7f6457549e18cd5efa247173716d8f120515405b04d2f6ba3254c6f5bc
|
7
|
+
data.tar.gz: 90a61d02bcbb222e44837526803a2a1a0da12f9b9f0fbbd2eafba03eee861160fc3528bbfff50937ff7ce024569a99cd5402e35973e5786d1937f449f52c9563
|
@@ -29,13 +29,19 @@ module Percheron
|
|
29
29
|
|
30
30
|
def stop_containers!(containers)
|
31
31
|
exec_on_containers!(containers) do |container|
|
32
|
-
|
32
|
+
if container.running?
|
33
|
+
$logger.debug "Stopping '#{container.name}' container"
|
34
|
+
Stop.new(container).execute!
|
35
|
+
end
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
39
|
def start_containers!(containers)
|
37
40
|
exec_on_containers!(containers) do |container|
|
38
|
-
|
41
|
+
unless container.running?
|
42
|
+
$logger.debug "Starting '#{container.name}' container"
|
43
|
+
Start.new(container, container.dependant_containers.values).execute!
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
@@ -29,8 +29,7 @@ module Percheron
|
|
29
29
|
|
30
30
|
def build!
|
31
31
|
in_working_directory(base_dir) do
|
32
|
-
execute_pre_build_scripts!
|
33
|
-
|
32
|
+
execute_pre_build_scripts! unless container.pre_build_scripts.empty?
|
34
33
|
$logger.info "Building '#{container.image_name}'"
|
35
34
|
Docker::Image.build_from_dir(base_dir, build_opts) do |out|
|
36
35
|
$logger.debug '%s' % [ out.strip ]
|
@@ -39,7 +38,7 @@ module Percheron
|
|
39
38
|
end
|
40
39
|
|
41
40
|
def execute_pre_build_scripts!
|
42
|
-
|
41
|
+
ExecLocal.new(container, container.pre_build_scripts, 'PRE build').execute!
|
43
42
|
end
|
44
43
|
|
45
44
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Percheron
|
4
|
+
module Actions
|
5
|
+
class ExecLocal
|
6
|
+
|
7
|
+
include Base
|
8
|
+
|
9
|
+
def initialize(container, scripts, description)
|
10
|
+
@container = container
|
11
|
+
@scripts = scripts
|
12
|
+
@description = description
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute!
|
16
|
+
$logger.debug "Executing #{description} scripts '#{scripts.inspect}' locally"
|
17
|
+
execute_scripts!
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :container, :scripts, :description
|
23
|
+
|
24
|
+
def execute_scripts!
|
25
|
+
scripts.each do |script|
|
26
|
+
in_working_directory(base_dir) do
|
27
|
+
execute_command!('/bin/bash -x %s 2>&1' % Pathname.new(File.expand_path(script)))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def execute_command!(command)
|
33
|
+
$logger.info "Executing #{description} '#{command}' locally"
|
34
|
+
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thr|
|
35
|
+
while line = stdout_stderr.gets
|
36
|
+
$logger.debug line.strip
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -11,8 +11,10 @@ module Percheron
|
|
11
11
|
|
12
12
|
def execute!
|
13
13
|
create_or_recreate!
|
14
|
-
|
15
|
-
|
14
|
+
unless container.running?
|
15
|
+
start!
|
16
|
+
execute_post_start_scripts! unless container.post_start_scripts.empty?
|
17
|
+
end
|
16
18
|
container
|
17
19
|
end
|
18
20
|
|
data/lib/percheron/actions.rb
CHANGED
data/lib/percheron/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percheron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ash McKenzie
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- lib/percheron/actions/build.rb
|
232
232
|
- lib/percheron/actions/create.rb
|
233
233
|
- lib/percheron/actions/exec.rb
|
234
|
+
- lib/percheron/actions/exec_local.rb
|
234
235
|
- lib/percheron/actions/purge.rb
|
235
236
|
- lib/percheron/actions/recreate.rb
|
236
237
|
- lib/percheron/actions/rename.rb
|