Ruby code – update

Hmmmm, it looks like my estimate (http://nhw.pl/wp/2006/04/compact-ruby-code/) was wrong.


wc -l rbckp.rb
44 rbckp.rb

or even more interesting:

grep -v ^$ rbckp.rb |wc -l
34
grep -v ^$ BACKUP.sh | wc -l
103

For those not familiar with grep syntax – using -v ^$ filters and shows all not empty lines (for such query line with whitespaces only is not empty).

And basically both scripts does similar work (even if not identical). I like Ruby…

Compact Ruby code

It is often written, that Ruby programs are small. Not in sense of making small things, but than they are compact. I’ve heard that many times. But this time I’ve rewrote my backup script.

What it does? It backups set of directories with tar and dumps mysql databases into some directory. After that I can rsync it to backup host.

Old script was written in shell (bash to be exact) and new one in Ruby. Results are as follow:


# wc -l BACKUP.sh
156 BACKUP.sh
# wc -l rbckp.rb
30 rbckp.rb

Is there some difference, can You spot it? :-)) To be honest script does a bit more, and I suppose that exact Ruby copy would have something about 60 lines… Tomorrow I will finish it and see whether my estimate is right.

Ruby On Rails and “sprawa polska”

First a bit of background. “Sprawa polska” it can be translated as “polish issue”. When You know polish history, than You know in 18th and 19th century Poland was not present as an independent country. We tried a lot to get our independence back, so Poles were present in every history stir at those times. And when You were growing here, Your history book covered every topic in context “sprawy polskiej”.

But what it have common with Ruby On Rails???

Continue reading