From: Intransition Date: 2010-06-24T00:57:25+09:00 Subject: Re: print gem VERSION from ruby program On Jun 23, 10:12 am, Roger Pack wrote: > Rein Henrichs wrote: > > On 2010-06-22 11:38:09 -0700, Roger Pack said: > > >> , note that File.open("../VERSION") fails since > >>> it tries to check in the parent of the dir where user currently is > >>> running the app from. > > >> File.open(File.dirname(__FILE__) + "/../VERSION") > > > Roger, you shouldn't depend on files outside of the lib/ dir when > > bundling your library as a gem. This was a problem for Rack for a while > > as some tools will move the lib dir out and break your relative path. > > Good point. For bundling sake I'd therefore suggest moving the file > VERSION into your lib dir.  Though, in reality, it's probably the tools > that should bundle the whole gem not just its lib dir...at least if they > want to be totally gem compatible. Easy solution: cd lib/foo ln -s ../../VERSION version.yml Or .txt as the case may be.