File: remote_command_helpers.rb

package info (click to toggle)
capistrano 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 480 kB
  • ctags: 321
  • sloc: ruby: 2,946; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 488 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
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)
    %{[ -#{type} "#{path}" ] && echo "#{path} exists." || echo "Error: #{path} does not exist."}
  end

  def safely_remove_file(path)
    run_vagrant_command("rm #{test_file}") rescue Vagrant::Errors::VagrantError
  end
end

World(RemoteCommandHelpers)