Sha256: c6e936e322266953c723650f56d8a661b7b3578a22d1cf781c23403e22dc150e
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
# Accepts a parameter name and value and registers it as a default within Capistrano. # Params: # +name+ # +args+ # +block+ def _cset(name, *args, &block) unless exists?(name) set(name, *args, &block) end end # Prompts user entry # Params: # +prompt+ def text_prompt(prompt="Value: ") Capistrano::CLI.ui.ask(prompt) { |q| q.echo = true } end # Check if a file exists by providing the full path to the expected file location def local_file_exists?(full_path) File.exists?(full_path) end # Check if a directory exists by providing the full path to the expected location def local_dir_exists?(full_path) File.directory?(full_path) end # Test to see if a file exists by providing # the full path to the expected file location def remote_file_exists?(full_path) 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip end # Test to see if a directory exists on a remote # server by providing the full path to the expected # directory # # Params: # +dir_path+ def remote_dir_exists?(dir_path) 'true' == capture("if [[ -d #{dir_path} ]]; then echo 'true'; fi").strip end # set the permissions for files recurisvely from the starting directory (dir_path) def set_perms_files(dir_path, perm = 644) try_sudo "find #{dir_path} -type f -print0 | xargs -0 chmod #{perm}" end # set the permissions for directories recurisvely from the starting directory (dir_path) def set_perms_dirs(dir_path, perm = 755) try_sudo "find #{dir_path} -type d -print0 | xargs -0 chmod #{perm}" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-ash-1.3.3 | lib/ash/common.rb |