sshkit 1.24.0 → 1.25.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 +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/lib/sshkit/backends/abstract.rb +2 -2
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/backends/test_abstract.rb +55 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab4c2342f826356f08f688cb17f29323b90c4a7ecc85836b1ceaf323c34ab13d
|
|
4
|
+
data.tar.gz: 1126ee211260588192c298847ce2a00b43c356d25751a13c6268f324b822d8a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6321a43251bc31e117660e049e53b35dec7154119a9fac2dce0e4eb855f8acc6b5539cbfe696e53457f8f6784eb8eebfa95a71c79e7b1a3a45b093d9e89e5ee
|
|
7
|
+
data.tar.gz: 41d021df58a4d4cd5f88762d29491fd71c603a97f31ac939d34825a42a27d1576dce5410cd6da7384833bb98fc107df1dfdaa4ca379d226b4f6417171ea2057f
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -10,7 +10,7 @@ jobs:
|
|
|
10
10
|
matrix:
|
|
11
11
|
ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"]
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v6
|
|
14
14
|
- name: Set up Ruby
|
|
15
15
|
uses: ruby/setup-ruby@v1
|
|
16
16
|
with:
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
rubocop:
|
|
37
37
|
runs-on: ubuntu-latest
|
|
38
38
|
steps:
|
|
39
|
-
- uses: actions/checkout@
|
|
39
|
+
- uses: actions/checkout@v6
|
|
40
40
|
- name: Set up Ruby
|
|
41
41
|
uses: ruby/setup-ruby@v1
|
|
42
42
|
with:
|
|
@@ -51,7 +51,7 @@ jobs:
|
|
|
51
51
|
matrix:
|
|
52
52
|
ruby: ["2.5", "ruby"]
|
|
53
53
|
steps:
|
|
54
|
-
- uses: actions/checkout@
|
|
54
|
+
- uses: actions/checkout@v6
|
|
55
55
|
- name: Set up Ruby
|
|
56
56
|
uses: ruby/setup-ruby@v1
|
|
57
57
|
with:
|
|
@@ -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
|
@@ -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.0
|
|
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
|
|
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
336
336
|
- !ruby/object:Gem::Version
|
|
337
337
|
version: '0'
|
|
338
338
|
requirements: []
|
|
339
|
-
rubygems_version: 3.
|
|
339
|
+
rubygems_version: 3.7.2
|
|
340
340
|
specification_version: 4
|
|
341
341
|
summary: SSHKit makes it easy to write structured, testable SSH commands in Ruby
|
|
342
342
|
test_files:
|