Skip to content

Commit 934a290

Browse files
committed
Add -R option to chmod, chown and chgrp
1 parent ff66aee commit 934a290

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/specinfra/command/base/file.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,16 @@ def get_size(file)
138138
end
139139

140140
def change_mode(file, mode)
141-
"chmod #{mode} #{escape(file)}"
141+
"chmod -R #{mode} #{escape(file)}"
142142
end
143143

144144
def change_owner(file, owner, group=nil)
145145
owner = "#{owner}:#{group}" if group
146-
"chown #{owner} #{escape(file)}"
146+
"chown -R #{owner} #{escape(file)}"
147147
end
148148

149149
def change_group(file, group)
150-
"chgrp #{group} #{escape(file)}"
150+
"chgrp -R #{group} #{escape(file)}"
151151
end
152152

153153
def create_as_directory(file)

spec/command/base/file_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
end
1212

1313
describe get_command(:change_file_mode, '/tmp', '0644') do
14-
it { should eq 'chmod 0644 /tmp' }
14+
it { should eq 'chmod -R 0644 /tmp' }
1515
end
1616

1717
describe get_command(:change_file_owner, '/tmp', 'root') do
18-
it { should eq 'chown root /tmp' }
18+
it { should eq 'chown -R root /tmp' }
1919
end
2020

2121
describe get_command(:change_file_owner, '/tmp', 'root', 'root') do
22-
it { should eq 'chown root:root /tmp' }
22+
it { should eq 'chown -R root:root /tmp' }
2323
end
2424

2525
describe get_command(:change_file_group, '/tmp', 'root') do
26-
it { should eq 'chgrp root /tmp' }
26+
it { should eq 'chgrp -R root /tmp' }
2727
end
2828

2929
describe get_command(:create_file_as_directory, '/tmp') do

0 commit comments

Comments
 (0)