About the author

Steven Harmansteven harman :: makes sweet software with computers!

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

News

Badges

  • Subtext Project
  • Support Subtext

OMG, Better Rake (for .net)!

If you ask me, when it comes tools for writing automated build scripts nothing packs more bang for the buck than Rake. Until recently, using Rake to build .net solutions required a magic concoction of hacked together scripts which rarely exhibited Ruby’s appreciation for beauty nor Rake’s spirit of simplicity.

Luckily our buddy Derick Bailey decided it was time to bite the bullet and start building some real Rake tasks that were special suited for building .net code. The result is Albacore.

Using Rake for .net IRL

I’ve been using Rake to be lazy for a while. And we, the VersionOne dudes & dudettes, have been using it to help automate our CI builds for over a year now. And just last week we started ditching much of our hacky-Rake-script inventory in favor of more concise, tested, and readable Rake tasks via Albacore.

During the migration I’ve run into a few small hitches here and there, but nothing that I couldn’t track down, write a test for, and fix within a couple of tomatoes. In one case I discovered an issue, called Derick to confirm, suggested a fix, and had a new Albacore Gem published within a couple of hours. Hawt!

Albacore already has a decent number of tasks baked in, and the list is growing all the time!

  • AssemblyInfoTask – Generate an AssemblyInfo.cs file. Currently only supports C#
  • ExpandTemplatesTask – expand template files with #{setting} markers, using YAML configuration files as the data
  • NCoverConsoleTask – Run code coverage analysis through NCover 3’s NCover.Console
  • NCoverReportTask – Check code coverage and get detailed reports through NCover 3’s NCover.Reporting
  • NUnitTask – run NUnit test suites
  • MSBuildTask – Build a Visual Studio solution (.sln) or MSBuild file
  • Rename Task – Rename a file
  • SftpTask – Upload a file to a remote server via secure FTP connection
  • SQLCmdTask – Run scripts and other commands through SQL Server’s “sqlcmd.exe”
  • SshTask – Run a command on a remote system via a secure shell connection
  • ZipTask – Package your build artifacts into a .zip for easier distribution
    source data

Contribute!

As we move more and more of our custom stuff over I’ll continue to add features to Albacore, enhancing the great work the core team is doing. In fact, I’m already planning a NAnt task to help those folks in the process of migrating from an existing NAnt-based build script to Rake. Look for it soon!

Resources

Technorati Tags: ,,,,

kick it on DotNetKicks.com

What others are saying.

# re: OMG, Better Rake (for .net)!
Gravatar Pete
Nov 25, 2009
If your going to build a better mouse trap make sure it is better than the ones out there. We are using CruiseControl.net. I can write scripts in msbuild or in ant. In addition there are built in tasks in CruiseControl.net. It comes with a display pannel that shows the status of my 30 .net application. It has a dry medifore. So common tasks for all 30 apps get writen once and then just get called. CruiseControl.net has built in scheduling of when the build should get fired off.
# re: OMG, Better Rake (for .net)!
Gravatar Steven Harman
Nov 25, 2009
@Pete,
I'm sure you're aware of this, but to be clear, there is a difference between an automation tool/language (be it Rake, MSbuild, NAnt, etc.) and the tool used for CI.

I've used many a CI tool over the years - CruiseControl, CruiseControl.net, CruiseControl.rb, TeamCity, Hudson, and RunCodeRun to name a few. In my experience the CruiseControl family are most dated and least usable of the lot.

If you're still using CruiseControl.net I'd recommend taking a serious look at Hudson. I absolutely love their philosophy that as a user, "if you have to touch the XML, you're doing it wrong."

Getting back to the automation tool itself, I believe Rake to be a far better mouse trap that the XML-based alternatives we've been stuck with in the past - MSbuild included. Also, Rake is a great level-setter as it can be used to automate tasks for many languages and platforms - I've used it for Ruby, Java, .net code bases with great success. YMMV, of course.
# re: OMG, Better Rake (for .net)!
Gravatar Pat Gannon
Nov 25, 2009
We've started using Rake at HSI lately for various scripts (mostly relating to deployment). Although we're still using MSBuild (and TFS/Team Build) for our CI/build processes, I'm really tempted to investigate porting one of those processes to Rake after seeing all of the cool stuff going on with Albacore. Every time I change one of the MSBuild scripts, I wind up getting annoyed. Additionally, I really like the ability to do ad/hoc imperative programming in build scripts, which Rake allows you to do, but MSBuild and NAnt do not (AFAIK). Nice post.
# re: OMG, Better Rake (for .net)!
Gravatar Tim
Nov 26, 2009
Your timing on this post is perfect. I spent yesterday afternoon - the oh-so-busy Wed before Thanksgiving - fretting over hacking into the fnh guy's BuildUtils.rb to get my new project up, building, and testing with Rake. Done it before, but it's always a trial and error mess for me based on how no two projects are ever structured the same way.

Looking forward to Monday, now.
# re: OMG, Better Rake (for .net)!
Gravatar rakeback
Feb 03, 2010
Hey this seems great, but I keep getting the following error:
(in C:/InstantRails/ruby/Yardview5)

Couldn't create database for {"encoding"=>"utf8", "adapter"=>"mysql", "username"=>"root", "host"=>"localhost", "database"=>"Yardview5_development", "password"=>nil}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)

I' have tried running the rake command in command prompt and get the same error. I've tried uninstalling and reinstalling MySql gems. I've edited my database.yml file but still the same result.

Anyone have any solution?

Thanks

What do you have to say?

Title*
Name*
Email (never displayed)
(will show your gravatar)
Url
Comment*  
Please add 8 and 3 and type the answer here: