File: remote_command_helpers.rb

package info (click to toggle)
capistrano 3.19.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 804 kB
  • sloc: ruby: 5,351; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 539 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module RemoteCommandHelpers
  def test_dir_exists(path)
    exists?("d", path)
  end

  def test_symlink_exists(path)
    exists?("L", path)
  end

  def test_file_exists(path)
    exists?("f", path)
  end

  def exists?(type, path)
    %Q{[[ -#{type} "#{path}" ]]}
  end

  def symlinked?(symlink_path, target_path)
    "[ #{symlink_path} -ef #{target_path} ]"
  end

  def safely_remove_file(_path)
    run_remote_ssh_command("rm #{test_file}")
  rescue
    RemoteSSHHelpers::RemoteSSHCommandError
  end
end

World(RemoteCommandHelpers)