11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/simple-chmod/perms.rb', line 11
def result
if @perms == 'none'
shell_script_output = `chmod #{@type}-rwx #{@file}`
print "Changed permissions.\n"
elsif @perms == 'read write' || @perms == 'read xcute' || @perms == 'write read' || @perms == 'write xcute' || @perms == 'xcute read' || @perms == 'xcute write' || @perms == 'read' || @perms == 'write' || @perms == 'xcute' ||@perms == 'read write xcute'
replaceperms = @perms.gsub("read", "r").gsub("write", "w").gsub("xcute", "x")
finalperms = replaceperms.delete("\s")
shell_script_output = `chmod #{@type}-rwx #{@file}`
shell_script_output = `chmod #{@type}+#{finalperms} #{@file}`
print "Changed permissions.\n"
else
print "No valid file permissions.\n"
end
end
|