Skip to content

Instantly share code, notes, and snippets.

@apetrov
Created January 9, 2019 10:36
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 apetrov/c060c2ab034ad4d6368efbfe8c2ffc26 to your computer and use it in GitHub Desktop.
Save apetrov/c060c2ab034ad4d6368efbfe8c2ffc26 to your computer and use it in GitHub Desktop.
Extending rake trace
rake -t db:migrate
root@0f285b5c68a3:/app# rake -t db:migrate
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
environment #<Proc:0x000055887e4bb3b8@/usr/local/bundle/gems/railties-5.2.0/lib/rails/application.rb:517>
** Execute environment
db:load_config #<Proc:0x000055887cb20480@/usr/local/bundle/gems/activerecord-5.2.0/lib/active_record/railtie.rb:38>
db:load_config #<Proc:0x000055887c95ba50@/usr/local/bundle/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:16>
** Execute db:load_config
db:migrate #<Proc:0x000055887c8fdbf8@/usr/local/bundle/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:59>
** Execute db:migrate
** Invoke db:_dump (first_time)
db:_dump #<Proc:0x000055887c8e7a38@/usr/local/bundle/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:65>
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
db:schema:dump #<Proc:0x000055887c7e7a70@/usr/local/bundle/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:247>
** Execute db:schema:dump
# Adding source locations to rake trace
class Rake::Task
def execute_with_actions_logs(args=nil)
@actions.each do |t|
if application.options.trace
puts "#{name} #{t.inspect}"
end
end
execute_without_actions_logs(args)
end
alias_method :execute_without_actions_logs, :execute
alias_method :execute, :execute_with_actions_logs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment