2005-10-24

Ruby 1.8.3 Versus Rake

Ruby 1.8.3 changed allowed options for FileUtils::cd method. It no longer accepts :noop option. One of the side effects is that Rake is not able to run package task. So if you have been running into the problem I have mentioned in one of my previous posts (No such option :noop) you will have to downgrade to Ruby 1.8.2.

Now I will have to find a way how to keep Yum away from automagically upgrading my old Ruby version.

2005-10-19

Rcss 0.3.0 Released

Rcss evolved from a small article to quite a chunk of Ruby software. It has it’s own project page and can be installed as standard gem:


# gem install rcss

Detailed RDoc documentation for Rcss is also available.

Update

Unfortunatelly it does not work properly. There is something wrong with my Ruby installation – and gem I have created is not recognized on different platform than mine.

I am working on it.

2005-10-18

Importing vCard Contacts To Thunderbird

Personally Evolution is not my favourite mail program. The only reason why I have been sticking to it was it’s ability to import vCard contacts. And I have had a LOT of those :)

Considering how good Firefox is I was thinking about switching to Thunderbird. Unfortunatelly lack of ability to import vCards was stopping me. Untill today that is.

I have stumbled upon a small Ruby library for handling vCards. Writing a script that will convert my exported contacts to CSV file was just a matter of minutes.

To use it you will need to download and install Vpim library. Installation is quite simple:


$ ruby install.rb config
$ ruby install.rb setup

Switch to root privileges and invoke:


# ruby install.rb install  

Now for the script itself (file vcard-to-csv.rb):


#!/usr/bin/env ruby

require 'vpim/vcard'

cards = Vpim::Vcard.decode(ARGF.read)

cards.each do |card|
  surname, name = card['N'].split(';')
  full_name = card['FN']

  # Depending on contact Evolution used different types for email field
  # In my case order of importance for emails was as below.
  # Luckily no contact have had more than two emails
  email_other = card['EMAIL', 'OTHER']
  email_work = card['EMAIL', 'WORK']
  email_home = card['EMAIL', 'HOME']
  emails = []
  [email_other, email_work, email_home].each {|email| email && emails << email}

  tel_home = card['TEL', 'HOME']
  tel_work = card['TEL', 'WORK']
  tel_mobile = card['TEL', 'CELL']

  # Full list of fields:
  #
  # first,last,display,nickname,email,add email,work phone,home phone,fax,pager,mobile,address,address2,city,state,zip,country,address work,address work2,city work,state work,zip work,country work,titile,departament,organization,http://web page work,http://web page,,,,custom 1,custom 2,custom 3,custom 4,notes,
  puts "#{name},#{surname},#{full_name},,#{emails[0]},#{emails[1]},#{tel_work},#{tel_home},,,#{tel_mobile},,,,,,,,,,,,,,,,,,,,,,,,,," 

end

To use it export contacts from Evolution to contacts.vcf file and from shell type:


  $ ruby vcard-to-csv.rb contacts.vcf >contacts.csv

Now you can import contacts.csv file into Thunderbird.

2005-10-10

Rake Problems

I have been trying to create a Gem package for Rcss. For some reason Rake dies complaining that:

no such option: noop

It almost certainly is my fault (as Google is not aware of such error) but I can not pinpoint it. I just hate wasting time solving that kind of problems.

Update

Found the problem. Gem task executes properly, only package has problems. Gem can be successfully built, but I wonder what is broken in other types of packages?