Skip to content

Instantly share code, notes, and snippets.

@acuppy
Created July 26, 2016 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acuppy/7083de1ce2be1db2a0bb324ee3b19f8b to your computer and use it in GitHub Desktop.
Save acuppy/7083de1ce2be1db2a0bb324ee3b19f8b to your computer and use it in GitHub Desktop.
An example of how to tap into Rake and run a log line prior to every Rake Task run.
# lib/rake/logging.rb
require 'rake'
module Rake
module Logging
def invoke_task *args
puts "Running: #{parse_task_string args.first}" # ...or do whatever
super
end
end
end
Rake::Application.class_eval do
prepend Rake::Logging
end
@acuppy
Copy link
Author

acuppy commented Jul 26, 2016

FYI: parse_task_string is part of Rake::Application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment