kontena-cli 1.3.1 → 1.3.2.rc1

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
  SHA1:
3
- metadata.gz: 91cdadc1294c3d21ef618f5155c7fc912a9cbac4
4
- data.tar.gz: d4f0fdf48bf6ae37dc1e5d9d51bf62a7b52f0bc8
3
+ metadata.gz: '09dd9aa199b2377f60c7fd461743a5512cc6ad13'
4
+ data.tar.gz: 81eec9b635ccc3d4207224a9c6c5acefcfb6cc59
5
5
  SHA512:
6
- metadata.gz: 208dee14f5a5146a1011e45e6fa5b5a9a75d1d5bd996499e1f72004f47c24152df061bb849fb2fa217a6e2826bd328aa3cfb0857007fd2970551848d6414baf7
7
- data.tar.gz: 2e86990d5b0dce819a9abbf88a92da9d710456ac8e85bdf7bbd654b2847d8632770c7803e877b04d1aa2c86858cc94dc6378198e4e0c093f8a61feacdadcf555
6
+ metadata.gz: 27ba045edeccbb29fa363edfc57e77ddd7f7adea2db57f1842e4735a6145a16d22040ac078363e78d81542e03a840192ea176b54e3bbed5e08545e322a83d980
7
+ data.tar.gz: '0328929022b14facc2ccd0642345c218411124192dca88405a5e95437914ee0411d87f41bddc6a9e22839fb8957586da89eccbc9e3ec6000910f5379d13b2f85'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.1
1
+ 1.3.2.rc1
@@ -29,7 +29,7 @@ module Kontena::Cli::Containers
29
29
  end
30
30
  ws.on :open do
31
31
  ws.text(cmd)
32
- stdin_reader = self.stream_stdin_to_ws(ws) if self.interactive?
32
+ stdin_reader = self.stream_stdin_to_ws(ws, tty: self.tty?) if self.interactive?
33
33
  end
34
34
  ws.on :close do |e|
35
35
  if e.reason.include?('code: 404')
@@ -5,10 +5,10 @@ module Kontena::Cli::Helpers
5
5
 
6
6
  # @param [WebSocket::Client::Simple] ws
7
7
  # @return [Thread]
8
- def stream_stdin_to_ws(ws)
8
+ def stream_stdin_to_ws(ws, tty: nil)
9
9
  require 'io/console'
