net-ssh-cli 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -3
- data/lib/net/ssh/cli.rb +17 -0
- data/lib/net/ssh/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1b678f96b5758f1c1d5c17af957b177d2ca266e3c184a1e1df0e6124c3cd2f
|
4
|
+
data.tar.gz: a645c159917d066d1c86f7a6afb69fc7932c1ff7059524cbf296864673fc6454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa3eef297fc1650a67a4c5245bee743640ab146e615e683afd2349a0d996760d7ad7076a29fb3922880f92a76532f1b69f54d0209241925f1fb53d2b6ef3509a
|
7
|
+
data.tar.gz: c438a6ec62a4416847dec30ce3fd2c0365bf05c5e9a18f3791b6c8405ac1e516dbad45e452c8f9d781008d2992a40a50b4a8364e789fb1b37c1db888e57dce38
|
data/.rubocop.yml
CHANGED
@@ -3,7 +3,14 @@ AllCops:
|
|
3
3
|
Exclude:
|
4
4
|
- 'bin/localhost'
|
5
5
|
Metrics/LineLength:
|
6
|
-
Max:
|
6
|
+
Max: 240
|
7
7
|
Metrics/BlockLength:
|
8
|
-
Max:
|
9
|
-
|
8
|
+
Max: 240
|
9
|
+
Style/SymbolArray:
|
10
|
+
EnforcedStyle: brackets
|
11
|
+
Naming/RescuedExceptionsVariableName:
|
12
|
+
PreferredName: error
|
13
|
+
Style/StringLiterals:
|
14
|
+
EnforcedStyle: double_quotes
|
15
|
+
Style/StringLiteralsInInterpolation:
|
16
|
+
EnforcedStyle: double_quotes
|
data/lib/net/ssh/cli.rb
CHANGED
@@ -41,6 +41,7 @@ module Net
|
|
41
41
|
default_prompt: /\n?^(\S+@.*)\z/, # the default prompt to search for
|
42
42
|
cmd_rm_prompt: false, # whether the prompt should be removed in the output of #cmd
|
43
43
|
cmd_rm_command: false, # whether the given command should be removed in the output of #cmd
|
44
|
+
run_impact: false, # whether to run #impact commands. This might align with testing|development|production. example #impact("reboot")
|
44
45
|
read_till_timeout: nil, # timeout for #read_till to find the match
|
45
46
|
named_prompts: ActiveSupport::HashWithIndifferentAccess.new, # you can used named prompts for #with_prompt {}
|
46
47
|
before_on_stdout_procs: ActiveSupport::HashWithIndifferentAccess.new, # procs to call before data arrives from the underlying connection
|
@@ -226,6 +227,22 @@ module Net
|
|
226
227
|
end
|
227
228
|
end
|
228
229
|
|
230
|
+
# the same as #cmd but it will only run the command if the option run_impact is set to true.
|
231
|
+
# this can be used for commands which you might not want to run in development|testing mode but in production
|
232
|
+
# cli.impact("reboot")
|
233
|
+
# => "skip: reboot"
|
234
|
+
# cli.run_impact = true
|
235
|
+
# cli.impact("reboot")
|
236
|
+
# => "system is going to reboot NOW"
|
237
|
+
def impact(command, **opts)
|
238
|
+
run_impact? ? cmd(command, **opts) : "skip: #{command.inspect}"
|
239
|
+
end
|
240
|
+
|
241
|
+
# same as #cmds but for #impact instead of #cmd
|
242
|
+
def impacts(*commands, **opts)
|
243
|
+
commands.flatten.map { |command| [command, impact(command, **opts)] }
|
244
|
+
end
|
245
|
+
|
229
246
|
def host
|
230
247
|
@net_ssh&.host
|
231
248
|
end
|
data/lib/net/ssh/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Stillhart
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|