Thursday, November 10, 2005

JIS : Rake - Ruby Build System

JIS : Rake - Ruby Build System: "The main task is build. It is defined by the call task :build. Then we pass an array of dependencies to task that :build depends on (in this case only one “:clean”). Then we simply shell (sh) out to csc to build everything for me. Not much different from a BAT file in its current state. Here is a piece of my real build that handles versioning...

task :version_main do |t|
versions.transaction do |o|
v = versions['main'].increment
File::open('Main.AssemblyVersion.cs', 'w') do |av|
av.write '[System.Reflection.AssemblyVersion(\'#{v.major}.#{v.minor}.#{}.#{v.revision}\')]'

task :version => [:version_main] do |t|
print 'Everything versioned'

The versions variable is an instance of PStore. It is a hashtable that holds a bunch of Version objects for each project. It is pretty similar to the tag in NAntContrib as I show it above. But the versions variable could be a BerkleyDB or a MySQL rowset, etc. Much harder to do this swap with the tag."
Post a Comment