Skip to content

Instantly share code, notes, and snippets.

@thomd
Created September 14, 2012 13:31
Show Gist options
  • Save thomd/3721920 to your computer and use it in GitHub Desktop.
Save thomd/3721920 to your computer and use it in GitHub Desktop.
Rake Helpers
desc "example usage of rake helper"
task :default do
Rake::Shell["ls -al"]
Rake::Log["usage of rake helper"]
end
module Rake
class Shell
def self.[](command)
output = %x[#{command}]
if $?.to_i > 0
puts "-----> Process aborted"
puts " Exit status: #{$?}"
exit($?.to_i)
end
puts output
end
end
class Log
def self.[](message)
puts "-----> #{message.split("\n").join("\n ")}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment