Skip to content

Instantly share code, notes, and snippets.

@prikha
Created December 30, 2011 09:51
Show Gist options
  • Save prikha/1539059 to your computer and use it in GitHub Desktop.
Save prikha/1539059 to your computer and use it in GitHub Desktop.
Annotate rails models on db:migrate
if Rails.env.development?
def after_task(task_name, &new_task)
old_task = Rake.application.instance_variable_get('@tasks').delete(task_name.to_s)
desc old_task.full_comment
task task_name do
old_task.invoke
new_task.call
end
end
after_task "db:migrate" do
system("bundle exec annotate -e tests,fixtures -p after | grep -v 'Nothing annotated.'") || exit(1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment