specinfra 2.53.1 → 2.54.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/lib/specinfra/command/base/file.rb +13 -8
- data/lib/specinfra/command/windows/base/file.rb +1 -1
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/base/file_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42c69bf1bcc72e23216971401e677922ecdf0aac
|
4
|
+
data.tar.gz: 98600b6e95e8e98aa430e97969f8a386fd1d31c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e8bdcaf0fb9cf61ac4d32f8e169d0f4a7365ba67042f4b618f436c7152992c1086482ecf84d3ab8558f662af442c11b2f717e358c93caae9f31f32dac277cf5
|
7
|
+
data.tar.gz: fe2d437ce31175eabca75965e2816cca5496d51ef1877f0b04dc3aa37c12e78aeca4ec11058535abf9bd39f235613aae807f0953cff047b2d29cca5c20ff19f6
|
@@ -137,25 +137,30 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
|
|
137
137
|
"stat -c %s #{escape(file)}"
|
138
138
|
end
|
139
139
|
|
140
|
-
def change_mode(file, mode)
|
141
|
-
|
140
|
+
def change_mode(file, mode, options = {})
|
141
|
+
option = '-R' if options[:recursive]
|
142
|
+
"chmod #{option} #{mode} #{escape(file)}".squeeze(' ')
|
142
143
|
end
|
143
144
|
|
144
|
-
def change_owner(file, owner, group=nil)
|
145
|
+
def change_owner(file, owner, group=nil, options = {})
|
146
|
+
option = '-R' if options[:recursive]
|
145
147
|
owner = "#{owner}:#{group}" if group
|
146
|
-
"chown #{owner} #{escape(file)}"
|
148
|
+
"chown #{option} #{owner} #{escape(file)}".squeeze(' ')
|
147
149
|
end
|
148
150
|
|
149
|
-
def change_group(file, group)
|
150
|
-
|
151
|
+
def change_group(file, group, options = {})
|
152
|
+
option = '-R' if options[:recursive]
|
153
|
+
"chgrp #{option} #{group} #{escape(file)}".squeeze(' ')
|
151
154
|
end
|
152
155
|
|
153
156
|
def create_as_directory(file)
|
154
157
|
"mkdir -p #{escape(file)}"
|
155
158
|
end
|
156
159
|
|
157
|
-
def copy(src, dest)
|
158
|
-
|
160
|
+
def copy(src, dest, options = {})
|
161
|
+
option = '-p'
|
162
|
+
option << 'R' if options[:recursive]
|
163
|
+
"cp #{option} #{escape(src)} #{escape(dest)}"
|
159
164
|
end
|
160
165
|
|
161
166
|
def move(src, dest)
|
@@ -108,7 +108,7 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
|
108
108
|
|
109
109
|
def check_is_owned_by(file, owner)
|
110
110
|
Backend::PowerShell::Command.new do
|
111
|
-
exec "$(if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}' -or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){
|
111
|
+
exec "$(if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}' -or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ $TRUE } else { $FALSE })"
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
data/lib/specinfra/version.rb
CHANGED
@@ -14,6 +14,10 @@ describe get_command(:change_file_mode, '/tmp', '0644') do
|
|
14
14
|
it { should eq 'chmod 0644 /tmp' }
|
15
15
|
end
|
16
16
|
|
17
|
+
describe get_command(:change_file_mode, '/tmp', '0644', :recursive => true) do
|
18
|
+
it { should eq 'chmod -R 0644 /tmp' }
|
19
|
+
end
|
20
|
+
|
17
21
|
describe get_command(:change_file_owner, '/tmp', 'root') do
|
18
22
|
it { should eq 'chown root /tmp' }
|
19
23
|
end
|
@@ -22,10 +26,18 @@ describe get_command(:change_file_owner, '/tmp', 'root', 'root') do
|
|
22
26
|
it { should eq 'chown root:root /tmp' }
|
23
27
|
end
|
24
28
|
|
29
|
+
describe get_command(:change_file_owner, '/tmp', 'root', 'root', :recursive => true) do
|
30
|
+
it { should eq 'chown -R root:root /tmp' }
|
31
|
+
end
|
32
|
+
|
25
33
|
describe get_command(:change_file_group, '/tmp', 'root') do
|
26
34
|
it { should eq 'chgrp root /tmp' }
|
27
35
|
end
|
28
36
|
|
37
|
+
describe get_command(:change_file_group, '/tmp', 'root', :recursive => true) do
|
38
|
+
it { should eq 'chgrp -R root /tmp' }
|
39
|
+
end
|
40
|
+
|
29
41
|
describe get_command(:create_file_as_directory, '/tmp') do
|
30
42
|
it { should eq 'mkdir -p /tmp' }
|
31
43
|
end
|
@@ -38,6 +50,14 @@ describe get_command(:get_file_owner_group, '/tmp') do
|
|
38
50
|
it { should eq 'stat -c %G /tmp' }
|
39
51
|
end
|
40
52
|
|
53
|
+
describe get_command(:copy_file, '/src', '/dest') do
|
54
|
+
it { should eq 'cp -p /src /dest' }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe get_command(:copy_file, '/src', '/dest', :recursive => true) do
|
58
|
+
it { should eq 'cp -pR /src /dest' }
|
59
|
+
end
|
60
|
+
|
41
61
|
describe get_command(:move_file, '/src', '/dest') do
|
42
62
|
it { should eq 'mv /src /dest' }
|
43
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.54.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|