Rake error (Ruby) at the end of the build

I am using Ruby and Rake to do our builds at the moment for .Net projects.

I call several command line tools like NCover to check the coverage is high enough. When NCover returns and issues (issues) a code, although the Rake exits stop immediately.

Is there a hook like on_exit that I can use. I basically want to output "Build FAILED" in a nice red entry, and if possible, this step failed, and even better report why. It's just that it's a little clearer to developers.

NAnt has something similar and it's pretty handy. Wondering if Rake / Ruby had something similar.

Has anyone had this experience?

Greetings.

+2


source to share


2 answers


Ruby has at_exit

. You can use it like this:



at_exit do
   puts "this gets printed before the script finishes"
end

      

+3


source


Perhaps you can check for the error returned by the tool, for example:



sh %{NCover file} do |ok, res|
  if ! ok
    raise "Build FAILED in NCover"
  end
end

      

+1


source







All Articles