sshkit 0.0.13 → 0.0.14
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.
- data/CHANGELOG.md +7 -0
- data/lib/sshkit/command.rb +3 -0
- data/lib/sshkit/configuration.rb +1 -0
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/test_command.rb +24 -0
- data/test/unit/test_configuration.rb +6 -0
- metadata +1 -1
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.14
|
7
|
+
|
8
|
+
* Umasks can now be set on `Command` instances. It can be set globally with
|
9
|
+
`SSHKit.config.umask` (default, nil; meaning take the system default). This
|
10
|
+
can be used to set, for example a umask of `007` for allowing users with
|
11
|
+
the same primary group to share code without stepping on eachother's toes.
|
12
|
+
|
6
13
|
## 0.0.13
|
7
14
|
|
8
15
|
* Correctly quote `as(user)` commands, previously it would expand to:
|
data/lib/sshkit/command.rb
CHANGED
data/lib/sshkit/configuration.rb
CHANGED
data/lib/sshkit/version.rb
CHANGED
data/test/unit/test_command.rb
CHANGED
@@ -96,6 +96,30 @@ module SSHKit
|
|
96
96
|
assert_equal "( A=b sudo su anotheruser -c \"nohup /usr/bin/env sleep 15 > /dev/null &\" )", String(c)
|
97
97
|
end
|
98
98
|
|
99
|
+
def test_umask
|
100
|
+
SSHKit.config.umask = '007'
|
101
|
+
c = Command.new(:touch, 'somefile')
|
102
|
+
assert_equal "umask 007 && /usr/bin/env touch somefile", String(c)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_umask_with_working_directory
|
106
|
+
SSHKit.config.umask = '007'
|
107
|
+
c = Command.new(:touch, 'somefile', in: '/opt')
|
108
|
+
assert_equal "cd /opt && umask 007 && /usr/bin/env touch somefile", String(c)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_umask_with_working_directory_and_user
|
112
|
+
SSHKit.config.umask = '007'
|
113
|
+
c = Command.new(:touch, 'somefile', in: '/var', user: 'alice')
|
114
|
+
assert_equal "cd /var && sudo su alice -c \"umask 007 && /usr/bin/env touch somefile\"", String(c)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_umask_with_env_and_working_directory_and_user
|
118
|
+
SSHKit.config.umask = '007'
|
119
|
+
c = Command.new(:touch, 'somefile', user: 'bob', env: {a: 'b'}, in: '/var')
|
120
|
+
assert_equal "cd /var && ( A=b sudo su bob -c \"umask 007 && /usr/bin/env touch somefile\" )", String(c)
|
121
|
+
end
|
122
|
+
|
99
123
|
def test_complete?
|
100
124
|
c = Command.new(:whoami, raise_on_non_zero_exit: false)
|
101
125
|
refute c.complete?
|
@@ -15,6 +15,12 @@ module SSHKit
|
|
15
15
|
assert SSHKit.config.output = $stderr
|
16
16
|
end
|
17
17
|
|
18
|
+
def test_umask
|
19
|
+
assert SSHKit.config.umask.nil?
|
20
|
+
assert SSHKit.config.umask = '007'
|
21
|
+
assert_equal '007', SSHKit.config.umask
|
22
|
+
end
|
23
|
+
|
18
24
|
def test_default_env
|
19
25
|
assert SSHKit.config.default_env
|
20
26
|
end
|