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
8d3c00c7
Commit
8d3c00c7
authored
Jul 28, 2009
by
Tony Day
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to sort be default with an option to not sort.
parent
e0527559
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
3 deletions
+4
-3
.gitignore
.gitignore
+1
-0
annotate
bin/annotate
+1
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-1
annotate_models.rake
lib/tasks/annotate_models.rake
+1
-1
No files found.
.gitignore
View file @
8d3c00c7
...
...
@@ -4,3 +4,4 @@ rdoc/*
coverage/*
spec/debug.log
pkg/*
.idea
bin/annotate
View file @
8d3c00c7
...
...
@@ -13,7 +13,7 @@ OptionParser.new do |opts|
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
(
'-
n'
,
'--no-sort'
,
"Sort columns alphabetically (rather than listing in creation order)"
)
{
ENV
[
'no_
sort'
]
=
"yes"
}
opts
.
on
(
'--model-dir dir'
,
"Annotate model files stored in dir rather than app/models"
)
{
|
dir
|
ENV
[
'model_dir'
]
=
dir
}
end
.
parse!
...
...
lib/annotate/annotate_models.rb
View file @
8d3c00c7
...
...
@@ -65,7 +65,7 @@ module AnnotateModels
cols
<<
sprintf
(
"# %-
#{
max_size
}
.
#{
max_size
}
s:%-15.15s %s"
,
col
.
name
,
col_type
,
attrs
.
join
(
", "
)).
rstrip
+
"
\n
"
end
cols
.
sort!
if
options
[
:
sort
]
cols
.
sort!
unless
options
[
:no_
sort
]
info
<<
cols
.
join
if
options
[
:show_indexes
]
...
...
lib/tasks/annotate_models.rake
View file @
8d3c00c7
...
...
@@ -7,7 +7,7 @@ task :annotate_models => :environment do
options
[
:show_indexes
]
=
ENV
[
'show_indexes'
]
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
options
[
:include_version
]
=
ENV
[
'include_version'
]
options
[
:
sort
]
=
ENV
[
'
sort'
]
options
[
:
no_sort
]
=
ENV
[
'no_
sort'
]
AnnotateModels
.
do_annotations
(
options
)
end
...
...
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