“Sandbox” Host File Management Script

I guess I never posted about this when I originally made it. Mark Jaquith had made a nice little “localdev” script. It provides an easy to use command line interface for adding/removing host entries for development on localhost.

I forked it into a new tool called “sandbox”. It’s the same premise but it includes a few more useful additional features:

  • You can tell the tool which IP address to point to. Meaning it can be used for remote development as well as local development. (Example: sandbox add my.domain.name 12.345.678.999)
  • You can add a default address (instead of defaulting to 127.0.0.1) so you don’t need to type out the address every time you add a new rule. (Example: sandbox destination 12.345.678.999; sandbox add my.domain.name; all future rules that don’t specify an IP in the add command will default to that)
  • Methods for clearing rules, viewing all rules, or viewing specific entries.

I find it much easier than manually editing my hosts file all the time. I can also type “sandbox off” and all the rules won’t be active anymore. “sandbox on” to turn them back on. It’s super useful for when you are done working at the end of the week and no longer want to load from your development site.

The source code is at Github and is open source – and like I mentioned it’s based off of Mark’s code. It’s also the first thing I’ve ever done in Ruby. It was also a fun learning experience using Ruby, Gem, Git, and Github.

https://github.com/justinshreve/Sandbox#readme contains all of the commands.

You can also easily get going now with Ruby Gems:

gem install sandboxer

The tool has only been tested on OS X.

Let me know if you end up using this tool, if its useful to you, or if I can add anything else .

Quote about humanity

Great quote found via Scott Berkun.

When asked what surprised him most about humanity, he said:

‘Man. Because he sacrifices his health in order to make money. Then he sacrifices money to recuperate his health. And then he is so anxious about the future that he does not enjoy the present; the result being that he does not live in the present or the future; he lives as if he is never going to die, and then dies having never really lived.’

Attributed to the Dalai Lama, though that’s often disputed.

WordCamp Columbus

WordCamp Columbus is happening July 14 and 15. It was awesome last year and I only expect it to be better. I can’t make it this year because I already have plans for some outdoors camping, but my friend and fellow team social member JJJ is giving the keynote. JJJ is the lead dev for BuddyPress and bbPress.

Check it out if you are are in the area. Tickets are on sale now for $45.