December 16, 2013

PhoneGap Emulate - POW

I’m working on a prototype using PhoneGap and ran across the awesome PhoneGap Emulator. The emulator lets you run your web app as if you’re in a device simulator/emulator (note however, that it doesn’t emulate the particular device’s rendering engine… it’s always Chrome).

The problem (for me) is that the PhoneGap Emulator assumes your PhoneGap webapp is hosted somewhere. My problem is that my PhoneGap webapp is simply the “www” directory inside of my PhoneGap project.

Pow to the rescue

I could go through the whole process of figuring out how to turn apache on for Mavericks, but that involves mucking with apache and it’s config files. No thanks.

I remembered hearing about Pow from 37 Signals when it first came out awhile back, and thought that might be perfect for this… turns out it is.

Pow can host static sites (like my PhoneGap webapp) as easily as it does ruby/rack apps. The issue is, it wants your site to be in the public directory of your app directory; whereas PhoneGap places it into the www directory.

  1. Install Pow

      (~) $ curl | sh
  2. Add a symbolic link from the www directory to create a public directory:

      (~/dev/myphonegapapp) $ ln -s www public
  3. Hook it into Pow:

      (~/.pow) $ ln -s ~/dev/myphonegapapp
  4. Emulate your app: Your app is available at the URL: (of course, changing myphonegapapp to the actual name of the directory)
  5. Continue PhoneGapping.