althea/haproxy_manager — pull request #5 by logicminds (2013-12-03 06:33:17+00:00)
Title: fixes #4 adds backend and server logic to new classes

I am not sure this is quite ready to merge, as I haven't fixed the documentation yet nor tested with real haproxy instances, but in the following days this should be ready to merge. Have a look as this is a major change. All unit tests are passing at this point. I'll be playing around with this new code in a real environment this week but you can review this for now. Its pretty functional and allows one to play around with server or backend objects instead of the instance. The objects are scoped so you only see backend or server related information gathered from the stats.

I also moved the socket to its on file in case the user wants to create a server or backend object without using the instance object.

These new objects will create a bunch more chatter on the socket channel so I was thinking of going back and adding some sort of cache layer to HAPSocket to reduce calls the number of calls to the socket. Not sure what would happen to haproxy if the socket is over utilized.

To use you essentially do the following:

```Ruby
haproxy = HAProxyManager::Instance.new ('path to haproxy socket')
servers = haproxy.server_instances
backends = haproxy.backend_instances
servers.each do |server|
puts server.name
puts server.weight
puts server.up?
puts server.bin (bytes in, dynamic method via method missing)
```