Archive

Archive for the ‘RoR’ Category

TDD, Under Your Fingers

March 13th, 2009

TDD and scalability come hand-in-hand

…but you still have to be skilled and fast at dropping this code. Being productive in TDD is hard in the begging because it’s a different coding approach all together and you need to get in the “routine”.

Corey Haines makes a good point on his ACC2009 Lightning Talk

RoR

rake features Error (missing gem_original_require)

March 9th, 2009

Issue

While running “rake features” I encountered a problem. Something about a missing “gem_original_require”.

Missing these required gems:
rspec-rails

Error

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such 

file to load -- spec/rails (MissingSourceFile)

Failed to load features/support/env.rb
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
	from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/rails/rspec.rb:2
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
	from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
	from ./features/support/env.rb:15
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/cli.rb:227:in `require_files'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/cli.rb:225:in `each'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/cli.rb:225:in `require_files'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/cli.rb:148:in `execute!'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/cli.rb:13:in `execute'
	from /home/freddy/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/cucumber:6
rake aborted!

Fix

sudo rake gems:install rspec-rails

RoR

Bash Script to Load Common Ruby on Rails Tasks

March 9th, 2009

Awesome time-saving script

Here’s a bash script (sh) that will help you setup your rails session by automatically loading up a terminal with several useful rails tabs. The script below will open the /script/console, development log, sql lite, IRB and the /script/server.

Save the script below to a file in your linux box and run it like this:

sh “file-name.sh” /complete/dir/path/to-your-rails-project/


#!/bin/bash
DIR="${1}"

if [ ! -d "${DIR}" ]; then
echo "Error: Use full directory path:"
  echo "${0} file-name.sh /some/path/to/dir"
  exit 1
fi

gnome-terminal --window --working-directory=${DIR} -t "Server" -e "script/server" \
               --tab --working-directory=${DIR} -t "Console" -e "script/console" \
               --tab --working-directory=${DIR} -t "DBConsole" -e "script/dbconsole" \
               --tab --working-directory=${DIR} -t "IRB" -e "irb" \
               --tab --working-directory=${DIR} -t "Dev Log" -e "tail -f log/development.log" \
               --tab --working-directory=${DIR} -t "Terminal" &

RoR