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
89914697
Commit
89914697
authored
Feb 12, 2009
by
codeape
Committed by
Martin Stannard
Nov 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding extra option to enable skipping the inclusion of current migration veresion
Signed-off-by:
ctran
<
ctran@pragmaquest.com
>
parent
81ab6187
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
annotate_models.gemspec
annotate_models.gemspec
+2
-2
annotate
bin/annotate
+1
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+7
-4
annotate.rake
lib/tasks/annotate.rake
+1
-0
No files found.
annotate_models.gemspec
View file @
89914697
...
...
@@ -2,10 +2,10 @@
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
%q{annotate}
s
.
version
=
"2.0.0"
s
.
version
=
"2.0.0
.20090212000
"
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
authors
=
[
"Cuong Tran"
]
s
.
authors
=
[
"
Dan Cheail"
,
"
Cuong Tran"
]
s
.
date
=
%q{2009-02-03}
s
.
default_executable
=
%q{annotate}
s
.
description
=
%q{Annotates Rails Models, routes, and others}
...
...
bin/annotate
View file @
89914697
...
...
@@ -11,6 +11,7 @@ OptionParser.new do |opts|
opts
.
on
(
'-p'
,
'--position [before|after]'
,
[
'before'
,
'after'
])
{
|
p
|
ENV
[
'position'
]
=
p
}
opts
.
on
(
'-r'
,
'--routes'
)
{
task
=
:annotate_routes
}
opts
.
on
(
'-v'
,
'--version'
)
{
puts
"Annotate v
#{
Annotate
::
VERSION
}
"
;
exit
}
opts
.
on
(
'-m'
,
'--show-migration'
)
{
ENV
[
'include_version'
]
=
"yes"
}
end
.
parse!
begin
...
...
lib/annotate/annotate_models.rb
View file @
89914697
...
...
@@ -174,9 +174,12 @@ module AnnotateModels
# then pas it to the associated block
def
do_annotations
(
options
=
{})
header
=
PREFIX
.
dup
version
=
ActiveRecord
::
Migrator
.
current_version
rescue
0
if
version
>
0
header
<<
"
\n
# Schema version:
#{
version
}
"
if
options
[
:include_version
]
version
=
ActiveRecord
::
Migrator
.
current_version
rescue
0
if
version
>
0
header
<<
"
\n
# Schema version:
#{
version
}
"
end
end
annotated
=
[]
...
...
@@ -189,7 +192,7 @@ module AnnotateModels
end
end
rescue
Exception
=>
e
puts
"Unable to annotate
#{
file
}
:
#{
e
.
message
}
"
puts
"Unable to annotate
#{
file
}
:
#{
e
.
message
}
(
#{
e
.
backtrace
.
first
}
)
"
end
end
if
annotated
.
empty?
...
...
lib/tasks/annotate.rake
View file @
89914697
...
...
@@ -4,6 +4,7 @@ task :annotate_models => :environment do
options
=
{}
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
options
[
:include_version
]
=
ENV
[
'include_version'
]
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