Commit 16224621 by Henrik N Committed by Cuong Tran

Show 'Nothing to annotate!' instead of 'Annotated ' when there are no applicable models.

Typo: 'annotaion' -> 'annotation'. Don't say that class was annotated if annotation errored out. Add myself to README credits. Update README/example to use the schema version-less header. Rephrase "Nothing to annotate" --> "Nothing annotated"; makes more sense if there were none because they failed.
parent 60fc98a2
......@@ -2,7 +2,7 @@
Add a comment summarizing the current schema to the top of each ActiveRecord model source file.
# Schema as of Sun Feb 26 21:58:32 CST 2006 (schema version 7)
# == Schema Information
#
# id :integer(11) not null
# quantity :integer(11)
......@@ -47,4 +47,4 @@ Released under the same license as Ruby. No Support. No Warranty.
- Cuong Tran - http://github.com/ctran
- Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi
- Henrik Nyh - http://github.com/henrik
......@@ -46,7 +46,7 @@ module AnnotateModels
end
# Add a schema block to a file. If the file already contains
# a schema info block (a comment starting with "Schema as of ..."), remove it first.
# a schema info block (a comment starting with "== Schema Information"), remove it first.
#
# === Options (opts)
# :position<Symbol>:: where to place the annotated section in fixture or model file,
......@@ -140,15 +140,19 @@ module AnnotateModels
begin
klass = get_model_class(file)
if klass < ActiveRecord::Base && !klass.abstract_class?
annotated << klass
annotate(klass, file, header,options)
annotated << klass
end
rescue Exception => e
puts "Unable to annotate #{file}: #{e.message}"
end
end
if annotated.empty?
puts "Nothing annotated!"
else
puts "Annotated #{annotated.join(', ')}"
end
end
def remove_annotations
deannotated = []
......@@ -170,7 +174,7 @@ module AnnotateModels
puts "Unable to annotate #{file}: #{e.message}"
end
end
puts "Removed annotaion from: #{deannotated.join(', ')}"
puts "Removed annotation from: #{deannotated.join(', ')}"
end
end
end
\ No newline at end of file
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