module NodeSpec::BackendProxy::UnixshellUtility

Constants

SUDO_PREFIX
TEMP_DIR

Public Instance Methods

cmd_create_directory(path) click to toggle source
# File lib/nodespec/backend_proxy/unixshell_utility.rb, line 13
def cmd_create_directory(path)
  shellcmd("mkdir -p #{path.shellescape}")
end
cmd_create_file(path, content) click to toggle source
# File lib/nodespec/backend_proxy/unixshell_utility.rb, line 17
def cmd_create_file(path, content)
  shellcmd("cat > #{path.shellescape} << EOF\n#{content.strip.gsub('"', '\"')}\nEOF")
end
run_as_sudo(cmd) click to toggle source
# File lib/nodespec/backend_proxy/unixshell_utility.rb, line 9
def run_as_sudo(cmd)
  "#{SUDO_PREFIX} #{cmd}"
end
temp_directory() click to toggle source
# File lib/nodespec/backend_proxy/unixshell_utility.rb, line 21
def temp_directory
  TEMP_DIR
end

Private Instance Methods

shellcmd(cmd) click to toggle source
# File lib/nodespec/backend_proxy/unixshell_utility.rb, line 27
def shellcmd(cmd)
  %Q[sh -c "#{cmd}"]
end