Commit ed2cf5ec by Alex Chaffee

Merge remote branch 'zapnap/master'

* zapnap/master: correct rake task name add auto-annotate magic for ActiveRecord migrations in Rails
parents 43d02fcf 86a7893a
......@@ -89,6 +89,11 @@ More options:
-R, --require path Additional files to require before loading models
-e, --exclude [tests,fixtures] Do not annotate fixtures, test files, or both
If you install annotate_models as a plugin, it will automatically
adjust your <tt>rake db:migrate</tt> tasks so that they update the
annotations in your model files for you once the migration is
completed.
== LICENSE:
Released under the same license as Ruby. No Support. No Warranty.
......
......@@ -185,7 +185,7 @@ module AnnotateModels
def get_model_files
models = ARGV.dup
models.shift
models.reject!{|m| m.starts_with?("position=")}
models.reject!{|m| m.match(/^(.*)=/)}
if models.empty?
begin
Dir.chdir(model_dir) do
......
# append annotations to Rake tasks (for ActiveRecord)
namespace :db do
task :migrate do
Annotate::Migration.update_annotations
end
namespace :migrate do
[:up, :down, :reset, :redo].each do |t|
task t do
Annotate::Migration.update_annotations
end
end
end
end
module Annotate
class Migration
@@working = false
def self.update_annotations
unless @@working
@@working = true
Rake::Task['annotate_models'].invoke
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