amardaxini/nailgun — pull request #5 by zachallaun (2012-07-08 00:15:43+00:00)
Title: Refactor NgCommand and general cleanup

I found this library to be very useful, and thought that I'd make some contributions.

**Breaking change:** Nailgun::NgCommand methods now accept a config Hash instead of individual arguments. For instance:
```
Nailgun::NgCommand.start_server "1234", "localhost"

# becomes

Nailgun::NgCommand.start_server :port_no => "1234", :server_address => "localhost"
```
The previous api would not allow a `server_address` to be set without also setting the `port_no`, leading to:
```
Nailgun::NgCommand.start_server "", "123.456.789"
```
This change makes this possible in the following way:
```
Nailgun::NgCommand.start_server :server_address => "123.456.789"
```

**Non-breaking changes:**

- A private method `execute_command` has been added to Nailgun::NgCommand, which abstracts out the common plumbing of the other methods, and allows them to be defined much more simply.

- A method `add_cps` has been added as a simple convenience to facilitate the addition of multiple items to the nailgun classpath at once.

- I've also cleaned up some whitespace issues that were causing the indentation to be inconsistent.

Thanks for considering this pull request -- I'd be happy to talk about any of the changes!

- Zach