Top Level Namespace

Defined Under Namespace

Modules: Underglow Classes: Array, Rails, String, Symbol

Instance Method Summary collapse

Instance Method Details

#capture_remote_file(path) ⇒ Object



10
11
12
13
14
# File 'lib/underglow/capistrano/helpers.rb', line 10

def capture_remote_file(path)
  return unless remote_file_exists?(path)

  capture(:cat, path).strip
end

#execute_with_tty(*args) ⇒ Object

SSH with pseudo-tty



17
18
19
# File 'lib/underglow/capistrano/helpers.rb', line 17

def execute_with_tty(*args)
  exec "ssh #{host.user}@#{host.hostname} -t '#{command(*args).to_command}'"
end

#kill_process(process, signal) ⇒ Object

Sends kill signal to process is running



22
23
24
25
26
27
28
29
# File 'lib/underglow/capistrano/helpers.rb', line 22

def kill_process(process, signal)
  within "#{shared_path}/pids" do
    pid = capture_remote_file("#{process}.pid")
    # binding.pry

    execute :kill, "-#{signal}", pid unless pid.blank?
  end
end

#remote_file_exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/underglow/capistrano/helpers.rb', line 6

def remote_file_exists?(path)
  test("[ -e #{command.options[:in]}/#{path} ]")
end