Commit e7c612b4 by djsegal

Add annotations to helpers

parent cae7d86f
...@@ -27,7 +27,7 @@ module Annotate ...@@ -27,7 +27,7 @@ module Annotate
:exclude_fixtures, :exclude_factories, :ignore_model_sub_dir, :exclude_fixtures, :exclude_factories, :ignore_model_sub_dir,
:format_bare, :format_rdoc, :format_markdown, :sort, :force, :trace, :format_bare, :format_rdoc, :format_markdown, :sort, :force, :trace,
:timestamp, :exclude_serializers, :classified_sort, :show_foreign_keys, :timestamp, :exclude_serializers, :classified_sort, :show_foreign_keys,
:exclude_scaffolds, :exclude_controllers :exclude_scaffolds, :exclude_controllers, :exclude_helpers
] ]
OTHER_OPTIONS=[ OTHER_OPTIONS=[
:ignore_columns, :skip_on_db_migrate, :wrapper_open, :wrapper_close, :wrapper :ignore_columns, :skip_on_db_migrate, :wrapper_open, :wrapper_close, :wrapper
......
...@@ -9,7 +9,7 @@ module AnnotateModels ...@@ -9,7 +9,7 @@ module AnnotateModels
END_MARK = "== Schema Information End" END_MARK = "== Schema Information End"
PATTERN = /^\r?\n?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?\r?\n(#.*\r?\n)*(\r?\n)*/ PATTERN = /^\r?\n?# (?:#{COMPAT_PREFIX}|#{COMPAT_PREFIX_MD}).*?\r?\n(#.*\r?\n)*(\r?\n)*/
MATCHED_TYPES = %w(test fixture factory serializer scaffold controller) MATCHED_TYPES = %w(test fixture factory serializer scaffold controller helper)
# File.join for windows reverse bar compat? # File.join for windows reverse bar compat?
# I dont use windows, can`t test # I dont use windows, can`t test
...@@ -49,6 +49,9 @@ module AnnotateModels ...@@ -49,6 +49,9 @@ module AnnotateModels
# Controller files # Controller files
CONTROLLER_DIR = File.join("app", "controllers") CONTROLLER_DIR = File.join("app", "controllers")
# Helper files
HELPER_DIR = File.join("app", "helpers")
# Don't show limit (#) on these column types # Don't show limit (#) on these column types
# Example: show "integer" instead of "integer(4)" # Example: show "integer" instead of "integer(4)"
NO_LIMIT_COL_TYPES = ["integer", "boolean"] NO_LIMIT_COL_TYPES = ["integer", "boolean"]
...@@ -118,6 +121,10 @@ module AnnotateModels ...@@ -118,6 +121,10 @@ module AnnotateModels
[ [
File.join(root_directory, CONTROLLER_DIR, "%PLURALIZED_MODEL_NAME%_controller.rb") File.join(root_directory, CONTROLLER_DIR, "%PLURALIZED_MODEL_NAME%_controller.rb")
] ]
when 'helper'
[
File.join(root_directory, HELPER_DIR, "%PLURALIZED_MODEL_NAME%_helper.rb")
]
end end
end end
end end
...@@ -389,6 +396,7 @@ module AnnotateModels ...@@ -389,6 +396,7 @@ module AnnotateModels
# :exclude_serializers<Symbol>:: whether to skip modification of serializer files # :exclude_serializers<Symbol>:: whether to skip modification of serializer files
# :exclude_scaffolds<Symbol>:: whether to skip modification of scaffold files # :exclude_scaffolds<Symbol>:: whether to skip modification of scaffold files
# :exclude_controllers<Symbol>:: whether to skip modification of controller files # :exclude_controllers<Symbol>:: whether to skip modification of controller files
# :exclude_helpers<Symbol>:: whether to skip modification of helper files
# #
def annotate(klass, file, header, options={}) def annotate(klass, file, header, options={})
begin begin
......
...@@ -25,6 +25,7 @@ if Rails.env.development? ...@@ -25,6 +25,7 @@ if Rails.env.development?
'exclude_serializers' => 'false', 'exclude_serializers' => 'false',
'exclude_scaffolds' => 'false', 'exclude_scaffolds' => 'false',
'exclude_controllers' => 'false', 'exclude_controllers' => 'false',
'exclude_helpers' => 'false',
'ignore_model_sub_dir' => 'false', 'ignore_model_sub_dir' => 'false',
'ignore_columns' => nil, 'ignore_columns' => nil,
'skip_on_db_migrate' => 'false', 'skip_on_db_migrate' => 'false',
......
...@@ -30,6 +30,7 @@ task :annotate_models => :environment do ...@@ -30,6 +30,7 @@ task :annotate_models => :environment do
options[:exclude_serializers] = Annotate.true?(ENV['exclude_serializers']) options[:exclude_serializers] = Annotate.true?(ENV['exclude_serializers'])
options[:exclude_scaffolds] = Annotate.true?(ENV['exclude_scaffolds']) options[:exclude_scaffolds] = Annotate.true?(ENV['exclude_scaffolds'])
options[:exclude_controllers] = Annotate.true?(ENV['exclude_controllers']) options[:exclude_controllers] = Annotate.true?(ENV['exclude_controllers'])
options[:exclude_helpers] = Annotate.true?(ENV['exclude_helpers'])
options[:ignore_model_sub_dir] = Annotate.true?(ENV['ignore_model_sub_dir']) options[:ignore_model_sub_dir] = Annotate.true?(ENV['ignore_model_sub_dir'])
options[:format_bare] = Annotate.true?(ENV['format_bare']) options[:format_bare] = Annotate.true?(ENV['format_bare'])
options[:format_rdoc] = Annotate.true?(ENV['format_rdoc']) options[:format_rdoc] = Annotate.true?(ENV['format_rdoc'])
......
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