Sha256: fe6624aa7f5c36166af9c8f6c2ea5b2588bed990c1b8f98028fd88876bd8977c

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'annotate'

task = :annotate_models

OptionParser.new do |opts|
  opts.banner = "Usage: annotate [options]"
  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('-s', '--sort', "Sort columns alphabetically (rather than listing in creation order)") { ENV['sort'] = "yes" }
  opts.on('--model-dir dir', "Annotate model files stored in dir rather than app/models") {|dir| ENV['model_dir'] = dir }
end.parse!

if Annotate.load_tasks
  Rake::Task[task].invoke
else
  STDERR.puts "Can't find Rakefile. Are we in a Rails folder?"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tonyday-annotate-2.0.2 bin/annotate