Commit 4d0a74ba by Alex Chaffee

improved documentation

parent 6aee8813
......@@ -60,18 +60,17 @@ To annotate routes.rb:
annotate -r
More:
More options:
annotate -h
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
Add annotation at the beginning or end of the file:
annotate -p [before|after]
Remove annotations:
annotate -d
== LICENSE:
Released under the same license as Ruby. No Support. No Warranty.
......@@ -84,7 +83,7 @@ Original code by:
Modifications by:
- alex@pivotallabs.com
- 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
......
......@@ -7,13 +7,13 @@ task = :annotate_models
OptionParser.new do |opts|
opts.banner = "Usage: annotate [options]"
opts.on('-d', '--delete') { task = :remove_annotation }
opts.on('-p', '--position [before|after]', ['before', 'after']) { |p| ENV['position'] = p }
opts.on('-r', '--routes') { task = :annotate_routes }
opts.on('-v', '--version') { puts "Annotate v#{Annotate::VERSION}"; exit }
opts.on('-m', '--show-migration') { ENV['include_version'] = "yes" }
opts.on('-i', '--show-indexes') { ENV['show_indexes'] = "yes" }
opts.on('--model-dir dir') {|dir| ENV['model_dir'] = dir }
opts.on('-d', '--delete', "Remove annotations from all model files") { task = :remove_annotation }
opts.on('-p', '--position [before|after]', ['before', 'after'], "Place the annotations at the top (before) or the bottom (after) of the model file") { |p| ENV['position'] = p }
opts.on('-r', '--routes', "Annotate routes.rb with the output of 'rake routes'") { task = :annotate_routes }
opts.on('-v', '--version', "Show the current version of this gem") { puts "Annotate v#{Annotate::VERSION}"; exit }
opts.on('-m', '--show-migration', "Include the migration version number in the annotation") { ENV['include_version'] = "yes" }
opts.on('-i', '--show-indexes', "List the table's database indexes in the annotation") { ENV['show_indexes'] = "yes" }
opts.on('--model-dir dir', "Annotate model files stored in dir rather than app/models") {|dir| ENV['model_dir'] = dir }
end.parse!
begin
......
......@@ -182,7 +182,7 @@ module AnnotateModels
# Check for namespaced models in subdirectories as well as models
# in subdirectories without namespacing.
def get_model_class(file)
require "#{model_dir}/#{file}"
require "#{model_dir}/#{file}" # this is for non-rails projects, which don't get Rails auto-require magic
model = file.gsub(/\.rb$/, '').camelize
parts = model.split('::')
begin
......
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