10
10
  Thread.new {
11
- if STDIN.tty?
11
+ if tty
12
12
  STDIN.raw {
13
13
  while char = STDIN.readpartial(1024)
14
14
  ws.text(JSON.dump({ stdin: char }))
@@ -70,7 +70,7 @@ module Kontena::Cli::Nodes
70
70
  end
71
71
  end
72
72
 
73
- grid_nodes.sort { |n| n['node_number'] }
73
+ grid_nodes.sort_by { |n| n['node_number'] }
74
74
  end
75
75
  end
76
76
 
@@ -131,7 +131,7 @@ module Kontena::Cli::Services
131
131
  end
132
132
  ws.on :open do
133
133
  ws.text(cmd)
134
- stdin_stream = self.stream_stdin_to_ws(ws)
134
+ stdin_stream = self.stream_stdin_to_ws(ws, tty: self.tty?)
135
135
  end
136
136
  ws.on :close do |e|
137
137
  if e.code != 1000
@@ -7,6 +7,8 @@ describe Kontena::Cli::Nodes::ListCommand do
7
7
  let(:subject) { described_class.new("kontena") }
8
8
 
9
9
  before do
10
+ Kontena.pastel.resolver.color.disable!
11
+
10
12
  allow(subject).to receive(:health_icon) {|health| health.inspect }
11
13
  allow(subject).to receive(:client).and_return(client)
12
14
  end
@@ -133,7 +135,7 @@ describe Kontena::Cli::Nodes::ListCommand do
133
135
  {
134
136
  "connected" => false,
135
137
  "name" => nil,
136
- "node_number" => nil,
138
+ "node_number" => 3,
137
139
  "initial_member" => false,
138
140
  'agent_version' => nil,
139
141
  },
@@ -146,7 +148,7 @@ describe Kontena::Cli::Nodes::ListCommand do
146
148
  expect{subject.run([])}.to output_table [
147
149
  [':warning node-1', '1.1-dev', 'online', '1 / 3', '-'],
148
150
  [':warning node-2', '1.1-dev', 'online', '2 / 3', '-'],
149
- [':offline (initializing)', '', 'offline', '-', '-'],
151
+ [':offline (initializing)', 'offline', '-', '-'], # missing agent_version
150
152
  ]
151
153
  end
152
154
  end
@@ -5,6 +5,10 @@ require 'kontena/cli/common'
5
5
  describe Kontena::Cli::TableGenerator do
6
6
  let(:data) { [{'a' => 'a1', 'b' => 'b1', 'c' => 'c1'}, {'a' => 'a2', 'b' => 'b2', 'c' => 'c2'}] }
7
7
 
8
+ before do
9
+ Kontena.pastel.resolver.color.disable!
10
+ end
11
+
8
12
  context Kontena::Cli::TableGenerator::Helper do
9
13
  let(:klass) { Class.new(Kontena::Command) }
10
14
 
@@ -32,11 +32,13 @@ module OutputHelpers
32
32
  supports_block_expectations
33
33
 
34
34
  match do |block|
35
+ @errors = []
36
+
35
37
  @expected = lines
36
38
  begin
37
39
  @real = CaptureStdoutLines.capture(block)
38
40
  rescue Exception => error
39
- @error = error
41
+ @errors = [error.to_s]
40
42
  return false
41
43
  end
42
44
 
@@ -52,23 +54,27 @@ module OutputHelpers
52
54
  line = 0
53
55
  @real.zip(@expected) do |real, expected|
54
56
  line += 1
55
- error = values_match?(real.split(/\S+/), expected)
56
- if error
57
- @error ||= ""
58
- @error << "\n#{error}"
59
- @error.strip!
57
+ fields = real.split(/\s{2,}/)
58
+ unless values_match?(fields, expected)
59
+ @errors << [
60
+ "on line #{line}:",
61
+ " expected: #{expected}",
62
+ " received: #{fields}",
63
+ ].join("\n")
60
64
  end
61
65
  end
62
66
  else
63
- @error = "expected #{@expected.size} lines but got #{@real.size} lines instead:\n"
64
- @error += "Expected:\n#{@expected.map(&:inspect).join("\n")}"
65
- @error += "Received:\n#{@real.map(&:inspect).join("\n")}"
67
+ @errors << [
68
+ "expected #{@expected.size} lines but got #{@real.size} lines instead:",
69
+ " Expected:", @expected.map{|l| l.inspect},
70
+ " Received:", @real.map{|l| l.split(/\s{2,}/).inspect},
71
+ ].join("\n")
66
72
  end
67
- @error.nil?
73
+ @errors.empty?
68
74
  end
69
75
 
70
76
  failure_message do |block|
71
- @error
77
+ @errors.join "\n"
72
78
  end
73
79
 
74
80
  chain :with_header do |header|
@@ -78,10 +84,6 @@ module OutputHelpers
78
84
  chain :without_header do
79
85
  @no_header = true
80
86
  end
81
-
82
- failure_message do |block|
83
- return @error
84
- end
85
87
  end
86
88
 
87
89
  matcher :output_lines do |lines|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -682,9 +682,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
682
682
  version: 2.1.0
683
683
  required_rubygems_version: !ruby/object:Gem::Requirement
684
684
  requirements:
685
- - - ">="
685
+ - - ">"
686
686
  - !ruby/object:Gem::Version
687
- version: '0'
687
+ version: 1.3.1
688
688
  requirements: []
689
689
  rubyforge_project:
690
690
  rubygems_version: 2.6.8