Hacking Journal [2006/01/09]
Day one, raking the leaves
[2006/01/09]
Well this is the beginning of my personal hacking journal. I will use it to track all my progress and thoughts with hacking code.
Today I decided to sit down and make something with rake. Since I have not been good on updating my life graph recently I felt, if I could automate it I would use it more often. After about an hour of work I had a basic working Rakefile that would do the entire process for me.
- By running `rake` in the directory it would first run the task `ask`
- This used simple print and gets to ask me how I felt on each category for the day, which it then appended to my yaml.
- After that, my yaml would be newer than my life.png so it would run my Ruby script to re-generate the life.png image.
- Finally it would ssh that image to my webserver.
By setting this up I cut out a ton of manual work; from opening TextMate to add the day to the yaml, to running the generator, to ssh’ing the file to my server. The hardest part was getting my data to append to the yaml file. first I used puts in the File.open {|x| .. } block without calling x.puts. This meant that the data was just written to the bit bucket. Once I fixed that I found I was overwriting my yaml each time, I guess File.open(“life.yaml”, “a”) is for appending…. not “w”.
So that is about all for today, looks like I will be doing some major has and belongs to many tomorrow at work on our new website so I need to rest up.
Eric Davis
http://rake.rubyforge.org/
dropbox.theadmin.org/media/life.png
