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