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
9d52904a
Commit
9d52904a
authored
Mar 01, 2012
by
Jon Frisby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixups.
parent
f5c1aa0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
annotate_models
bin/annotate_models
+1
-1
annotate.rb
lib/annotate.rb
+3
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+3
-3
No files found.
bin/annotate_models
View file @
9d52904a
...
...
@@ -73,7 +73,7 @@ OptionParser.new do |opts|
exclusions
.
each
{
|
exclusion
|
ENV
[
"exclude_
#{
exclusion
}
"
]
=
"yes"
}
end
opts
.
on
(
'-f'
,
'--format [bare|rdoc|markdown]'
,
[
'bare'
,
'rdoc'
,
'markdown'
],
'
rdoc: render Schema Infomation as RDoc
'
)
do
|
fmt
|
opts
.
on
(
'-f'
,
'--format [bare|rdoc|markdown]'
,
[
'bare'
,
'rdoc'
,
'markdown'
],
'
Render Schema Infomation as plain/RDoc/Markdown
'
)
do
|
fmt
|
ENV
[
"format_
#{
fmt
}
"
]
=
'yes'
end
...
...
lib/annotate.rb
View file @
9d52904a
...
...
@@ -16,7 +16,9 @@ module Annotate
if
File
.
exists?
(
'Rakefile'
)
require
'rake'
load
'Rakefile'
Dir
[
File
.
join
(
File
.
dirname
(
__FILE__
),
'tasks'
,
'**/*.rake'
)].
each
{
|
rake
|
load
rake
}
# Rails 3 wants to load our .rake files for us.
# TODO: selectively do this require on Rails 2.x?
#Dir[File.join(File.dirname(__FILE__), 'tasks', '**/*.rake')].each { |rake| load rake }
return
true
else
return
false
...
...
lib/annotate/annotate_models.rb
View file @
9d52904a
...
...
@@ -67,8 +67,8 @@ module AnnotateModels
max_size
+=
options
[
:format_rdoc
]
?
5
:
1
if
(
options
[
:format_markdown
])
info
<<
sprintf
(
"# %-
#{
max_size
+
4
}
.
#{
max_size
+
4
}
s | %-1
7.17s | %s
\n
"
,
'Field'
,
'Type'
,
'Attributes'
)
info
<<
"#
#{
'-'
*
(
max_size
+
4
)
}
|
#{
'-'
*
1
7
}
|
#{
'-'
*
25
}
\n
"
info
<<
sprintf
(
"# %-
#{
max_size
+
4
}
.
#{
max_size
+
4
}
s | %-1
8.18s | %s
\n
"
,
'Field'
,
'Type'
,
'Attributes'
)
info
<<
"#
#{
'-'
*
(
max_size
+
4
)
}
|
#{
'-'
*
1
8
}
|
#{
'-'
*
25
}
\n
"
end
cols
=
klass
.
columns
...
...
@@ -109,7 +109,7 @@ module AnnotateModels
if
options
[
:format_rdoc
]
info
<<
sprintf
(
"# %-
#{
max_size
}
.
#{
max_size
}
s<tt>%s</tt>"
,
"*
#{
col
.
name
}
*::"
,
attrs
.
unshift
(
col_type
).
join
(
", "
)).
rstrip
+
"
\n
"
elsif
options
[
:format_markdown
]
info
<<
sprintf
(
"# **%-
#{
max_size
}
.
#{
max_size
}
s** | `%-16.16s` | `%s
`"
,
col
.
name
,
col_type
,
attrs
.
join
(
", "
)).
rstrip
+
"
\n
"
info
<<
sprintf
(
"# **%-
#{
max_size
}
.
#{
max_size
}
s** | `%-16.16s` | `%s
`"
,
col
.
name
,
col_type
,
attrs
.
join
(
", "
).
rstrip
)
+
"
\n
"
else
info
<<
sprintf
(
"# %-
#{
max_size
}
.
#{
max_size
}
s:%-16.16s %s"
,
col
.
name
,
col_type
,
attrs
.
join
(
", "
)).
rstrip
+
"
\n
"
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