Please note that I used my Web Sockets demo as a starting point (github.com/chrisjpowers/web_sockets_demo), so the Pusher library is an integral part of this demo as well.
I'm working with the understanding that you have your favorite flavor of Ruby installed and working. Assuming that's true…
Clone this repository:
$ git clone git://github.com/chrisjpowers/js_refactoring_demo.git $ cd js_refactoring_demo
Make sure Rubygems is up to date and you have Bundler installed:
$ gem update --system $ gem install bundler
Install dependencies with Bundler:
$ bundle install
Start the app server:
$ ruby server.rb
Check out the demo at localhost:4567
Start the test server:
$ rake jasmine
Run the test suite by browsing to localhost:8888
Start refactoring! I've laid out seven steps to help get you moving in the right direction, but it's up to you to decide the best techniques to use. I guarantee that developers will think that I've refactored too much, and others will say that I haven't done enough – so what do you think?
Just in case you're not familiar with one of these libraries, here are some docs: