fidoci 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fidoci/env.rb +32 -2
- data/lib/fidoci/main.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5cb4d6051aff6519d75eb5e56c5c6f53a70e41
|
4
|
+
data.tar.gz: 4f2b6b0492a8c3f08bde207215ea950701adf84f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 366612bfa685ff7d1018737ddbe170353f2ae75d58ed6c87c5b08cf2657cb86732e7add8cc3994e987c3f80c8689bd17083d43b3292511937ccac5700d56a654
|
7
|
+
data.tar.gz: 5752aed2b97a7f663c4ccbeb482eeba7c08fefc677d70d53c8d9b9f9c9d5cf0e809f6cb97fc68d7ee2b5b1728f35d8edf0e29450ae3eade6e084dacec82007c9
|
data/lib/fidoci/env.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'io/console'
|
2
|
+
|
1
3
|
module Fidoci
|
2
4
|
# Environment configuration of D
|
3
5
|
# encapsulates container image building and running commands in it
|
@@ -66,8 +68,29 @@ module Fidoci
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def tag_image(tag)
|
71
|
+
info "Tagging images as #{@image}:#{tag}..."
|
72
|
+
|
69
73
|
image = Docker::Image.get(image_name)
|
70
|
-
image.tag(@image => tag)
|
74
|
+
image.tag('repo' => @image, 'tag' => tag, 'force' => true)
|
75
|
+
end
|
76
|
+
|
77
|
+
def push(tag)
|
78
|
+
repo_tag = "#{@image}:#{tag}"
|
79
|
+
image = Docker::Image.get(repo_tag)
|
80
|
+
|
81
|
+
creds = {
|
82
|
+
'username' => ENV['DOCKER_REGISTRY_USERNAME'],
|
83
|
+
'password' => ENV['DOCKER_REGISTRY_PASSWORD'],
|
84
|
+
'email' => ENV['DOCKER_REGISTRY_EMAIL']
|
85
|
+
}
|
86
|
+
|
87
|
+
info "Pushing #{repo_tag}..."
|
88
|
+
image.push(creds, 'repo_tag' => repo_tag) do |msg|
|
89
|
+
json = JSON.parse(msg)
|
90
|
+
$stdout.puts json['status']
|
91
|
+
$stdout.puts json['progress'] if json['progress']
|
92
|
+
$stdout.puts "Error: #{json['error']}" if json['error']
|
93
|
+
end
|
71
94
|
end
|
72
95
|
|
73
96
|
def container_name
|
@@ -247,11 +270,16 @@ module Fidoci
|
|
247
270
|
|
248
271
|
receiver = ->(msg) {
|
249
272
|
$stdout << msg
|
273
|
+
$stdout.flush
|
250
274
|
}
|
251
275
|
|
252
276
|
if $stdin && $stdin.tty?
|
277
|
+
|
253
278
|
$stdin.raw do
|
254
|
-
container.start
|
279
|
+
container.start!
|
280
|
+
lines, cols = IO.console.winsize rescue [60,80]
|
281
|
+
container.connection.post("/containers/#{container.id}/resize", h: lines, w: cols)
|
282
|
+
container.attach(tty: true, stdin: $stdin, &receiver)
|
255
283
|
end
|
256
284
|
else
|
257
285
|
container.start!.attach(tty: true, &receiver)
|
@@ -313,6 +341,8 @@ module Fidoci
|
|
313
341
|
return false unless env_config['commands']
|
314
342
|
|
315
343
|
success = env_config['commands'].all? { |command|
|
344
|
+
info "Running `#{command}`..."
|
345
|
+
|
316
346
|
state = cmd(*command.split(/\s+/))
|
317
347
|
info "Exited with state #{state}"
|
318
348
|
|
data/lib/fidoci/main.rb
CHANGED