Crispy Dev

adventures in coding land

SelectorGadget and Nokgiri

Just watched Railscast Episode 190 in which Ryan Bates demonstrated the use of the Nokogiri Gem for a screen scraping application. As part of the episode, Ryan also demonstrated the use of SelectorGadget, a browser bookmarklet for exploring CSS styles on a page which is useful in Nokogiri for identifying CSS selectors to use to grab a particular HTML element (or group of elements). I had seen SelectorGadget recommended as a learning tool for jQuery as well, and Ryan’s screencast was a useful reminder.

Incidently, Nokogiri is used by the Rspec and Cucumber testing tools for Rails view testing.

Getting Back Into Development Mode

It’s been a while (actually over a year) since I installed Octopress as a development log. I’ve gone back to it. After updating to the latest version and correcting some bugs that seem to have been introduced since I last used it.

Crispy Development is all in place now and is updating correctly to its new home at dev.cpjobling.org.uk and also to my GitHub homepage at cpjobling.github.com.

For my reference, the deployment recipe is:

$ cd ~/dev/dev.cpjobling.org.uk
$ rake generate deploy
$ rake deploy_github 

Introducing BDD to Proman

Behaviour Driven Development is well known in the Rails development community and I’ve decided to use it in my re-write of Proman. Following the instructions in Chapter 20 of the 13th beta of http://www.pragprog.com/titles/achbd/the-rspec-book, I installed the necessary gems (version numbers are the values at time of installation):

sudo gem install rspec --version 1.3.0
sudo gem install rspec-rails --version 1.3.2
sudo gem install cucumber --version 0.6.3
sudo gem install cucumber-rails --version 0.3.0
sudo gem install database_cleaner --version 0.5.0
sudo gem install webrat --version 0.7.0
sudo gem install selenium-client --version 1.2.18

I then installed rspec and cucumber in my new Proman 3 project:

$ cd ~/dev/Proman-3
$ mkdir lib
$ mkdir tasks
$ ./script/generate rspec
Configuring rspec and rspec-rails gems in config/environments/test.rb ...

      exists  lib/tasks
      create  lib/tasks/rspec.rake
      create  script/autospec
      create  script/spec
      create  spec
      create  spec/rcov.opts
      create  spec/spec.opts
      create  spec/spec_helper.rb

$ ./script/generate cucumber --rspec --webrat
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
       force  config/database.yml
      create  config/cucumber.yml
      create  config/environments/cucumber.rb
      create  script/cucumber
      create  features/step_definitions
      create  features/step_definitions/web_steps.rb
      create  features/support
      create  features/support/paths.rb
      create  features/support/env.rb
      exists  lib/tasks
      create  lib/tasks/cucumber.rake

I committed the changes and created a tag rspeced.

Running an Octopress Blog

Inspired by episode 0.1.7 of The Changelog podcast, I have cloned and configured an Octopress blog for recording my software development efforts. You will find a copy of this blog at dev.cpjobling.org.uk and also on my GitHub page cpjobling.github.org. And if it proves useful, Octopress may also replace the Proman development blog Proman, man.

Out of the box, it provides links to twitter and delicious and can be configured to use disqus, google custom search and google analytics.

As well as providing an interesting approach to blogging, Octopress, by using Markdown, Compass, Haml and Sass, also provides me with a useful sandpit for trying out these technologies.