Pow local server

In development, we have been using http://0.0.0.0:3000. Actually there is a better local development server called Pow. Pow is developed by 37signals which contributes a lot to the rails community.

Powcx

It features auto loading the server and allow accessing the local rails app with something like http://yourapp.dev/.

To install pow, execute the following command.

1$ curl get.pow.cx | sh

Pow is very easy to use. But powder makes it even easier. It makes setting up the .dev domain with just one line within the rails app directory.

To install the powder gem, execute:

1$ gem install powder

Note: We are running gem install instead of adding powder in the Gemfile because this is a tool-chain on our system. The rails app does not depends on this gem.

After having both pow and powder installed, we can change to the rails app project directory and execute the following command:

1$ powder link
2Your application is now available at http://gallery.dev/

And from now on, we have a nice URL and we can have multiple rails app running in local without worrying about the port conflicts.

1$ tail -f log/development.log

Restarting Pow server

But now we need a way to restart the server sometimes. When a new request comes, Pow cheches a file in tmp/restart.txt. If the file is touched recently, it will restart the server.

So, in order to restart the pow server, we use the following command. (Assuming we are at the root directory of the rails project.)

1$ touch tmp/restart.txt

What’s next? We’re going to take a look at “Mobile devices testing via local network”.

overlaied image when clicked on thumbnail

Makzan | Ruby on rails 101 | Table of Content