dg 0.5.19 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dg/docker.rb +20 -18
- data/lib/dg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b00be5ea28289ada6575a196c4c06d72054e47e
|
4
|
+
data.tar.gz: 77decf3d5e7776cbab171e1b90e627fba28c5821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 510fdf4503a1e0bc81f9102fecde5d9a87fe3b3afd0a7c0b176fbe7b9454bb2551950724a1cb39c093e5d507442b2fe3c9aae179eac5e6e2853e15644a77012e
|
7
|
+
data.tar.gz: 5bc7e6f6eab06c13a6122e5281c2d9eefbe8b25d50e3edcec65621c2b091e256d650b190d955ca9e793ce35ede493b6cde3655504d67833590480da9c53e5ab2
|
data/lib/dg/docker.rb
CHANGED
@@ -5,7 +5,7 @@ require 'dg/version'
|
|
5
5
|
|
6
6
|
module DG
|
7
7
|
class Docker
|
8
|
-
SUDO = !!ENV['
|
8
|
+
SUDO = !!ENV['USE_SUDO']
|
9
9
|
BASEPATH = Dir.pwd
|
10
10
|
|
11
11
|
FIG_YML_PATH = "#{BASEPATH}/fig.yml"
|
@@ -27,7 +27,7 @@ module DG
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def push
|
30
|
-
run_with_output("docker push #{git_image_name
|
30
|
+
run_with_output("docker push #{git_image_name}")
|
31
31
|
end
|
32
32
|
|
33
33
|
def deploy
|
@@ -84,24 +84,26 @@ module DG
|
|
84
84
|
def run_with_output(command, capture = false)
|
85
85
|
sudo_command = SUDO ? "sudo -E bash -c '#{command}'" : command
|
86
86
|
puts "Running `#{sudo_command}` in #{Dir.pwd}"
|
87
|
-
if capture
|
88
|
-
# TODO: Replace this with a combined function below, so
|
89
|
-
# that non-zero exit codes are handled correctly
|
90
|
-
return `#{sudo_command}`
|
91
|
-
else
|
92
|
-
begin
|
93
|
-
PTY.spawn(sudo_command) do |stdin, stdout, pid|
|
94
|
-
stdin.each { |line| print line } rescue Errno::EIO
|
95
|
-
Process.wait(pid)
|
96
|
-
end
|
97
|
-
status_code = $?.exitstatus
|
98
|
-
|
99
|
-
error!(RuntimeError.new("exit code was #{status_code}"), "executing #{command}") if status_code != 0
|
100
87
|
|
101
|
-
|
102
|
-
|
103
|
-
|
88
|
+
begin
|
89
|
+
PTY.spawn(sudo_command) do |stdin, stdout, pid|
|
90
|
+
buffer = ''
|
91
|
+
callback = capture ?
|
92
|
+
->(line) {
|
93
|
+
print line
|
94
|
+
buffer << line
|
95
|
+
} :
|
96
|
+
->(line) { print line }
|
97
|
+
stdin.each(&callback) rescue Errno::EIO
|
98
|
+
Process.wait(pid)
|
104
99
|
end
|
100
|
+
status_code = $?.exitstatus
|
101
|
+
|
102
|
+
error!(RuntimeError.new("exit code was #{status_code}"), "executing #{command}") if status_code != 0
|
103
|
+
|
104
|
+
return capture ? buffer : status_code
|
105
|
+
rescue PTY::ChildExited
|
106
|
+
puts "The child process exited!"
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
data/lib/dg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Malet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
DockerGo (DG)
|