public
Description: Annotate ActiveRecord models as a gem
Homepage: http://agilewebdevelopment.com/plugins/annotate_models
Clone URL: git://github.com/ctran/annotate_models.git
name age message
file .gitignore Tue Feb 03 16:50:19 -0800 2009 Merge changes from git://github.com/nofxx/annot... [ctran]
file History.txt Tue Feb 03 16:50:19 -0800 2009 Merge changes from git://github.com/nofxx/annot... [ctran]
file Manifest.txt Wed Apr 29 22:14:48 -0700 2009 upgrade to newgem 1.3 fix the dependencies so i... [ctran]
file README.rdoc Thu Apr 30 12:11:26 -0700 2009 improved documentation [Alex Chaffee]
file Rakefile Wed May 06 14:16:03 -0700 2009 update gemspec [ctran]
file annotate.gemspec Wed May 06 14:16:03 -0700 2009 update gemspec [ctran]
file annotate_models.gemspec Fri May 01 14:54:03 -0700 2009 regenerate gemspec so github will rebuild gem (... [ctran]
directory bin/ Thu Apr 30 16:09:06 -0700 2009 Merge commit 'ctran/v2_0_2' * commit 'ctran/v2... [Alex Chaffee]
directory lib/ Thu Apr 30 16:09:06 -0700 2009 Merge commit 'ctran/v2_0_2' * commit 'ctran/v2... [Alex Chaffee]
directory script/ Wed Apr 29 22:14:48 -0700 2009 upgrade to newgem 1.3 fix the dependencies so i... [ctran]
directory spec/ Wed Apr 29 22:14:48 -0700 2009 upgrade to newgem 1.3 fix the dependencies so i... [ctran]
directory tasks/ Wed Apr 29 22:14:48 -0700 2009 upgrade to newgem 1.3 fix the dependencies so i... [ctran]
README.rdoc

AnnotateModels

Add a comment summarizing the current schema to the bottom of each ActiveRecord model, fixture file.

If you are using Object Daddy, it`ll annotate your example files too.

 # == Schema Info
 #
 # Table name: line_items
 #
 #  id                  :integer(11)    not null, primary key
 #  quantity            :integer(11)    not null
 #  product_id          :integer(11)    not null
 #  unit_price          :float
 #  order_id            :integer(11)
 #

  class LineItem < ActiveRecord::Base
    belongs_to :product
   . . .

Annotates geometrical columns, geom type and srid, when using SpatialAdapter or PostgisAdapter:

 # == Schema Info
 #
 # Table name: trips
 #
 #  local           :geometry        point, 4326
 #  path            :geometry        line_string, 4326

Warning

Note that this code will blow away the initial/final comment block in your models if it looks like it was previously added by annotate models, so you don’t want to add additional text to an automatically created comment block.

       * * Back up your model files before using... * *

Install

From rubyforge:

  sudo gem install annotate

From github:

  gem sources -a http://gems.github.com
  sudo gem install ctran-annotate

Usage

To annotate all your models:

  cd /path/to/app
  annotate

To annotate routes.rb:

  annotate -r

More options:

  Usage: annotate [options]
      -d, --delete                     Remove annotations from all model files
      -p, --position [before|after]    Place the annotations at the top (before) or the bottom (after) of the model file
      -r, --routes                     Annotate routes.rb with the output of 'rake routes'
      -v, --version                    Show the current version of this gem
      -m, --show-migration             Include the migration version number in the annotation
      -i, --show-indexes               List the table's database indexes in the annotation
          --model-dir dir              Annotate model files stored in dir rather than app/models

LICENSE:

Released under the same license as Ruby. No Support. No Warranty.

Author:

Original code by:

  Dave Thomas -- Pragmatic Programmers, LLC

Modifications by:

 - Alex Chaffee - http://github.com/alexch - alex@pivotallabs.com
 - Cuong Tran - http://github.com/ctran
 - Jack Danger - http://github.com/JackDanger
 - Michael Bumann - http://github.com/bumi
 - Henrik Nyh - http://github.com/henrik
 - Marcos Piccinini - http://github.com/nofxx

and many others that I may have missed to add.