Sha256: c87612e5583345d0e3f7c84b4561fd20b49d27317d35d99b129cc0cd7d63d339

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 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('--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

2 entries across 2 versions & 1 rubygems

Version Path
nofxx-annotate-2.3.0 bin/annotate
nofxx-annotate-2.3.1 bin/annotate