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
|
|
|
|
2017-07-04 22:02:58 -04:00
|
|
|
def symlinked?(symlink_path, target_path)
|
|
|
|
"[ #{symlink_path} -ef #{target_path} ]"
|
|
|
|
end
|
|
|
|
|
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-21 22:30:08 -04:00
|
|
|
rescue
|
|
|
|
VagrantHelpers::VagrantSSHCommandError
|
2013-11-01 07:59:13 -04:00
|
|
|
end
|
2013-09-27 06:45:55 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
World(RemoteCommandHelpers)
|