Class: Shutup::Rails

Inherits:
Object
  • Object
show all
Defined in:
lib/shutup.rb

Instance Method Summary collapse

Instance Method Details

#current_dirObject



4
5
6
# File 'lib/shutup.rb', line 4

def current_dir
  File.expand_path(File.dirname(File.dirname('.')))
end

#hit!Object



21
22
23
24
25
26
# File 'lib/shutup.rb', line 21

def hit!
  if pid
    system "kill -9 #{pid}"
    puts "Killed process id: #{pid}"
  end
end

#pidObject



12
13
14
15
16
17
18
19
# File 'lib/shutup.rb', line 12

def pid
  begin
    File.read(pid_file)
  rescue => e
    e.message << ' Are you sure that the process is running?'
    raise(e)
  end
end

#pid_fileObject



8
9
10
# File 'lib/shutup.rb', line 8

def pid_file
  "#{current_dir}/tmp/pids/server.pid"
end