Skip to content

Instantly share code, notes, and snippets.

@hsbt
Created May 14, 2014 01:04
Show Gist options
  • Save hsbt/8385215b09080fb318d0 to your computer and use it in GitHub Desktop.
Save hsbt/8385215b09080fb318d0 to your computer and use it in GitHub Desktop.
require 'logger'
class RakeExcecuter < Logger::Application
def initialize(tasklist = [])
super
@tasklist = tasklist
end
private
def run
@tasklist.each do |task|
log(Logger::DEBUG, "#{task} start")
# Rake::Task[task].invoke
p task
log(Logger::DEBUG, "#{task} end")
end
end
end
RakeExcecuter.new(%w(db:migrate db:seed)).start
@hsbt
Copy link
Author

hsbt commented May 14, 2014

% ruby sample.rb
I, [2014-05-14T09:54:58.024921 #26901] INFO -- ["db:migrate", "db:seed"]: Start of ["db:migrate", "db:seed"].
D, [2014-05-14T09:54:58.024996 #26901] DEBUG -- ["db:migrate", "db:seed"]: db:migrate start
"db:migrate"
D, [2014-05-14T09:54:58.025031 #26901] DEBUG -- ["db:migrate", "db:seed"]: db:migrate end
D, [2014-05-14T09:54:58.025068 #26901] DEBUG -- ["db:migrate", "db:seed"]: db:seed start
"db:seed"
D, [2014-05-14T09:54:58.025094 #26901] DEBUG -- ["db:migrate", "db:seed"]: db:seed end
I, [2014-05-14T09:54:58.025119 #26901] INFO -- ["db:migrate", "db:seed"]: End of ["db:migrate", "db:seed"]. (status: ["db:migrate", "db:seed"])

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