Skip to content

Instantly share code, notes, and snippets.

@joakimk
Created September 7, 2011 16:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joakimk/1200985 to your computer and use it in GitHub Desktop.
Save joakimk/1200985 to your computer and use it in GitHub Desktop.
Script to automatically annotate models after db:migrate is run.
# Used with:
# gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
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 before | grep -v 'Nothing annotated.'") || exit(1)
end
end
@RobertAudi
Copy link

I use guard-annotate to do the same thing.

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