Class: Contentful::Bootstrap::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful/bootstrap/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



77
78
79
80
81
82
# File 'lib/contentful/bootstrap/server.rb', line 77

def initialize
  @server = WEBrick::HTTPServer.new(:Port => 5123)
  @server.mount "/", IndexController
  @server.mount "/oauth_callback", OAuthCallbackController
  @server.mount "/save_token", SaveTokenController
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



76
77
78
# File 'lib/contentful/bootstrap/server.rb', line 76

def server
  @server
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/contentful/bootstrap/server.rb', line 92

def running?
  @server.status != :Stop
end

#startObject



84
85
86
# File 'lib/contentful/bootstrap/server.rb', line 84

def start
  Thread.new { @server.start }
end

#stopObject



88
89
90
# File 'lib/contentful/bootstrap/server.rb', line 88

def stop
  @server.shutdown
end