Commit 22e6d49c by Jon Frisby

Improve rakefile generator.

parent 7f9e974d
To copy the Rakefile that automatically annotates models when you do a db:migrate: Add a .rake file that automatically annotates models when you do a db:migrate
in development mode:
rails generate annotate_models:install rails generate annotate_models:install
\ No newline at end of file
# This file was derived from a Rakefile described in this blog post: # NOTE: only doing this in development as some production environments (Heroku)
# http://talklikeaduck.denhaven2.com/2011/01/29/automatic-annotation-with-rails-3-with-the-annotate-gem # NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# Position in class/fixture is either 'before' or 'after' # NOTE: to have a dev-mode tool do its thing in production.
if(Rails.env.development?)
require 'annotate/tasks'
namespace :db do ENV['position_in_class'] = "before"
task :migrate do ENV['position_in_fixture'] = "before"
unless Rails.env.production? ENV['show_indexes'] = "true"
require "annotate/annotate_models" ENV['include_version'] = "false"
AnnotateModels.do_annotations(:position_in_class => 'after', :position_in_fixture => 'after') ENV['exclude_tests'] = "false"
end ENV['exclude_fixtures'] = "false"
end ENV['skip_on_db_migrate'] = "false"
namespace :migrate do
[:up, :down, :reset, :redo].each do |t|
task t do
unless Rails.env.production?
require "annotate/annotate_models"
AnnotateModels.do_annotations(:position_in_class => 'after', :position_in_fixture => 'after')
end
end
end
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment