fidoci 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fidoci/env.rb +32 -2
  3. data/lib/fidoci/main.rb +1 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80f0134e171cd9eee7e9c360fd7cb01eb010aeed
4
- data.tar.gz: 5ab4322d0b6105ba143edf3021eccc0037e950d9
3
+ metadata.gz: cd5cb4d6051aff6519d75eb5e56c5c6f53a70e41
4
+ data.tar.gz: 4f2b6b0492a8c3f08bde207215ea950701adf84f
5
5
  SHA512:
6
- metadata.gz: 56cc4658a5f9a2502b4a2e38fc7e65b03464893922a339ac613b8ad4f9908a6798989372d104acde34c5b96de6d862d18b8d4c24edba2e76d910417f7aa98113
7
- data.tar.gz: 3b01864360eabf3c9d95004f56a77ba01dfae83c30ca7792c8f289e9d39f598be2c45511abc9b2ec5fff6d1615292055cc66525193a4dc74e59d076e63c69609
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!.attach(tty: true, stdin: $stdin, &receiver)
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
@@ -67,6 +67,7 @@ module Fidoci
67
67
 
68
68
  if success
69
69
  test_env.tag_image(tag)
70
+ test_env.push(tag)
70
71
  end
71
72
 
72
73
  success
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fidoci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Dolezal