Skip to content

Instantly share code, notes, and snippets.

@Redth
Last active August 29, 2015 14:26
Show Gist options
  • Save Redth/64a03e4334edb33db5d5 to your computer and use it in GitHub Desktop.
Save Redth/64a03e4334edb33db5d5 to your computer and use it in GitHub Desktop.
class Cake < Formula
depends_on "mono" => :optional
version "0.5.1"
sha256 "e3620f9bb1466d47502aeb934868284e241877ad5f43531f898443d846bd7c0b"
desc "Cake (C# Make) is a build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages."
homepage "http://cakebuild.net/"
url "https://www.nuget.org/api/v2/package/Cake/#{version}"
def install
prefix.install "Autofac.dll"
prefix.install "Cake.Common.dll"
prefix.install "Cake.Core.dll"
prefix.install "Cake.exe"
prefix.install "Mono.CSharp.dll"
prefix.install "Nuget.Core.dll"
bin.mkpath
(bin/"cake").write <<-EOS.undent
#!/bin/bash
/usr/bin/mono #{prefix}/Cake.exe "$@"
EOS
end
test do
# just run cake to see the version, if we have an ok exit code it worked
system bin/"cake", "-version"
# write a temporary script and run it, check the output
test_str = "Hello Homebrew"
test_name = "build.cake"
(testpath/test_name).write <<-EOS.undent
var target = Argument ("target", "info");
Task("info").Does(() =>
{
Information ("Hello Homebrew");
});
RunTarget ("info");
EOS
output = shell_output "#{bin}/cake ./build.cake"
assert_match test_str, output.strip
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment