devkitkat 0.1.25 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc1ec65b940b53a2d04d473ed109dbd6b97256f09ac270f2b59edb607201b310
|
4
|
+
data.tar.gz: c14fa3b11c1fe1fd4e33e92fece3bfa9e5eaf3ad233cb34cf0e5b8dfe2783a10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b331ae89d8c5cf523fe51b0b4cc36bad069b7f5750e7b8413ec4f41896ebcded43f680e42dfff6aa44bf4755aabf9d459e1f0c4c1e1243b80977baf787c06750
|
7
|
+
data.tar.gz: 78dcc4f8d93ddb3727c6f9ff254b9a4dd2ef406f7c95f07ae7bd6a216f622dc08b748811f3be5eec5d8822c2570375762d1f99063be2199589682cdc5ace505f
|
data/Gemfile.lock
CHANGED
@@ -10,36 +10,49 @@ module Devkitkat
|
|
10
10
|
attr_reader :container
|
11
11
|
|
12
12
|
def start
|
13
|
-
|
13
|
+
@container = find
|
14
|
+
|
15
|
+
if command.interactive?
|
16
|
+
raise 'Container has not started yet for interactive session' unless @container
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
20
|
+
if @container
|
14
21
|
container.restart
|
15
22
|
else
|
16
23
|
@container = create
|
17
|
-
container.
|
24
|
+
container.start
|
18
25
|
create_host_user
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
29
|
def stop
|
30
|
+
return if command.interactive?
|
23
31
|
raise 'Container has not started yet' unless container
|
24
32
|
|
25
33
|
container.stop
|
26
34
|
end
|
27
35
|
|
28
|
-
def exec(cmds, params = {})
|
36
|
+
def exec(cmds, params = {}, &block)
|
29
37
|
params.merge!(user: user_name)
|
30
|
-
safe_exec(cmds, params)
|
38
|
+
safe_exec(cmds, params, &block)
|
31
39
|
end
|
32
40
|
|
33
|
-
def exec_as_root(cmds, params = {})
|
34
|
-
safe_exec(cmds, params)
|
41
|
+
def exec_as_root(cmds, params = {}, &block)
|
42
|
+
safe_exec(cmds, params, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def interactive_shell(cmd)
|
46
|
+
# container.exec([new_path], tty: true, stdin: STDIN) { |stream, chunk| print "#{stream}" }
|
47
|
+
Kernel.exec('docker', 'exec', '-ti', '--user', user_name, name, cmd)
|
35
48
|
end
|
36
49
|
|
37
50
|
private
|
38
51
|
|
39
|
-
def safe_exec(cmds, params)
|
52
|
+
def safe_exec(cmds, params, &block)
|
40
53
|
params.merge!(wait: 604800) # Default timeout is 1 minute, so setting 1 week instead
|
41
54
|
stdout_messages, stderr_messages, exit_code =
|
42
|
-
container.exec(cmds, params)
|
55
|
+
container.exec(cmds, params, &block)
|
43
56
|
|
44
57
|
if exit_code != 0 || command.debug?
|
45
58
|
puts "#{self.class.name} - #{__callee__}: stdout_messages: #{stdout_messages} stderr_messages: #{stderr_messages} exit_code: #{exit_code}"
|
@@ -55,11 +68,6 @@ module Devkitkat
|
|
55
68
|
config.machine_image
|
56
69
|
end
|
57
70
|
|
58
|
-
def name
|
59
|
-
@name ||=
|
60
|
-
"#{config.application}-#{service.name}-#{Digest::SHA1.hexdigest(command.kit_root)[8..12]}"
|
61
|
-
end
|
62
|
-
|
63
71
|
def find
|
64
72
|
::Docker::Container.get(name)
|
65
73
|
rescue ::Docker::Error::NotFoundError
|
@@ -123,6 +131,11 @@ module Devkitkat
|
|
123
131
|
end
|
124
132
|
end
|
125
133
|
|
134
|
+
def name
|
135
|
+
@name ||=
|
136
|
+
"#{config.application}-#{service.name}-#{Digest::SHA1.hexdigest(command.kit_root)[8..12]}"
|
137
|
+
end
|
138
|
+
|
126
139
|
def user_name
|
127
140
|
'devkitkat'
|
128
141
|
end
|
@@ -14,7 +14,11 @@ module Devkitkat
|
|
14
14
|
def execute(script_file)
|
15
15
|
new_path = rewrite_root_path!(script_file)
|
16
16
|
|
17
|
-
|
17
|
+
if command.interactive?
|
18
|
+
container.interactive_shell(new_path)
|
19
|
+
else
|
20
|
+
container.exec([new_path])
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def cleanup
|
data/lib/devkitkat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devkitkat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinya Maeda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|