module Berkshelf::API::GenericServer::ClassMethods
Public Instance Methods
instance()
click to toggle source
Returns the currently running instance of the including Class
@return [Celluloid::Actor]
# File lib/berkshelf/api/generic_server.rb, line 14 def instance unless Application[server_name] && Application[server_name].alive? raise NotStartedError, "#{server_name} not running" end Application[server_name] end
server_name(name = nil)
click to toggle source
Set the name that the actor will be registered as with the applicaiton
@param [#to_sym, nil]
@return [Symbol]
# File lib/berkshelf/api/generic_server.rb, line 26 def server_name(name = nil) return @server_name if name.nil? @server_name = name.to_sym end
start(*args)
click to toggle source
Start the cache manager and add it to the application's registry.
@note you probably do not want to manually start the cache manager unless you
are testing the application. Start the entire application with {Berkshelf::API::Application.run}
# File lib/berkshelf/api/generic_server.rb, line 35 def start(*args) Application[server_name] = new(*args) end
stop()
click to toggle source
Stop the cache manager if it's running.
@note you probably don't want to manually stop the cache manager unless you are testing
the application. Stop the entire application with {Berkshelf::API::Application.shutdown}
# File lib/berkshelf/api/generic_server.rb, line 43 def stop unless actor = Application[server_name] actor.terminate end end