bjeanes/ghost — pull request #33 by TheDeveloper (2012-09-13 21:35:40+00:00)
Title: Set and purge methods for hosts file store

I noticed that multiple lines for the same hostname were being added when the IP was different. This is undesirable, since one would fall under the other, and only the first is picked up to resolve to the IP. If the first record is incorrect, well, you're in a sticky situation.

To reproduce:

```ruby
Ghost.store.empty
Ghost.store.add(Ghost::Host.new("google", '8.8.8.4'))
Ghost.store.add(Ghost::Host.new("google", '8.8.8.8'))
````

Produces the following /etc/hosts:

````
# ghost start
8.8.8.4 google
8.8.8.8 google
# ghost end
````

I propose a couple new methods:

* Set ensures that there is only one entry for the hostname, to resolve to the given IP
* Purge removes the given hostname from any record that includes it, regardless of whether the IP address matches or not