Sha256: 011e52baa9987c3b592ab93c9e7f6e9c515516db1be3d087db955803dd91df23
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module CodeBuddy module Server class << self def start if running? puts "Code Buddy is already running." exit else Daemons.daemonize(:app_name => "code_buddy_server") CodeBuddy::App.run! :host => 'localhost' end end def stop if process_line = running? pid = process_line.split[1] Process.kill("TERM", pid.to_i) else puts "Code Buddy is not running." exit end end def update(stack_string) require 'net/http' require 'uri' require 'launchy' if running? Net::HTTP.post_form(URI.parse('http://localhost:4567/new'), {"stack" => stack_string}) else CodeBuddy::App.stack_string = stack_string start end Launchy.open("http://localhost:4567/stack/0") end def running? `lsof -i :4567`.split("\n").find{|process_line| process_line =~ /ruby/} end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
code_buddy-0.1.2 | lib/code_buddy/server.rb |
code_buddy-0.1.1 | lib/code_buddy/server.rb |
code_buddy-0.1.0 | lib/code_buddy/server.rb |
code_buddy-0.0.8 | lib/code_buddy/server.rb |