rancher-shell 0.2.2 → 0.3.0.pre.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.simplecov +6 -0
- data/Gemfile.lock +42 -31
- data/README.md +4 -1
- data/circle.yml +15 -0
- data/lib/rancher/shell/all.rb +11 -0
- data/lib/rancher/shell/api.rb +3 -1
- data/lib/rancher/shell/cli.rb +29 -0
- data/lib/rancher/shell/commands/exec.rb +27 -17
- data/lib/rancher/shell/logger.rb +34 -15
- data/lib/rancher/shell/logger_helper.rb +7 -4
- data/lib/rancher/shell/version.rb +1 -1
- data/lib/rancher/shell/websocket_client.rb +19 -15
- data/rancher-shell.gemspec +8 -7
- data/script/console +9 -0
- metadata +37 -20
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbda750261215c71859616b4119877507a5a1262
|
4
|
+
data.tar.gz: be31cf59794281f7d00fb864800697f734514a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 689e599c4460ea827c7c7eb4f6ef498b5e72331e9d790b82669ce1382e556ccfde8566d5b16b50e65453b6ac152318fc62e4b741311791e8947ed301a880f032
|
7
|
+
data.tar.gz: aaac2e652a5adc97c17e588ca42d9e06a2dc5b97a02e67f52e38801de1199e886e1fc66d5588f0e2de77738fd2880897d1734191208466fe9a45637182a8395a
|
data/.gitignore
CHANGED
data/.simplecov
ADDED
data/Gemfile.lock
CHANGED
@@ -1,53 +1,64 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rancher-shell (0.
|
5
|
-
activesupport (~> 5.
|
6
|
-
event_emitter (~> 0.2.
|
7
|
-
thor (~> 0.
|
8
|
-
websocket (~> 1.2.
|
4
|
+
rancher-shell (0.3.0.pre.alpha2)
|
5
|
+
activesupport (~> 5.1.5)
|
6
|
+
event_emitter (~> 0.2.6)
|
7
|
+
thor (~> 0.20.0)
|
8
|
+
websocket (~> 1.2.5)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (5.
|
13
|
+
activesupport (5.1.5)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (~> 0.7)
|
16
16
|
minitest (~> 5.1)
|
17
17
|
tzinfo (~> 1.1)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
codeclimate-test-reporter (1.0.8)
|
19
|
+
simplecov (<= 0.13)
|
20
|
+
concurrent-ruby (1.0.5)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
docile (1.1.5)
|
23
|
+
event_emitter (0.2.6)
|
24
|
+
i18n (0.9.5)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
json (2.1.0)
|
27
|
+
minitest (5.11.3)
|
28
|
+
rake (12.3.0)
|
29
|
+
rspec (3.7.0)
|
30
|
+
rspec-core (~> 3.7.0)
|
31
|
+
rspec-expectations (~> 3.7.0)
|
32
|
+
rspec-mocks (~> 3.7.0)
|
33
|
+
rspec-core (3.7.1)
|
34
|
+
rspec-support (~> 3.7.0)
|
35
|
+
rspec-expectations (3.7.0)
|
31
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-mocks (3.7.0)
|
34
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-support (3.7.1)
|
42
|
+
simplecov (0.13.0)
|
43
|
+
docile (~> 1.1.0)
|
44
|
+
json (>= 1.8, < 3)
|
45
|
+
simplecov-html (~> 0.10.0)
|
46
|
+
simplecov-html (0.10.2)
|
47
|
+
thor (0.20.0)
|
48
|
+
thread_safe (0.3.6)
|
49
|
+
tzinfo (1.2.5)
|
40
50
|
thread_safe (~> 0.1)
|
41
|
-
websocket (1.2.
|
51
|
+
websocket (1.2.5)
|
42
52
|
|
43
53
|
PLATFORMS
|
44
54
|
ruby
|
45
55
|
|
46
56
|
DEPENDENCIES
|
47
|
-
bundler (
|
48
|
-
|
57
|
+
bundler (>= 1.15.4)
|
58
|
+
codeclimate-test-reporter (~> 1.0.8)
|
59
|
+
rake (~> 12.3.0)
|
49
60
|
rancher-shell!
|
50
|
-
rspec (~> 3.
|
61
|
+
rspec (~> 3.7.0)
|
51
62
|
|
52
63
|
BUNDLED WITH
|
53
|
-
1.
|
64
|
+
1.16.1
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# RancherShell
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rancher-shell.svg)](https://badge.fury.io/rb/rancher-shell)
|
4
|
-
[![
|
4
|
+
[![CircleCI](https://circleci.com/gh/marcqualie/rancher-shell.svg?style=shield)](https://circleci.com/gh/marcqualie/rancher-shell)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/marcqualie/rancher-shell/badges/gpa.svg)](https://codeclimate.com/github/marcqualie/rancher-shell)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/marcqualie/rancher-shell/badges/coverage.svg)](https://codeclimate.com/github/marcqualie/rancher-shell/coverage)
|
7
|
+
[![Issue Count](https://codeclimate.com/github/marcqualie/rancher-shell/badges/issue_count.svg)](https://codeclimate.com/github/marcqualie/rancher-shell)
|
5
8
|
|
6
9
|
A console utility for shelling into [Rancher](http://rancher.com) containers
|
7
10
|
|
data/circle.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
machine:
|
2
|
+
ruby:
|
3
|
+
version: 2.4.2
|
4
|
+
|
5
|
+
dependencies:
|
6
|
+
cache_directories:
|
7
|
+
- "vendor/bundle"
|
8
|
+
override:
|
9
|
+
- gem install bundler
|
10
|
+
- bundle install -j4 --path vendor/bundle
|
11
|
+
|
12
|
+
test:
|
13
|
+
override:
|
14
|
+
- bundle exec rspec --format documentation
|
15
|
+
- bundle exec codeclimate-test-reporter
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "rancher/shell"
|
2
|
+
require "rancher/shell/api_response"
|
3
|
+
require "rancher/shell/api"
|
4
|
+
require "rancher/shell/cli"
|
5
|
+
require "rancher/shell/config"
|
6
|
+
require "rancher/shell/logger_helper"
|
7
|
+
require "rancher/shell/logger"
|
8
|
+
require "rancher/shell/version"
|
9
|
+
require "rancher/shell/websocket_client"
|
10
|
+
|
11
|
+
require "rancher/shell/commands/exec"
|
data/lib/rancher/shell/api.rb
CHANGED
@@ -9,10 +9,12 @@ module Rancher
|
|
9
9
|
user: nil,
|
10
10
|
pass: nil,
|
11
11
|
host: 'rancher.example.com',
|
12
|
+
environment: nil,
|
12
13
|
}
|
13
14
|
|
14
15
|
def initialize options = {}
|
15
16
|
@options = DEFAULT_OPTIONS.merge options
|
17
|
+
raise "Environment is required for Rancher version 1.3+" unless @options[:environment].is_a?(String)
|
16
18
|
end
|
17
19
|
|
18
20
|
def get resource, data = nil, headers = {}
|
@@ -24,7 +26,7 @@ module Rancher
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def request method_name, resource, data, headers
|
27
|
-
uri = URI "https://#{@options[:host]}/v1/#{resource}"
|
29
|
+
uri = URI "https://#{@options[:host]}/v1/projects/#{@options[:environment]}/#{resource}"
|
28
30
|
Net::HTTP.start uri.host, uri.port, use_ssl: true do |http|
|
29
31
|
method_class_name = "Net::HTTP::#{method_name.to_s.split('_').map(&:capitalize).join}"
|
30
32
|
method_class = Object.const_get method_class_name
|
data/lib/rancher/shell/cli.rb
CHANGED
@@ -6,6 +6,8 @@ require 'thor'
|
|
6
6
|
module Rancher
|
7
7
|
module Shell
|
8
8
|
class CLI < Thor
|
9
|
+
include LoggerHelper
|
10
|
+
|
9
11
|
map %w[-v --version] => :version
|
10
12
|
desc 'version', 'display gem version'
|
11
13
|
def version
|
@@ -21,6 +23,7 @@ module Rancher
|
|
21
23
|
'project' => options[:project],
|
22
24
|
'container' => options[:container],
|
23
25
|
'stack' => options[:stack],
|
26
|
+
'environment' => options[:environment],
|
24
27
|
'command' => command,
|
25
28
|
)
|
26
29
|
instance = Rancher::Shell::Commands::Exec.new
|
@@ -65,6 +68,32 @@ module Rancher
|
|
65
68
|
print "\n"
|
66
69
|
end
|
67
70
|
end
|
71
|
+
|
72
|
+
desc "logs", "Display logs"
|
73
|
+
option :tail, aliases: '-t'
|
74
|
+
option :lines, aliases: '-n'
|
75
|
+
def logs
|
76
|
+
filename = logger.instance_variable_get(:'@logdev').filename
|
77
|
+
tail_command = "tail#{options[:tail] ? " -f -n#{options[:lines] || 0}" : " -n#{options[:lines] || 10}"} #{filename}"
|
78
|
+
puts "==> displaying logs from #{filename} <=="
|
79
|
+
puts " #{tail_command}"
|
80
|
+
begin
|
81
|
+
if options[:tail]
|
82
|
+
f = IO.popen(tail_command.split(' '))
|
83
|
+
loop do
|
84
|
+
Kernel.select([f])
|
85
|
+
while line = f.gets do
|
86
|
+
puts line
|
87
|
+
end
|
88
|
+
end
|
89
|
+
else
|
90
|
+
puts `#{tail_command}`
|
91
|
+
end
|
92
|
+
rescue Exception => e
|
93
|
+
puts " #{e.message}"
|
94
|
+
puts "==> end of log output <=="
|
95
|
+
end
|
96
|
+
end
|
68
97
|
end
|
69
98
|
end
|
70
99
|
end
|
@@ -23,10 +23,10 @@ module Rancher
|
|
23
23
|
|
24
24
|
def listen!
|
25
25
|
begin
|
26
|
-
logger.info "listening"
|
26
|
+
logger.info "listening for keyboaard input"
|
27
27
|
system("stty raw")
|
28
28
|
while input = STDIN.getc
|
29
|
-
@websocket.send
|
29
|
+
@websocket.send(Base64.encode64 input)
|
30
30
|
end
|
31
31
|
ensure
|
32
32
|
system("stty -raw echo")
|
@@ -34,16 +34,18 @@ module Rancher
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def setup_api!
|
37
|
+
logger.info "authorizing with #{@config['project']['api']['host']}"
|
37
38
|
@api = Rancher::Shell::Api.new(
|
38
39
|
host: @config['project']['api']['host'],
|
39
40
|
user: @config['project']['api']['key'],
|
40
41
|
pass: @config['project']['api']['secret'],
|
42
|
+
environment: @config['project']['api']['environment'],
|
41
43
|
)
|
42
44
|
end
|
43
45
|
|
44
46
|
def retrieve_containers!
|
45
47
|
@response = @api.get(
|
46
|
-
"containers",
|
48
|
+
"containers?limit=1000",
|
47
49
|
)
|
48
50
|
@containers = @response.json['data'].map do |container|
|
49
51
|
{
|
@@ -51,8 +53,13 @@ module Rancher
|
|
51
53
|
'name' => container['name'],
|
52
54
|
'state' => container['state'],
|
53
55
|
'ports' => container['ports'],
|
56
|
+
'stack' => container['labels'] && container['labels']['io.rancher.stack.name'],
|
54
57
|
}
|
55
58
|
end
|
59
|
+
logger.debug " containers #{@containers.count}"
|
60
|
+
@containers.sort_by { |container| "#{container['stack']}/#{container['name']}" }.each do |container|
|
61
|
+
logger.debug " #{container['stack']} / #{container['name']} #{container['state']}"
|
62
|
+
end
|
56
63
|
@container = @containers.find { |container| container['name'] === @config['options']['container'] }
|
57
64
|
exit_with_error "could not find container: #{@config['options']['container']}" unless @container
|
58
65
|
end
|
@@ -61,38 +68,41 @@ module Rancher
|
|
61
68
|
logger.info "container = #{@container['id']}"
|
62
69
|
# default_bash_command = "TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c \"/bin/bash\" /dev/null || exec /bin/bash) || exec /bin/sh"
|
63
70
|
# @config['options']['command'] = default_bash_command if @config['options']['command'] === 'bash'
|
64
|
-
|
71
|
+
bash_command = @config['options']['command']
|
72
|
+
logger.debug "running command: #{bash_command}"
|
65
73
|
@response = @api.post(
|
66
74
|
"containers/#{@container['id']}?action=execute",
|
67
75
|
"command" => [
|
68
76
|
"/bin/sh",
|
69
77
|
"-c",
|
70
|
-
|
78
|
+
bash_command,
|
71
79
|
],
|
72
80
|
"attachStdin" => true,
|
73
81
|
"attachStdout" => true,
|
74
82
|
"tty" => true,
|
75
83
|
)
|
76
84
|
websocket_url = "#{@response.json['url']}?token=#{@response.json['token']}"
|
77
|
-
logger.info "connecting to #{@response.json['url']}
|
85
|
+
logger.info "connecting to #{@response.json['url']}"
|
78
86
|
@websocket = Rancher::Shell::WebsocketClient.new websocket_url, headers: { 'Authorization' => "Bearer #{@response.json['token']}"}
|
79
87
|
@websocket.on :open do |event|
|
80
|
-
logger.info "
|
81
|
-
end
|
82
|
-
@websocket.on :chunk do |encoded_chunk|
|
83
|
-
chunk = Base64.decode64 encoded_chunk
|
84
|
-
emit :message, chunk
|
88
|
+
logger.info "connected to websocket"
|
85
89
|
end
|
86
|
-
@websocket.on :
|
87
|
-
|
90
|
+
@websocket.on :chunk do |chunk_encoded|
|
91
|
+
chunk_decoded = Base64.decode64(chunk_encoded)
|
92
|
+
chunk_codes = chunk_decoded.split('').map { |char| char.ord.to_s }
|
93
|
+
logger.debug("output: (#{chunk_decoded.length} bytes)")
|
94
|
+
logger.debug(" #{chunk_encoded}")
|
95
|
+
logger.debug(" #{chunk_codes.join(' ')}")
|
96
|
+
logger.debug(" #{chunk_decoded}")
|
97
|
+
$stdout.print(chunk_decoded)
|
88
98
|
end
|
89
99
|
@websocket.on :error do |event|
|
90
|
-
logger.error
|
91
|
-
Kernel.exit
|
100
|
+
logger.error("socket error: #{event}")
|
101
|
+
Kernel.exit(true)
|
92
102
|
end
|
93
103
|
@websocket.on :close do
|
94
|
-
logger.
|
95
|
-
Kernel.exit
|
104
|
+
logger.info("server closed connection")
|
105
|
+
Kernel.exit(true)
|
96
106
|
end
|
97
107
|
end
|
98
108
|
end
|
data/lib/rancher/shell/logger.rb
CHANGED
@@ -1,24 +1,43 @@
|
|
1
|
+
require "logger"
|
2
|
+
|
1
3
|
module Rancher
|
2
4
|
module Shell
|
3
|
-
class Logger
|
4
|
-
def
|
5
|
-
|
5
|
+
class Logger < ::Logger
|
6
|
+
def initialize(*args)
|
7
|
+
super
|
8
|
+
@formatter = Formatter.new
|
9
|
+
# TODO: Use whitelist here for better security
|
10
|
+
@level = ::Logger.const_get(ENV['LOG_LEVEL'].upcase) rescue ::Logger::INFO
|
6
11
|
end
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
class Formatter < ::Logger::Formatter
|
14
|
+
# Default: "%s, [%s#%d] %5s -- %s: %s\n"
|
15
|
+
Format = "%s, [%s#%d] %5s -- %s: [RANCHER::SHELL] %s\n"
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def warn message
|
17
|
-
$stderr.puts "[#{DateTime.now.strftime '%Y-%m-%d %H:%M:%S'}] WARN -- : #{message}"
|
18
|
-
end
|
17
|
+
def call(severity, time, progname, msg)
|
18
|
+
msg = sanitize_escape_sequences(msg)
|
19
|
+
Format % [severity[0..0], format_datetime(time), $$, severity, progname, msg2str(msg)]
|
20
|
+
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
# Some escape charatcers cause weirdness within logs and STDOUT
|
23
|
+
# http://www.asciitable.com/
|
24
|
+
# https://en.wikipedia.org/wiki/ANSI_escape_code
|
25
|
+
def sanitize_escape_sequences(msg)
|
26
|
+
msg = msg.gsub("\r", "[CR]")
|
27
|
+
msg = msg.gsub("\n", "[LF]")
|
28
|
+
msg = msg.gsub(/\e\[A/, '[CUU]')
|
29
|
+
msg = msg.gsub(/\e\[B/, '[CUD]')
|
30
|
+
msg = msg.gsub(/\e\[2K/, '[CLEAR]')
|
31
|
+
msg = msg.gsub(/#{3.chr}/, '[ETX]')
|
32
|
+
msg = msg.gsub(/#{4.chr}/, '[EOT]')
|
33
|
+
msg = msg.gsub(/#{7.chr}/, '[BELL]')
|
34
|
+
msg = msg.gsub(/#{8.chr}/, '[BS]')
|
35
|
+
msg = msg.gsub(/#{9.chr}/, '[TAB]')
|
36
|
+
msg = msg.gsub(/#{24.chr}/, '[CAN]')
|
37
|
+
msg = msg.gsub(/#{27.chr}/, '[ESC]')
|
38
|
+
msg = msg.gsub(/#{127.chr}/, '[DEL]')
|
39
|
+
msg
|
40
|
+
end
|
22
41
|
end
|
23
42
|
end
|
24
43
|
end
|
@@ -3,13 +3,16 @@ require 'rancher/shell/logger'
|
|
3
3
|
module Rancher
|
4
4
|
module Shell
|
5
5
|
module LoggerHelper
|
6
|
+
DEFAULT_LOG_FILE = "/tmp/rancher-shell.log"
|
7
|
+
|
6
8
|
def logger
|
7
|
-
@
|
9
|
+
@log_file = ENV['RANCHER_SHELL_LOG_FILE'] && File.exist?(ENV['RANCHER_SHELL_LOG_FILE']) ? ENV['RANCHER_SHELL_LOG_FILE'] : DEFAULT_LOG_FILE
|
10
|
+
@logger ||= Logger.new(@log_file)
|
8
11
|
end
|
9
12
|
|
10
|
-
def exit_with_error
|
11
|
-
logger.error
|
12
|
-
Kernel.exit
|
13
|
+
def exit_with_error(message)
|
14
|
+
logger.error(message)
|
15
|
+
Kernel.exit(false)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
@@ -29,22 +29,19 @@ module Rancher
|
|
29
29
|
@pipe_broken = false
|
30
30
|
frame = ::WebSocket::Frame::Incoming::Client.new
|
31
31
|
@closed = false
|
32
|
-
once :__close do |err|
|
33
|
-
close
|
34
|
-
emit :close, err
|
35
|
-
end
|
36
32
|
|
37
33
|
@thread = Thread.new do
|
38
34
|
while !@closed do
|
39
35
|
begin
|
40
36
|
unless recv_data = @socket.getc
|
41
|
-
sleep
|
37
|
+
sleep 0.25
|
42
38
|
next
|
43
39
|
end
|
44
40
|
unless @handshaked
|
45
41
|
@handshake << recv_data
|
46
42
|
if @handshake.finished?
|
47
43
|
@handshaked = true
|
44
|
+
logger.debug("handshake complete")
|
48
45
|
emit :open
|
49
46
|
end
|
50
47
|
else
|
@@ -54,47 +51,54 @@ module Rancher
|
|
54
51
|
end
|
55
52
|
end
|
56
53
|
rescue => e
|
57
|
-
puts "
|
54
|
+
puts "broken pipe error thing"
|
55
|
+
logger.error("EMIT ERROR: #{e.to_yaml}")
|
58
56
|
emit :error, e
|
59
57
|
end
|
60
58
|
end
|
61
|
-
|
59
|
+
logger.error("THREAD IS DEAD")
|
62
60
|
end
|
63
61
|
|
64
62
|
@socket.write @handshake.to_s
|
65
63
|
end
|
66
64
|
|
67
|
-
def send(
|
65
|
+
def send(data_encoded, opt={:type => :text})
|
66
|
+
data_decoded = Base64.decode64(data_encoded)
|
68
67
|
if !@handshaked or @closed
|
69
|
-
|
68
|
+
logger.warn("cannot send data because socket is closed")
|
70
69
|
return
|
71
70
|
end
|
72
71
|
type = opt[:type]
|
73
|
-
|
72
|
+
data_codes = data_decoded.split('').map { |char| char.ord.to_s }
|
73
|
+
logger.debug("input: (#{data_encoded.length} bytes)")
|
74
|
+
logger.debug(" #{data_encoded}")
|
75
|
+
logger.debug(" #{data_codes.join(' ')}")
|
76
|
+
logger.debug(" #{data_decoded}")
|
77
|
+
frame = ::WebSocket::Frame::Outgoing::Client.new(:data => data_encoded, :type => type, :version => @handshake.version)
|
74
78
|
begin
|
75
|
-
@socket.write
|
79
|
+
@socket.write(frame.to_s)
|
76
80
|
rescue Errno::EPIPE => e
|
81
|
+
puts "nroken pp"
|
77
82
|
@pipe_broken = true
|
78
|
-
emit :
|
83
|
+
emit :close, e
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
82
87
|
def close
|
83
88
|
return if @closed
|
89
|
+
logger.debug("client closed connection")
|
84
90
|
if !@pipe_broken
|
85
91
|
send nil, :type => :close
|
86
92
|
end
|
87
93
|
@closed = true
|
88
94
|
@socket.close if @socket
|
89
95
|
@socket = nil
|
90
|
-
|
91
|
-
Thread.kill @thread if @thread
|
96
|
+
Thread.kill(@thread) if @thread
|
92
97
|
end
|
93
98
|
|
94
99
|
def open?
|
95
100
|
@handshake.finished? and !@closed
|
96
101
|
end
|
97
|
-
|
98
102
|
end
|
99
103
|
end
|
100
104
|
end
|
data/rancher-shell.gemspec
CHANGED
@@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency
|
22
|
-
spec.add_dependency
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency "websocket", "~> 1.2.5"
|
22
|
+
spec.add_dependency "event_emitter", "~> 0.2.6"
|
23
|
+
spec.add_dependency "thor", "~> 0.20.0"
|
24
|
+
spec.add_dependency "activesupport", "~> 5.1.5"
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "bundler", ">= 1.15.4"
|
27
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.8"
|
28
|
+
spec.add_development_dependency "rake", "~> 12.3.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.7.0"
|
29
30
|
end
|
data/script/console
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rancher-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0.pre.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Qualie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|
@@ -16,98 +16,112 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.
|
19
|
+
version: 1.2.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2.
|
26
|
+
version: 1.2.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: event_emitter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.
|
40
|
+
version: 0.2.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.20.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.20.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.
|
61
|
+
version: 5.1.5
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.
|
68
|
+
version: 5.1.5
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.15.4
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.15.4
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
89
|
+
version: 1.0.8
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
96
|
+
version: 1.0.8
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rake
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 12.3.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 12.3.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rspec
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
117
|
+
version: 3.7.0
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
124
|
+
version: 3.7.0
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- marc@marcqualie.com
|
@@ -118,7 +132,7 @@ extra_rdoc_files: []
|
|
118
132
|
files:
|
119
133
|
- ".gitignore"
|
120
134
|
- ".rspec"
|
121
|
-
- ".
|
135
|
+
- ".simplecov"
|
122
136
|
- CHANGELOG.md
|
123
137
|
- CODE_OF_CONDUCT.md
|
124
138
|
- Gemfile
|
@@ -127,7 +141,9 @@ files:
|
|
127
141
|
- README.md
|
128
142
|
- Rakefile
|
129
143
|
- bin/rancher-shell
|
144
|
+
- circle.yml
|
130
145
|
- lib/rancher/shell.rb
|
146
|
+
- lib/rancher/shell/all.rb
|
131
147
|
- lib/rancher/shell/api.rb
|
132
148
|
- lib/rancher/shell/api_response.rb
|
133
149
|
- lib/rancher/shell/cli.rb
|
@@ -138,6 +154,7 @@ files:
|
|
138
154
|
- lib/rancher/shell/version.rb
|
139
155
|
- lib/rancher/shell/websocket_client.rb
|
140
156
|
- rancher-shell.gemspec
|
157
|
+
- script/console
|
141
158
|
homepage: https://github.com/marcqualie/rancher-shell
|
142
159
|
licenses:
|
143
160
|
- MIT
|
@@ -153,12 +170,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
170
|
version: '0'
|
154
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
172
|
requirements:
|
156
|
-
- - "
|
173
|
+
- - ">"
|
157
174
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
175
|
+
version: 1.3.1
|
159
176
|
requirements: []
|
160
177
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.6.
|
178
|
+
rubygems_version: 2.6.13
|
162
179
|
signing_key:
|
163
180
|
specification_version: 4
|
164
181
|
summary: A console utility for shelling into Rancher containers
|
data/.travis.yml
DELETED