class Tagrity::Helper
Constants
- LOG_DIR
- RUN_DIR
Public Class Methods
alive?(pid)
click to toggle source
# File lib/tagrity/helper.rb, line 26 def alive?(pid) Process.kill(0, pid) # signal 0 checks if pid is alive true rescue Errno::ESRCH false rescue Errno::EPERM true end
executable?(cmd)
click to toggle source
# File lib/tagrity/helper.rb, line 18 def executable?(cmd) !%x{command -v #{cmd}}.empty? end
file_ignored?(file)
click to toggle source
# File lib/tagrity/helper.rb, line 40 def file_ignored?(file) `git check-ignore -q #{file} &> /dev/null` $?.exitstatus == 0 end
file_tracked?(file)
click to toggle source
# File lib/tagrity/helper.rb, line 45 def file_tracked?(file) `git ls-files --error-unmatch #{file} &> /dev/null` $?.exitstatus == 0 end
git_dir?()
click to toggle source
# File lib/tagrity/helper.rb, line 35 def git_dir? `git rev-parse --git-dir &> /dev/null` $?.exitstatus == 0 end
kill(pid)
click to toggle source
# File lib/tagrity/helper.rb, line 22 def kill(pid) Process.kill('HUP', pid) end
log_dir()
click to toggle source
# File lib/tagrity/helper.rb, line 13 def log_dir ensure_data_dirs LOG_DIR end
run_dir()
click to toggle source
# File lib/tagrity/helper.rb, line 8 def run_dir ensure_data_dirs RUN_DIR end
Private Class Methods
ensure_data_dirs()
click to toggle source
# File lib/tagrity/helper.rb, line 52 def ensure_data_dirs FileUtils.mkdir_p(RUN_DIR) FileUtils.mkdir_p(LOG_DIR) end