eac_ruby_utils 0.40.0 → 0.41.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e04909bde0d65f8b8615601194b4fb9c1fb3b6b56f6bf02cd98103fe0510e7b
|
4
|
+
data.tar.gz: 902d0c69a54f0a0330c4e47afa498501b02beec6367c6d952f6d72f8388b74c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbaf478b74fbb77fff8682b733685773ad8c3de4eac8e5fc9c2adcca81fbeac56a5e4df330c0ffb60097f1c3d75b371270814b52ca1bd54ef77fa417adf55284
|
7
|
+
data.tar.gz: 947edd1f4ba4f942ba78ed5e17f99b95d1d89f456426437efa6c3eb35128c12b312fb628f962f0e123a38d8ea37c6fa7a135d1c4c4d7d1b6f9b6449e465458ed
|
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
require 'addressable'
|
4
4
|
require 'eac_ruby_utils/envs/base_env'
|
5
|
+
require 'eac_ruby_utils/patches/object/if_present'
|
5
6
|
require 'net/ssh'
|
6
7
|
require 'shellwords'
|
7
8
|
|
8
9
|
module EacRubyUtils
|
9
10
|
module Envs
|
10
11
|
class SshEnv < ::EacRubyUtils::Envs::BaseEnv
|
12
|
+
IDENTITITY_FILE_OPTION = 'IdentityFile'
|
11
13
|
USER_PATTERN = /[a-z_][a-z0-9_-]*/.freeze
|
12
14
|
HOSTNAME_PATTERN = /[^@]+/.freeze
|
13
15
|
USER_HOSTNAME_PATTERN = /\A(?:(#{USER_PATTERN})@)?(#{HOSTNAME_PATTERN})\z/.freeze
|
@@ -51,6 +53,7 @@ module EacRubyUtils
|
|
51
53
|
def ssh_command_line
|
52
54
|
r = %w[ssh]
|
53
55
|
r += ['-p', uri.port] if uri.port.present?
|
56
|
+
ssh_identity_file.if_present { |v| r += ['-i', v] }
|
54
57
|
r += ssh_command_line_options
|
55
58
|
r << user_hostname_uri
|
56
59
|
r.map { |a| Shellwords.escape(a) }.join(' ')
|
@@ -58,7 +61,9 @@ module EacRubyUtils
|
|
58
61
|
|
59
62
|
def ssh_command_line_options
|
60
63
|
r = []
|
61
|
-
uri.query_values&.each
|
64
|
+
uri.query_values&.each do |k, v|
|
65
|
+
r += ['-o', "#{k}=#{v}"] unless k == IDENTITITY_FILE_OPTION
|
66
|
+
end
|
62
67
|
r
|
63
68
|
end
|
64
69
|
|
@@ -67,6 +72,12 @@ module EacRubyUtils
|
|
67
72
|
r = "#{uri.user}@#{r}" if uri.user.present?
|
68
73
|
r
|
69
74
|
end
|
75
|
+
|
76
|
+
def ssh_identity_file
|
77
|
+
uri.query_values.if_present do |v|
|
78
|
+
v[IDENTITITY_FILE_OPTION]
|
79
|
+
end
|
80
|
+
end
|
70
81
|
end
|
71
82
|
end
|
72
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.41.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|