Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Annotate ActiveRecord models as a gem
Ruby JavaScript
Branch: master
Pull request Compare This branch is 619 commits behind ctran:master.

output as binary files to enforce "unix command line" mode.

= In ruby, on windows =
* A text file with CRLF or LF line endings will be opened with UNIX (LF) line endings in ruby.
* When writing text to a file, ruby always uses CRLF line endings, regardless of the format of the line endings of the file to begin with.

This causes an automatic conversion of all LF files to CRLF.  If you check out a project that uses unix line endings, then run annotate_models (before this commit), you're SCM is going to want to commit every line of every model.

= In ruby, on *nix / osx =
- Strings are always read and written as text with LF line endings.

----

The end result is an endless tug-a-war over line-endings for collaborating windows and *nix developers.

If you specify to write the files as binary ("wb"), both windows and *nix will output the text with LF line endings.  Most editors on windows support this format, and if you're deploying to a linux server, you should be using this format anyways.  This has solved the tug-a-war for me.
latest commit b81806401f
@timcharper authored

README.txt

== AnnotateModels

Add a comment summarizing the current schema to the top of each ActiveRecord model source file.

  # == Schema Information
  #
  #  id                  :integer(11)   not null
  #  quantity            :integer(11)   
  #  product_id          :integer(11)   
  #  unit_price          :float         
  #  order_id            :integer(11)   
  #

  class LineItem < ActiveRecord::Base 
    belongs_to :product
  
   end
  
Note that this code will blow away the initial 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.

== Install

  sudo gem install annotate-models
  
== Usage

  cd [your project]
  annotate
  annotate -d
  annotate -p [before|after]
  annotate -h

== Source

  http://github.com/ctran/annotate_models
  
== Author
   Dave Thomas
   Pragmatic Programmers, LLC

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

== Modifications
 - 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
Something went wrong with that request. Please try again.