docker-template 0.18.0 → 0.19.0

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
- SHA1:
3
- metadata.gz: c9950615042a4303fbaf1cf72eaef4c9ff9cdcc0
4
- data.tar.gz: 2bc4aaed36fda6d2a2be8c8cba0aef1af15bd02c
2
+ SHA256:
3
+ metadata.gz: e2ab5af00f7a613c19f9dc69c35fa5213e4d8ec1ea8f535a5114f2d9600b14a6
4
+ data.tar.gz: 80d15462ac2b38f3a8b01e0c1d45e315f4c5b608af97f17c78a0498af4de9649
5
5
  SHA512:
6
- metadata.gz: 8b2a86f704aee0f67196abc1eae26c6d000319ee753dd87b8d03940b1ec464605dc299bbda100665631a3d63af3a5b0c8d4c01786833c73f0f63dcaab964a26f
7
- data.tar.gz: f5034881b114a2ef8fdfc7fc67335cd590dfeff375570f04f2466b676cbc55a7badea469b3c7b510367506e14b15b21d478d2d33515a010f1deecb5ce6498727
6
+ metadata.gz: c34c91d94b3b341cad25d5be242e8fef2d565b16f1b6f19a72846dfe006e02260c485c9f6f27c55393dfb7c0aa079d9c5f0212f44526b1db1233d8fb2835841a
7
+ data.tar.gz: 34c2673aeeb6ab68055417a6c6a53e5d7bef9d85fa86f673d29b89fa898b98326bbc8305817663a06d3ee607f7bf8025e7da5b93d77dcfa727c620b0de2fbe37
@@ -1,6 +1,7 @@
1
1
  # Frozen-string-literal: true
2
2
  # Copyright: 2015 - 2016 Jordon Bedwell - Apache v2.0 License
3
3
  # Encoding: utf-8
4
+ STDOUT.sync = true
4
5
 
5
6
  module Docker
6
7
  module Template
@@ -81,31 +82,39 @@ module Docker
81
82
  # --
82
83
 
83
84
  def api(part, *args)
84
- part = encode_str(part)
85
- chunked_part = @chunks.push(part).join if @chunks && !@chunks.empty?
86
- chunked_part = part if !@chunks
87
- stream = JSON.parse(
88
- chunked_part
89
- )
85
+ part = encode_str(part).each_line.to_a
86
+ if part.one? && part = part.first
87
+ chunked_part = @chunks.push(part).join if @chunks && !@chunks.empty?
88
+ chunked_part = part if !@chunks
89
+ stream = JSON.parse(
90
+ chunked_part
91
+ )
92
+
93
+ if chunked_part == part && @chunks && !@chunks.empty?
94
+ then @chunks.each do |chunk|
95
+ @stderr.puts format("Unparsable JSON: %s",
96
+ chunk
97
+ )
98
+ end
99
+ end
90
100
 
91
- if chunked_part == part && @chunks && !@chunks.empty?
92
- then @chunks.each do |chunk|
93
- @stderr.puts format("Unparsable JSON: %s",
94
- chunk
95
- )
101
+ @chunks = nil
102
+ return progress_bar(stream) if stream.any_key?("progress", "progressDetail")
103
+ return output(stream["status"] || stream["stream"]) if stream.any_key?("status", "stream")
104
+ return progress_error(stream) if stream.any_key?("errorDetail", "error")
105
+ warn Simple::Ansi.red("Unhandled Stream.")
106
+ @stdout.puts(part)
107
+ @output = true
108
+ else
109
+ part.each do |v|
110
+ api(v, *args)
96
111
  end
97
112
  end
98
-
99
- @chunks = nil
100
- return progress_bar(stream) if stream.any_key?("progress", "progressDetail")
101
- return output(stream["status"] || stream["stream"]) if stream.any_key?("status", "stream")
102
- return progress_error(stream) if stream.any_key?("errorDetail", "error")
103
- warn Simple::Ansi.red("Unhandled Stream.")
104
- @stdout.puts(
105
- part
106
- )
107
-
108
- @output = true
113
+ # --
114
+ # Sometimes we get undetectable chunks.
115
+ # When we do, we try to keep them passed along.
116
+ # That way we can throw them out later.
117
+ # --
109
118
  rescue JSON::ParserError => e
110
119
  (@chunks ||= []).push(
111
120
  part
@@ -4,6 +4,6 @@
4
4
 
5
5
  module Docker
6
6
  module Template
7
- VERSION = "0.18.0"
7
+ VERSION = "0.19.0"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.6.11
190
+ rubygems_version: 2.7.3
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Build and template Docker images a variety of ways.