20140605

pow and byebug - staying in the web app dev env heaven: an update for ruby 2.1

The previous version (for ruby 1.9) is here.

It seems ruby-debug has fallen out of favour with the community and the replacement is byebug.
So here's my follow-up on the old post.

The steps to enable byebugging in your app dev env:
  1. echo export POW_WORKERS=1 >> ~/.powconfig  # make sure pow runs only one app process — globally
  2. cd <your project directory>
  3. Add byebug to your bundle (and remove ruby-debug if exists).
  4. Paste the following snippet at the end of your config/environments/development.rb — for rails, or in the appropriate development environment initialisation module — for the platform of your choice:
  5. echo export RUBY_DEBUG_PORT=10007 >> .powenv  # make sure we enable debugging with a machine-unique port, e.g. 10007 (you should pick different ports for different projects)
  6. touch tmp/restart.txtThen make any request to actually restart your server.
  7. byebug -R localhost:10007 -d  # you're back in business, go wild with debugger's in your code