Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
cae7d86f
Commit
cae7d86f
authored
Dec 02, 2015
by
djsegal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add annotations to controllers
parent
7325e3c7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
2 deletions
+12
-2
annotate.rb
lib/annotate.rb
+1
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+9
-1
auto_annotate_models.rake
lib/generators/annotate/templates/auto_annotate_models.rake
+1
-0
annotate_models.rake
lib/tasks/annotate_models.rake
+1
-0
No files found.
lib/annotate.rb
View file @
cae7d86f
...
...
@@ -27,7 +27,7 @@ module Annotate
:exclude_fixtures
,
:exclude_factories
,
:ignore_model_sub_dir
,
:format_bare
,
:format_rdoc
,
:format_markdown
,
:sort
,
:force
,
:trace
,
:timestamp
,
:exclude_serializers
,
:classified_sort
,
:show_foreign_keys
,
:exclude_scaffolds
:exclude_scaffolds
,
:exclude_controllers
]
OTHER_OPTIONS
=
[
:ignore_columns
,
:skip_on_db_migrate
,
:wrapper_open
,
:wrapper_close
,
:wrapper
...
...
lib/annotate/annotate_models.rb
View file @
cae7d86f
...
...
@@ -9,7 +9,7 @@ module AnnotateModels
END_MARK
=
"== Schema Information End"
PATTERN
=
/^\r?\n?# (?:
#{
COMPAT_PREFIX
}
|
#{
COMPAT_PREFIX_MD
}
).*?\r?\n(#.*\r?\n)*(\r?\n)*/
MATCHED_TYPES
=
%w(test fixture factory serializer scaffold)
MATCHED_TYPES
=
%w(test fixture factory serializer scaffold
controller
)
# File.join for windows reverse bar compat?
# I dont use windows, can`t test
...
...
@@ -46,6 +46,9 @@ module AnnotateModels
SERIALIZERS_TEST_DIR
=
File
.
join
(
"test"
,
"serializers"
)
SERIALIZERS_SPEC_DIR
=
File
.
join
(
"spec"
,
"serializers"
)
# Controller files
CONTROLLER_DIR
=
File
.
join
(
"app"
,
"controllers"
)
# Don't show limit (#) on these column types
# Example: show "integer" instead of "integer(4)"
NO_LIMIT_COL_TYPES
=
[
"integer"
,
"boolean"
]
...
...
@@ -111,6 +114,10 @@ module AnnotateModels
File
.
join
(
root_directory
,
SERIALIZERS_TEST_DIR
,
"%MODEL_NAME%_serializer_spec.rb"
),
File
.
join
(
root_directory
,
SERIALIZERS_SPEC_DIR
,
"%MODEL_NAME%_serializer_spec.rb"
)
]
when
'controller'
[
File
.
join
(
root_directory
,
CONTROLLER_DIR
,
"%PLURALIZED_MODEL_NAME%_controller.rb"
)
]
end
end
end
...
...
@@ -381,6 +388,7 @@ module AnnotateModels
# :exclude_factories<Symbol>:: whether to skip modification of factory files
# :exclude_serializers<Symbol>:: whether to skip modification of serializer files
# :exclude_scaffolds<Symbol>:: whether to skip modification of scaffold files
# :exclude_controllers<Symbol>:: whether to skip modification of controller files
#
def
annotate
(
klass
,
file
,
header
,
options
=
{})
begin
...
...
lib/generators/annotate/templates/auto_annotate_models.rake
View file @
cae7d86f
...
...
@@ -24,6 +24,7 @@ if Rails.env.development?
'exclude_factories'
=>
'false'
,
'exclude_serializers'
=>
'false'
,
'exclude_scaffolds'
=>
'false'
,
'exclude_controllers'
=>
'false'
,
'ignore_model_sub_dir'
=>
'false'
,
'ignore_columns'
=>
nil
,
'skip_on_db_migrate'
=>
'false'
,
...
...
lib/tasks/annotate_models.rake
View file @
cae7d86f
...
...
@@ -29,6 +29,7 @@ task :annotate_models => :environment do
options
[
:exclude_fixtures
]
=
Annotate
.
true?
(
ENV
[
'exclude_fixtures'
])
options
[
:exclude_serializers
]
=
Annotate
.
true?
(
ENV
[
'exclude_serializers'
])
options
[
:exclude_scaffolds
]
=
Annotate
.
true?
(
ENV
[
'exclude_scaffolds'
])
options
[
:exclude_controllers
]
=
Annotate
.
true?
(
ENV
[
'exclude_controllers'
])
options
[
:ignore_model_sub_dir
]
=
Annotate
.
true?
(
ENV
[
'ignore_model_sub_dir'
])
options
[
:format_bare
]
=
Annotate
.
true?
(
ENV
[
'format_bare'
])
options
[
:format_rdoc
]
=
Annotate
.
true?
(
ENV
[
'format_rdoc'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment