Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.
petemounce edited this page Sep 13, 2010 · 2 revisions

rake-dotnet

Overview

rake-dotnet is a library of:

  • windows command-line tool wrappers written in Ruby
  • custom build-tasks for Ruby’s rake, enabling a by-convention build-script.

The idea is that users can essentially pick from a menu of features that they want their build-script to have, comply with a set of conventions, and have their product under an automated build without needing to write much automation themselves.

rake-dotnet was originally created by Peter Mounce

An example rake-dotnet build-script:


require 'rake'
require 'rake/tasklib'
require 'rake_dotnet'

PRODUCT_NAME = ENV['PRODUCT_NAME'] ? ENV['PRODUCT_NAME'] : 'Demo'
COMPANY_NAME = ENV['COMPANY_NAME'] ? ENV['COMPANY_NAME'] : 'DemoCompany'

RakeDotNet::AssemblyInfoTask.new

RakeDotNet::MsBuildTask.new({:deps=>[:assembly_info]})

RakeDotNet::HarvestOutputTask.new({:deps => [:compile]})

RakeDotNet::HarvestWebApplicationTask.new({:deps=>[:compile]})

RakeDotNet::RDNPackageTask.new(name='bin', {:deps=>[:compile, :harvest_output, :xunit]}) do |p|
	p.targets.include("#{RakeDotNet::Bin_out}")
end

RakeDotNet::XUnitTask.new({:options=>{:html=>true}})

demo_site = File.join(RakeDotNet::OUT_DIR, 'Demo.Site')
RakeDotNet::RDNPackageTask.new(name='Demo.Site', {:deps=>[:compile, :harvest_webapps, :xunit]}) do |p|
	p.targets.include("#{demo_site}")
	p.targets.exclude("#{demo_site}**/obj")
end

RakeDotNet::FxCopTask.new do |fxc|
	fxc.dll_list.exclude("#{fxc.suites_dir}/**/*Tests*.dll")
end
RakeDotNet::NCoverTask.new

task :default => [:compile, :harvest_output, :xunit, :package]

This Rakefile.rb relies on these conventions, and:

  • includes the rake and rake-dotnet dependencies
  • sets up the PRODUCT_NAME and COMPANY_NAME constants
    • the ENV part allows you to run rake PRODUCT_NAME=SomethingElse at the command-line to specify it; otherwise it defaults to ‘Demo’
  • Auto-generates AssemblyInfo files
  • Compiles all projects in the source directory
  • Harvests build-output to a place that tests and static analysis can be run from easily
  • Harvests any web-applications
  • Packages up the output and web-application to a zip file
  • Runs FxCop (ignores Test DLLs)
  • Runs NCover
  • allows you to run rake from the command-line in the build directory, and have the specified tasks (which are prequisites for the :default task) run
Clone this wiki locally