Moving from NAnt to Rake….

On the new project in work the team took a decision to move from NAnt to Rake,  we’d got to a very mature state with our NAnt Build/Deployment scripts but we were finding it difficult to do more programmatic tasks e.g. for loops! This prompted our move to Rake as we could then write pure Ruby when needed, hopefully get more reuse from already existing gems and our code!

So how did the move go?

Very well thanks!

  • Its much easier than writing NAnt and using RubyMine as our IDE helps a lot.
  • We’ve bin following the best practice we learnt from our NAnt scripts, in most cases implementing the simple task is much the same but Rake/Ruby make the complex tasks much easier to write and maintain
  • Rake gives more scope around deployments there’s tools like Chef and Puppet which use Ruby, I’m excited to see were we go in this space.

Gems we used:

  • albacore
  • win32console
  • term-ansicolor
  • ruby-zip

We’ve written four helper classes:

  • template.rb – used to wrap erb
  • file.rb – extend the Ruby file class so that the expand_path method works for windows


def self.expand_path_windows(file_name)
expand_path(file_name).gsub("/","\\")
end


  • iis.rb – used to wrap the appcmd calls for iis there is a ruby gem out there call inetmgr
  • robocopy.rb – this is the article we followed to create our class here

In the long run were going to try and write our own gems and release them for anything we’ve done we can’t find a gem for already we’ll see how it goes!

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: