Archive for the ‘Ruby’ Category

ILMerge and Rake go xunit.BDDExtensions (2009-1-27)

Today I added this little piece of code to the trunk of xUnit.BDDExtensions. It’s a rake task for merging assemblies via the ILMerge tool.

desc "Merges the assemblies"
task :merge do
mkdir DEPLOY_DIR unless File.exists?(DEPLOY_DIR)
cp "xunit.dll".expand_to(:build_dir), "xunit.dll".expand_to(:deploy_dir)
cp "Rhino.Mocks.dll".expand_to(:build_dir), "Rhino.Mocks.dll".expand_to(:deploy_dir)
assemblies_to_merge = ["xUnit.BDDExtensions.dll", "StructureMap.dll", "StructureMap.AutoMocking.dll"]
ilmerge "xunit.bddextensions.dll", assemblies_to_merge
end

Ruby is a fantastic [...]

Tales from hashes, null and boolean evaluation (2009-1-21)

A common programming situation when dealing with dictionary or hashtable classes is trying  to get a value from the hashtable and returning a default value in case nothing was found. In C# you could probably do it like this:

public class StringMapper : IMapper<string,string>
{
private IDictionary mapping; [...]

Using Rake to automate .NET builds (2009-1-19)

Today I started writing my first build scripts in Ruby for a .NET project using Rake. This is what I came up with.

require 'rake/clean'

EXTERNALS_DIR = File.expand_path('../Externals')
BUILD_DIR = File.expand_path('../Bin')
SOURCE_DIR = File.expand_path('../Source')

CLEAN.include(FileList[File.join(BUILD_DIR, '*')])

desc "Compiles the gemini sources"
task :build do
gemini_solution = File.join(SOURCE_DIR, 'Gemini.sln')
sh "msbuild /property:WarningLevel=4;OutDir=#{BUILD_DIR}/ #{gemini_solution}"
end

desc "Runs all the tests on the [...]