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
17eb3b37
Commit
17eb3b37
authored
Jun 08, 2012
by
Alex Chaffee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack: make sure default position is 'before'; also remove VERSION.yml from gemspec
parent
a786d70b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
2 deletions
+3
-2
.gitignore
.gitignore
+0
-1
annotate.gemspec
annotate.gemspec
+1
-1
annotate
bin/annotate
+1
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-0
No files found.
.gitignore
View file @
17eb3b37
...
...
@@ -9,5 +9,4 @@ Gemfile.lock
*.gem
/.idea/
.rvmrc
.bundle
.bundle/
annotate.gemspec
View file @
17eb3b37
...
...
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s
.
executables
=
`git ls-files -- bin/*`
.
split
(
"
\n
"
).
map
{
|
f
|
File
.
basename
(
f
)
}
s
.
extra_rdoc_files
=
[
"README.rdoc"
]
s
.
files
=
%w( README.rdoc
VERSION.yml
History.txt )
s
.
files
=
%w( README.rdoc History.txt )
s
.
files
+=
Dir
.
glob
(
"lib/**/*"
)
s
.
files
+=
Dir
.
glob
(
"tasks/**/*"
)
s
.
files
+=
[
"bin/annotate"
]
# todo: annotate_models
...
...
bin/annotate
View file @
17eb3b37
...
...
@@ -20,6 +20,7 @@ OptionParser.new do |opts|
task
=
:remove_annotation
end
ENV
[
'position'
]
=
'before'
# hack: make sure default position is "before"
opts
.
on
(
'-p'
,
'--position [before|after]'
,
[
'before'
,
'after'
],
"Place the annotations at the top (before) or the bottom (after) of the model file"
)
do
|
p
|
ENV
[
'position'
]
=
p
...
...
lib/annotate/annotate_models.rb
View file @
17eb3b37
...
...
@@ -197,6 +197,7 @@ module AnnotateModels
# Strip the old schema info, and insert new schema info.
old_content
.
sub!
(
encoding
,
''
)
old_content
.
sub!
(
PATTERN
,
''
)
new_content
=
(
options
[
:position
]
||
'before'
).
to_s
==
'after'
?
(
encoding_header
+
(
old_content
.
rstrip
+
"
\n\n
"
+
info_block
))
:
(
encoding_header
+
info_block
+
old_content
)
...
...
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