#!/usr/bin/env ruby unless File.exist?('./Rakefile') || File.exist?('./Gemfile') abort 'Please run annotate from the root of the project.' end require 'rubygems' begin require 'bundler' Bundler.setup rescue StandardError end here = File.expand_path(File.dirname __FILE__) $LOAD_PATH << "#{here}/../lib" require 'annotate' require 'annotate/parser' Annotate.bootstrap_rake options_result = Annotate::Parser.parse(ARGV) exit if options_result[:exit] options = Annotate.setup_options( is_rake: ENV['is_rake'] && !ENV['is_rake'].empty? ) Annotate.eager_load(options) if Annotate::Helpers.include_models? AnnotateModels.send(options_result[:target_action], options) if Annotate::Helpers.include_models? AnnotateRoutes.send(options_result[:target_action], options) if Annotate::Helpers.include_routes?