Method: CodeBuddy::Server.update

Defined in:
lib/code_buddy/server.rb

.update(stack_string) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/code_buddy/server.rb', line 25

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