Commit 7f9e974d by Jon Frisby

Merge remote-tracking branch 'rubyjedi/master'

(NOTE: Unfinished. Will replace rakefile in next commit.) Conflicts: annotate.gemspec
parents 858b4d69 8ce983d7
...@@ -31,6 +31,9 @@ Gem::Specification.new do |s| ...@@ -31,6 +31,9 @@ Gem::Specification.new do |s|
"lib/annotate/annotate_models.rb", "lib/annotate/annotate_models.rb",
"lib/annotate/annotate_routes.rb", "lib/annotate/annotate_routes.rb",
"lib/annotate/tasks.rb", "lib/annotate/tasks.rb",
"lib/generators/annotate_models/USAGE",
"lib/generators/annotate_models/install_generator.rb",
"lib/generators/annotate_models/templates/auto_annotate_models.rake",
"lib/tasks/annotate_models.rake", "lib/tasks/annotate_models.rake",
"lib/tasks/annotate_routes.rake", "lib/tasks/annotate_routes.rake",
"spec/annotate/annotate_models_spec.rb", "spec/annotate/annotate_models_spec.rb",
......
To copy the Rakefile that automatically annotates models when you do a db:migrate:
rails generate annotate_models:install
\ No newline at end of file
module AnnotateModels
module Generators
class InstallGenerator < Rails::Generators::Base
desc "Copy annotate_models rakefiles for automatic annotation"
source_root File.expand_path('../templates', __FILE__)
# copy rake tasks
def copy_tasks
template "auto_annotate_models.rake", "lib/tasks/auto_annotate_models.rake"
end
end
end
end
\ No newline at end of file
# This file was derived from a Rakefile described in this blog post:
# http://talklikeaduck.denhaven2.com/2011/01/29/automatic-annotation-with-rails-3-with-the-annotate-gem
# Position in class/fixture is either 'before' or 'after'
namespace :db do
task :migrate do
unless Rails.env.production?
require "annotate/annotate_models"
AnnotateModels.do_annotations(:position_in_class => 'after', :position_in_fixture => 'after')
end
end
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
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