sshkit 1.24.0 → 1.25.1
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/.github/workflows/ci.yml +16 -4
- data/.github/workflows/push.yml +3 -3
- data/lib/sshkit/backends/abstract.rb +2 -2
- data/lib/sshkit/version.rb +1 -1
- data/sshkit.gemspec +3 -1
- data/test/unit/backends/test_abstract.rb +55 -0
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b83fd21e919d61bd3450734fb1851783bc764ada7c3a5b8cc35695aeb4f18d8a
|
|
4
|
+
data.tar.gz: 3a879fca813f39b7bc69be9bc7036762e5f7b4998a451aa87df364950af92a56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aeb3fa346457c8bde230909d6d65f8cb195cc06eb7092583b5e564a77255cf68d4530732bb5baea1ea5e0d61e41001c54ee1d53a21708b80f6ce7964e34360da
|
|
7
|
+
data.tar.gz: 7b9dcba689465ffd425fa13fd91b32ef4a51de384880361ca5cd6fb57601975b10acf27dcb64b309e33bc99b76c2bea6fa43bdbf62acf3f185b1ee869eff9467
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -8,9 +8,21 @@ jobs:
|
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
ruby:
|
|
11
|
+
ruby:
|
|
12
|
+
[
|
|
13
|
+
"2.5",
|
|
14
|
+
"2.6",
|
|
15
|
+
"2.7",
|
|
16
|
+
"3.0",
|
|
17
|
+
"3.1",
|
|
18
|
+
"3.2",
|
|
19
|
+
"3.3",
|
|
20
|
+
"3.4",
|
|
21
|
+
"4.0",
|
|
22
|
+
"head",
|
|
23
|
+
]
|
|
12
24
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
25
|
+
- uses: actions/checkout@v6
|
|
14
26
|
- name: Set up Ruby
|
|
15
27
|
uses: ruby/setup-ruby@v1
|
|
16
28
|
with:
|
|
@@ -36,7 +48,7 @@ jobs:
|
|
|
36
48
|
rubocop:
|
|
37
49
|
runs-on: ubuntu-latest
|
|
38
50
|
steps:
|
|
39
|
-
- uses: actions/checkout@
|
|
51
|
+
- uses: actions/checkout@v6
|
|
40
52
|
- name: Set up Ruby
|
|
41
53
|
uses: ruby/setup-ruby@v1
|
|
42
54
|
with:
|
|
@@ -51,7 +63,7 @@ jobs:
|
|
|
51
63
|
matrix:
|
|
52
64
|
ruby: ["2.5", "ruby"]
|
|
53
65
|
steps:
|
|
54
|
-
- uses: actions/checkout@
|
|
66
|
+
- uses: actions/checkout@v6
|
|
55
67
|
- name: Set up Ruby
|
|
56
68
|
uses: ruby/setup-ruby@v1
|
|
57
69
|
with:
|
data/.github/workflows/push.yml
CHANGED
|
@@ -103,6 +103,7 @@ module SSHKit
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def as(who, &_block)
|
|
106
|
+
who_old = [@user, @group]
|
|
106
107
|
if who.is_a? Hash
|
|
107
108
|
@user = who[:user] || who["user"]
|
|
108
109
|
@group = who[:group] || who["group"]
|
|
@@ -118,8 +119,7 @@ module SSHKit
|
|
|
118
119
|
EOTEST
|
|
119
120
|
yield
|
|
120
121
|
ensure
|
|
121
|
-
|
|
122
|
-
remove_instance_variable(:@group)
|
|
122
|
+
@user, @group = *who_old
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
class << self
|
data/lib/sshkit/version.rb
CHANGED
data/sshkit.gemspec
CHANGED
|
@@ -10,7 +10,8 @@ Gem::Specification.new do |gem|
|
|
|
10
10
|
gem.homepage = "http://github.com/capistrano/sshkit"
|
|
11
11
|
gem.license = "MIT"
|
|
12
12
|
gem.metadata = {
|
|
13
|
-
"changelog_uri" => "https://github.com/capistrano/sshkit/releases"
|
|
13
|
+
"changelog_uri" => "https://github.com/capistrano/sshkit/releases",
|
|
14
|
+
"rubygems_mfa_required" => "true"
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
@@ -28,6 +29,7 @@ Gem::Specification.new do |gem|
|
|
|
28
29
|
gem.add_runtime_dependency('net-sftp', '>= 2.1.2')
|
|
29
30
|
gem.add_runtime_dependency('ostruct')
|
|
30
31
|
|
|
32
|
+
gem.add_development_dependency('benchmark')
|
|
31
33
|
gem.add_development_dependency('danger')
|
|
32
34
|
gem.add_development_dependency('minitest', '>= 5.0.0')
|
|
33
35
|
gem.add_development_dependency('minitest-reporters')
|
|
@@ -111,6 +111,61 @@ module SSHKit
|
|
|
111
111
|
assert_equal 'cd ~/foo && /usr/bin/env cat file', backend.executed_command.to_command
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
def test_as_properly_clears
|
|
115
|
+
backend = ExampleBackend.new do
|
|
116
|
+
as :root do
|
|
117
|
+
execute :cat, 'file', :strip => false
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
execute :cat, 'file', :strip => false
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
backend.run
|
|
124
|
+
|
|
125
|
+
assert_equal '/usr/bin/env cat file', backend.executed_command.to_command
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_as_root
|
|
129
|
+
backend = ExampleBackend.new do
|
|
130
|
+
as :root do
|
|
131
|
+
execute :cat, 'file', :strip => false
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
backend.run
|
|
136
|
+
|
|
137
|
+
assert_equal 'sudo -u root -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def test_nested_as
|
|
141
|
+
backend = ExampleBackend.new do
|
|
142
|
+
as :root do
|
|
143
|
+
as :other_user do
|
|
144
|
+
execute :cat, 'file', :strip => false
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
backend.run
|
|
150
|
+
|
|
151
|
+
assert_equal 'sudo -u other_user -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_nested_as_properly_clears
|
|
155
|
+
backend = ExampleBackend.new do
|
|
156
|
+
as :root do
|
|
157
|
+
as :other_user do
|
|
158
|
+
execute :cat, 'file', :strip => false
|
|
159
|
+
end
|
|
160
|
+
execute :cat, 'file', :strip => false
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
backend.run
|
|
165
|
+
|
|
166
|
+
assert_equal 'sudo -u root -- sh -c /usr/bin/env\\ cat\\ file', backend.executed_command.to_command
|
|
167
|
+
end
|
|
168
|
+
|
|
114
169
|
def test_background_logs_deprecation_warnings
|
|
115
170
|
deprecation_out = +''
|
|
116
171
|
SSHKit.config.deprecation_output = deprecation_out
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sshkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.25.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lee Hambley
|
|
8
8
|
- Tom Clements
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -94,6 +94,20 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: benchmark
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
97
111
|
- !ruby/object:Gem::Dependency
|
|
98
112
|
name: danger
|
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -322,6 +336,7 @@ licenses:
|
|
|
322
336
|
- MIT
|
|
323
337
|
metadata:
|
|
324
338
|
changelog_uri: https://github.com/capistrano/sshkit/releases
|
|
339
|
+
rubygems_mfa_required: 'true'
|
|
325
340
|
rdoc_options: []
|
|
326
341
|
require_paths:
|
|
327
342
|
- lib
|
|
@@ -336,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
336
351
|
- !ruby/object:Gem::Version
|
|
337
352
|
version: '0'
|
|
338
353
|
requirements: []
|
|
339
|
-
rubygems_version:
|
|
354
|
+
rubygems_version: 4.0.16
|
|
340
355
|
specification_version: 4
|
|
341
356
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|
|
342
357
|
test_files:
|