Project

maphosts

0.01
No commit activity in last 3 years
No release in over 3 years
Small command line application for keeping your project hostnames in sync with /etc/hosts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 0.7
~> 0.1
 Project Readme

maphosts

Gem Version Circle CI

Small command line application for keeping your project hostnames in sync with /etc/hosts.

Use it within your startup script (make up, shell scripts, etc.) to provide a vagrant up-like experience so people can start coding without spending time setting up and updating /etc/hosts by hand.

Get started

gem install maphosts

Usage

maphosts {www.,static.,}example.lo

This will add www.example.lo, static.example.lo and example.lo to your /etc/hosts. The tool will only update parts of your /etc/hosts which requires the update to preserve the original formatting. When required and with your permission the tool uses sudo to write to /etc/hosts.

By default the hosts will point to 127.0.0.1 but you can provide a custom ip address with the --to option.

boot2docker

maphosts --to $(boot2docker ip) {www.,static.,}example.lo

This will do the same as above but will point these hosts to your boot2docker vm. In case you use multiple docker containers, you can use maphosts to keep your /etc/hosts file in sync with all the containers. You could add maphosts to your docker startup script so it syncs the hosts everytime you start the containers.

# Example of a docker startup script with maphosts
# Developers just run `make up` and can start hacking
up:
    maphosts --to $(boot2docker ip) {www.,static.,}example.lo
    docker start example-www
    docker start example-static

Tests

You can run the rspec suite with rake

rake spec

Contributing

Feel free to send pull requests!