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 @@ ...@@ -2,7 +2,7 @@
Add a comment summarizing the current schema to the top of each ActiveRecord model source file. 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 # id :integer(11) not null
# quantity :integer(11) # quantity :integer(11)
...@@ -47,4 +47,4 @@ Released under the same license as Ruby. No Support. No Warranty. ...@@ -47,4 +47,4 @@ Released under the same license as Ruby. No Support. No Warranty.
- Cuong Tran - http://github.com/ctran - Cuong Tran - http://github.com/ctran
- Jack Danger - http://github.com/JackDanger - Jack Danger - http://github.com/JackDanger
- Michael Bumann - http://github.com/bumi - Michael Bumann - http://github.com/bumi
- Henrik Nyh - http://github.com/henrik
...@@ -46,7 +46,7 @@ module AnnotateModels ...@@ -46,7 +46,7 @@ module AnnotateModels
end end
# Add a schema block to a file. If the file already contains # 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) # === Options (opts)
# :position<Symbol>:: where to place the annotated section in fixture or model file, # :position<Symbol>:: where to place the annotated section in fixture or model file,
...@@ -140,14 +140,18 @@ module AnnotateModels ...@@ -140,14 +140,18 @@ module AnnotateModels
begin begin
klass = get_model_class(file) klass = get_model_class(file)
if klass < ActiveRecord::Base && !klass.abstract_class? if klass < ActiveRecord::Base && !klass.abstract_class?
annotated << klass
annotate(klass, file, header,options) annotate(klass, file, header,options)
annotated << klass
end end
rescue Exception => e rescue Exception => e
puts "Unable to annotate #{file}: #{e.message}" puts "Unable to annotate #{file}: #{e.message}"
end end
end end
puts "Annotated #{annotated.join(', ')}" if annotated.empty?
puts "Nothing annotated!"
else
puts "Annotated #{annotated.join(', ')}"
end
end end
def remove_annotations def remove_annotations
...@@ -170,7 +174,7 @@ module AnnotateModels ...@@ -170,7 +174,7 @@ module AnnotateModels
puts "Unable to annotate #{file}: #{e.message}" puts "Unable to annotate #{file}: #{e.message}"
end end
end end
puts "Removed annotaion from: #{deannotated.join(', ')}" puts "Removed annotation from: #{deannotated.join(', ')}"
end end
end 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