con_ssh 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop-custom.yml +3 -2
- data/Gemfile +3 -0
- data/Gemfile.lock +11 -0
- data/README.md +5 -1
- data/bin/con +1 -1
- data/con_ssh.gemspec +2 -2
- data/lib/con_ssh.rb +6 -6
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 137f168cdca2e68c14620a3cf7a2a607e907fdd4
|
|
4
|
+
data.tar.gz: f1407e891cb892b15642cb5a32c191ff2fb34489
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d27d00f6549f552792aacaf9c8860204fa7a9d560b4f58e6c98f2335f2bfb312335cec66793907bae65a5a6f7d21040242c781eb56906831b64d3504f9af8bf5
|
|
7
|
+
data.tar.gz: 46421bc2a2c28170a083c9c7f0040f4cf757d1a565c8d1353218d853e65391efdff5d6ac8807894761dd6fafee6973d8e8efea739626e4f8adccba7580c27877
|
data/.rubocop-custom.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
AllCops:
|
|
2
2
|
DisabledByDefault: true
|
|
3
|
-
TargetRubyVersion: 2.
|
|
3
|
+
TargetRubyVersion: 2.0
|
|
4
4
|
|
|
5
5
|
#################### Lint ################################
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
|
20
20
|
Lint/AssignmentInCondition:
|
|
21
21
|
Description: "Don't use assignment in conditions."
|
|
22
22
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
|
23
|
-
Enabled:
|
|
23
|
+
Enabled: false
|
|
24
24
|
|
|
25
25
|
Lint/BlockAlignment:
|
|
26
26
|
Description: 'Align block ends correctly.'
|
|
@@ -230,6 +230,7 @@ Metrics/CyclomaticComplexity:
|
|
|
230
230
|
A complexity metric that is strongly correlated to the number
|
|
231
231
|
of test cases needed to validate a method.
|
|
232
232
|
Enabled: true
|
|
233
|
+
Max: 10
|
|
233
234
|
|
|
234
235
|
Metrics/LineLength:
|
|
235
236
|
Description: 'Limit lines to 80 characters.'
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
con_ssh
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
[](https://badge.fury.io/rb/con_ssh)
|
|
4
|
+
[](https://badge.fury.io/rb/con_ssh)
|
|
5
|
+
[](https://codeclimate.com/github/tomlobato/con_ssh)
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
By [Bettercall.io](https://bettercall.io/).
|
data/bin/con
CHANGED
data/con_ssh.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "con_ssh"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.3"
|
|
4
4
|
s.authors = ["Tom Lobato"]
|
|
5
5
|
s.email = "lobato@bettercall.io"
|
|
6
6
|
# s.homepage = "http://sys-watchdog.bettercall.io/"
|
|
@@ -13,6 +13,6 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
|
14
14
|
s.require_paths = ["lib"]
|
|
15
15
|
s.executables = %w(con)
|
|
16
|
-
s.required_ruby_version = '>= 2.
|
|
16
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
17
17
|
end
|
|
18
18
|
|
data/lib/con_ssh.rb
CHANGED
|
@@ -69,7 +69,7 @@ class SSHCon
|
|
|
69
69
|
Please install: 'apt-get install knockd', 'brew install knock', ...".strip_text
|
|
70
70
|
warn msg
|
|
71
71
|
return
|
|
72
|
-
|
|
72
|
+
end
|
|
73
73
|
run_cmd "knock #{ host } #{ ports.join ' ' }", false
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -88,7 +88,7 @@ class SSHCon
|
|
|
88
88
|
def add_connection line
|
|
89
89
|
return if skip_line? line
|
|
90
90
|
|
|
91
|
-
values = line.split
|
|
91
|
+
values = line.split(/\s+/)
|
|
92
92
|
|
|
93
93
|
conn_conf = OpenStruct.new
|
|
94
94
|
CONF_LINE_FIELDS.each_with_index do |field, idx|
|
|
@@ -117,7 +117,7 @@ class SSHCon
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
def adjust_conn_conf c
|
|
120
|
-
c.knock = c.knock.split
|
|
120
|
+
c.knock = c.knock.split ',' if c.knock
|
|
121
121
|
c.unknock = c.unknock.split ',' if c.unknock
|
|
122
122
|
|
|
123
123
|
if c.host =~ /^(.*?)@(.*?)$/
|
|
@@ -167,9 +167,9 @@ class SSHCon
|
|
|
167
167
|
|
|
168
168
|
def run_cmd cmd, print = true
|
|
169
169
|
puts "run: #{cmd}" if print
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
output = `#{cmd} 2>&1`
|
|
171
|
+
exit_status = $?.to_i
|
|
172
|
+
unless exit_status == 0
|
|
173
173
|
warn "Non-zero output: #{output}"
|
|
174
174
|
end
|
|
175
175
|
[exit_status, output]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: con_ssh
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Lobato
|
|
@@ -21,6 +21,8 @@ files:
|
|
|
21
21
|
- ".gitignore"
|
|
22
22
|
- ".rubocop-custom.yml"
|
|
23
23
|
- ".ruby-version"
|
|
24
|
+
- Gemfile
|
|
25
|
+
- Gemfile.lock
|
|
24
26
|
- README.md
|
|
25
27
|
- Rakefile
|
|
26
28
|
- TODO
|
|
@@ -42,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
42
44
|
requirements:
|
|
43
45
|
- - ">="
|
|
44
46
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 2.
|
|
47
|
+
version: 2.0.0
|
|
46
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
49
|
requirements:
|
|
48
50
|
- - ">="
|