2009年10月8日星期四

How does Rake search for rakefiles?

Most of my understandings of rake come from the analogue to make. I thought, like make, rake requires a rakefile located in the current path where I issue the command if no rakefile explicitly specified in the arguments. However, I accidentally typed rake in subdirectory vm under the root path of the source code without a rakefile available yesterday when I was playing with Rubinius. It compiled!

Later when I tried to find the details on how the virtual machine was built I can't find anything in the root rakefile except for a line of comment saying "See vm.rake for more information". It was easy to locate the file but how was it loaded?

From the behaviors I could guess that rake would recursively search the up a level of directory for a rakefile if none exists in the current one, and rakefiles located in the rakelib directory would be somehow automatically imported, but I wanted some concrete documentation to prove my guess. I was astonished after some googling that it seemed that everyone knew the answers but no one ever wrote about it.

Therefore, the last weapon I could use was RTFSC. Fortunately the source code of Rake is pretty straightforward. The searching and importing logic is basically
  1. chdir to .. if there is no rakefile existing in the current dir;
  2. when finding a rakefile record its directory to location and load it;
  3. import all of .rake files located under location/rakelib if exist.
Wish this post could provide a little help to any rookies like me that are also seeking for the answers to this questions!

2009年6月24日星期三

玩儿转PSP

漫长乏味的班车时间越来越难度过,阅读和游戏是一剂良药。我的图书大多是电子书(特别是PDF),在没有入手网本之前,手头的设备很难满足阅读需要。即使是我的N800在看PDF格式时仍然嫌屏幕不够大。更别说手机游戏实在没有多少玩儿头。这是我想起了闲置已久的PSP。

这次的任务是升级小P + 安装PDF阅读器。

升级固件相对比较容易。小P原来的版本是3.71 M33,懂行的人一看就知道这是个Homebrew的固件。没办法,这就是中国的现实。经过一轮搜索我发现目前最高版本应该是5.00 M33-6。一直担心升级导致的一系列问题,包括选错固件、升级失败等等,不过让我找到了一个很详尽的升级指导,除了说明还包括需要软件的链接,非常方便。任务完成!

PSP上的PDF阅读器好像只有一个,Bookr。但是这个软件已经很久没有更新,最新的0.7.1工作在固件1.5版本上,我从官方网站上下载的版本根本不能在我的小P上运行。另一轮搜索显示应该安装一个1.5版内核的扩展。糟糕的是这种方法只适用于PSP 1000系列,我的小P是2000系列。

又有人提到可以用TimeMachine,它可以从存储卡上加载老版本内核。可惜,安装TimeMachine超级麻烦,还涉及到什么Pandora Battery,我不得不放弃这个方法。

峰回路转,意外发现Bookr也有很多非官方的升级,尝试一下果然可用。思路一开,最后一轮搜索,这里原来有很多版本,选取下载量最大的v8.1,加上官方网站上的CJK字体,任务完成!

这次玩儿转PSP,让我领略了Homebrew的厉害,也让我对PSP的开发产生了兴趣。哪天咱也Homebrew一个。