readrails alias to open Textmate with the Rails gems source code

Now that Rails 1.2 is out, and you switched to using the gems instead of Edge, you might find yourself having “a hard time” searching the Rails source code. Enter: a Bash alias to opening the Rails source in Textmate.


# readrails - an alias to open Textmate with the Rails source from Gems
# You need the GEM_HOME folder set to where your gems are (this is for portability)
# export GEM_HOME=/usr/local/lib/ruby/gems/1.8 # this is my GEM_HOME setting

export GEMSFOLDER="${GEM_HOME}/gems/"
alias readrails="e ${GEMSFOLDER}rails-1.2.1 ${GEMSFOLDER}activerecord-1.15.1 ${GEMSFOLDER}actionwebservice-1.2.1 ${GEMSFOLDER}activesupport-1.4.0"

If the above is garbled, see this paste.

Problem in the above: the version numbers. They increase with each new release of these gems. A more polished version of this alias could look at the version numbers after the last dash, and figure out what version to use.

Update! Stop the presses!

Jonas B just made my thing lots better, by invoking Rubygems itself!

I wrapped his couple of lines into my alias, like this:


#
# readrails 0.2 - an alias to open Textmate with the Rails source from Gems
#

alias readrails="mate `ruby -rubygems -e "puts( ['rails', 'activerecord', 'actionwebservice', 'actionpack', 'activesupport'].collect { |gem| gems = Gem.source_index.find_name(gem); gems.last.full_gem_path; }.join(' '))"`"

And I pasted it at: http://pastie.caboo.se/36928 — this is getting better and better.

If you’d like to make it better still, just work Jonas’ original error-checking into the above as well:


paths = ['rails', 'activerecord', 'actionwebservice', 'activesupport'].collect do |gem|
gems = Gem.source_index.find_name gem
raise "gem '#{gem}' not found" if gems.empty?
gems.last.full_gem_path
end
paths.join ' '

Rubygems now features ‘Skip this gem’ in installation

Ruby’s code-distribution mechanism Rubygems is being released in a new version real soon, and some small useful features are already in the RCs. Like “Skip this gem”, which makes it possible to skip a single update, but continue with the rest of the set of updates for your gems. Here is a demonstration of just that:

$ sudo gem up -y
Password:
Updating installed gems...
Need to update 25 gems from http://gems.rubyforge.org
.........................
complete
Attempting remote update of sqlite3-ruby
Select which gem to install for your platform (powerpc-darwin8.8.0)
 1. sqlite3-ruby 1.2.0 (mswin32)
 2. sqlite3-ruby 1.2.0 (ruby)
 3. sqlite3-ruby 1.1.0.1 (ruby)
 4. sqlite3-ruby 1.1.0.1 (mswin32)
 5. sqlite3-ruby 1.1.0.1 (ruby)
 6. sqlite3-ruby 1.1.0.1 (mswin32)
 7. Skip this gem
 8. Cancel installation
> 2
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.2.0
Installing ri documentation for sqlite3-ruby-1.2.0...
Installing RDoc documentation for sqlite3-ruby-1.2.0...
Gems: [sqlite3-ruby] updated

Pretty damn necessary.

[tags]ruby,rubygems[/tags]

Intro to J language

Via Dave, my favorite Dutch-speaking Australian Computer Scientist, I got wind of this fine J programming language introduction, written by our common acquaintance Cratylus.

A short text, it goes directly into parsing how J looks, and then a bit about its operators. No speculation, just explanation. Thanks, C!

And, Dave: I love the new handle-bars.

[tags]jlanguage,programming[/tags]

Upcoming game developer conference – Nordic Game Jam

My dear L is now working at Diginet Øresund. This event might be of interest to you, dear reader, should you live in the Nordic countries:

…Nordic Game Jam ’07, which is hosted by Diginet Øresund (my new job – I’ll be managing the event). Thought you might be interested. Or maybe you know someone else who might be.

  • What: make a game on a weekend and meet other developers
  • When: 2-4 February 2007 (last sign-up January 22)
  • Where: IT University, Copenhagen
  • Price: 250 DKK

Signup page for GameJam and more details about GameJam

Hope I’ll be seeing you there – if you need it, you can crash in our kitchen.