Module: NodeSpec::BackendProxy::UnixshellUtility
Constant Summary collapse
- SUDO_PREFIX =
'sudo'
- TEMP_DIR =
'/tmp'
Instance Method Summary collapse
- #cmd_create_directory(path) ⇒ Object
- #cmd_create_file(path, content) ⇒ Object
- #run_as_sudo(cmd) ⇒ Object
- #temp_directory ⇒ Object
Instance Method Details
#cmd_create_directory(path) ⇒ Object
13 14 15 |
# 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) ⇒ Object
17 18 19 |
# 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) ⇒ Object
9 10 11 |
# File 'lib/nodespec/backend_proxy/unixshell_utility.rb', line 9 def run_as_sudo(cmd) "#{SUDO_PREFIX} #{cmd}" end |
#temp_directory ⇒ Object
21 22 23 |
# File 'lib/nodespec/backend_proxy/unixshell_utility.rb', line 21 def temp_directory TEMP_DIR end |