Posts

Showing posts from 2008

Unit Testing Using Context

Jeremy McAnally has released a gem called context allowing contexts in Test::Unit tests. It's all the rage, even those crazy Rails guys are doing it (although I did check out some of their unit tests earlier and couldn't find any). Anyway, I'm way behind on my TDD and BDD and all other testing acronyms so I decided to give it a go. These are way simple tests and I actually did it the normal Rails way initially before "converting" to the context way of doing it. I've got converting up there in quotes because it was really, really simple and I hardly did anything which is fantastic because the easier something that's good is to do, the more people will eventually do it; think Rails conventions. Getting Started Get the gem: $ gem sources -a http://gems.github.com $ sudo gem install jeremymcanally-context That is outlined as the install procedure, but you can't just use it as you must require that bad boy for your Rails app to use it - so put this in

Rebuild the locate database on Mac

Just because I always forget. $ sudo /usr/libexec/locate.updatedb

Merb 1.0

So Merb 1.0 was released 2 days ago during RubyConf, just sudo gem install merb to update. I had to update my config/dependencies.rb file to read merb_gems_version = "1.0" and also sudo gem install webrat , which is a Ruby Acceptance Testing plugin. Here 's the Git repo if you want to check it out.

Getting the Database name in Merb and DataMapper

After a lot of searching and banging my head against my keyboard I finally found how to get the database name for my Merb application: Macintosh:ruby-rss-feeds marktucks$ merb -i ... >> repository(:default).adapter => # , @name=:default, @transactions={}> >> repository(:default).adapter.uri => # >> repository(:default).adapter.uri.path => "sample_development.db" # YAY! I'm sure there must be a better way to do this. A Rails::Configuration.database_configuration equivalent? But I just cannot find it. The Merb.config doesn't seem to have a database property / method. You can get stuff like the host ( Merb.config[:host] ). Any suggestions / better solutions are welcome.

iTunes Library from PC to Mac

About a couple of months ago I switched from my PC to a MacBook and have never looked back since. I don't miss anything from my PC, except my iTunes Library. And contrary to my colleague's advice it seems as though you can't just copy all that iTunes guff from your PC to your Mac. So I found this article on how to convert my iTunes library and copy all the music files from the PC to the Mac. One small edit to this post is that in new iTunes 8, "Import Library" is now, for some confusing reason; File > Library > Import Playlist. "Consolidate Library" is also under File > Library. It almost worked like a charm, but apparently it couldn't find some of my music, maybe something to do with the special characters in my Library.xml?

Ubiquity: Firefox Command Line Awesomeness

Ubiquity - "a Mozilla Labs experiment into connecting the Web with language in an attempt to find new user interfaces that could make it possible for everyone to do common Web tasks quicker and easier." Getting started Install the Plugin , which will restart Firefox / Mozilla. *Note: if you are using a Mac you'll need to install Growl to get the notifications to work. Windows works out of the box, popping up those little toaster notifications in the bottom right of your screen. No messages on Linux just yet, but I'm sure there is someone out there clever enough to get this working or know how to get it working. Once restarted, hit CTRL+SPACE for Windows or OPTION+SPACE for Mac and you'll see Ubiquity pop up below your open tabs. There are already quite a few commands built in (type "command-list" into Ubiquity to see them all), follow this tutorial to get up and running. One of the sweet things about it is creating your own commands using the command