2013-09-27 11:45:55 +01:00
|
|
|
module RemoteCommandHelpers
|
|
|
|
def test_dir_exists(path)
|
2016-02-28 17:16:11 -06:00
|
|
|
exists?("d", path)
|
2013-09-27 11:45:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_symlink_exists(path)
|
2016-02-28 17:16:11 -06:00
|
|
|
exists?("L", path)
|
2013-09-27 11:45:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_file_exists(path)
|
2016-02-28 17:16:11 -06:00
|
|
|
exists?("f", path)
|
2013-09-27 11:45:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def exists?(type, path)
|
2014-04-22 10:36:44 -05:00
|
|
|
%{[ -#{type} "#{path}" ]}
|
2013-09-27 11:45:55 +01:00
|
|
|
end
|
2013-11-01 11:59:13 +00:00
|
|
|
|
2015-08-14 14:21:34 -07:00
|
|
|
def safely_remove_file(_path)
|
2014-04-22 10:36:44 -05:00
|
|
|
run_vagrant_command("rm #{test_file}") rescue VagrantHelpers::VagrantSSHCommandError
|
2013-11-01 11:59:13 +00:00
|
|
|
end
|
2013-09-27 11:45:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
World(RemoteCommandHelpers)
|