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
6ac41da4
Commit
6ac41da4
authored
Jun 20, 2010
by
fistfvck
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'rwilcox/master' into restart
Conflicts: lib/annotate/annotate_models.rb spec/annotate/annotate_models_spec.rb
parents
35c6dd44
c03ba451
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
5 deletions
+50
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-4
annotate.rake
lib/tasks/annotate.rake
+31
-0
migrate.rake
tasks/migrate.rake
+18
-1
No files found.
lib/annotate/annotate_models.rb
View file @
6ac41da4
...
...
@@ -292,10 +292,7 @@ module AnnotateModels
end
end
rescue
Exception
=>
e
puts
"Unable to annotate
#{
file
}
:
#{
e
.
inspect
}
"
puts
""
# todo: check if all backtrace lines are in "gems" -- if so, it's an annotate bug, so print the whole stack trace.
# puts e.backtrace.join("\n\t")
puts
"Unable to annotate
#{
file
}
:
#{
e
.
message
}
(
#{
e
.
backtrace
.
first
}
)"
end
end
if
annotated
.
empty?
...
...
lib/tasks/annotate.rake
0 → 100644
View file @
6ac41da4
def
is_plugin?
(
defined?
ANNOTATE_MODELS_PREFS
::
USE_PLUGIN
)
&&
(
!
ANNOTATE_MODELS_PREFS
::
USE_PLUGIN
.
nil?
)
?
ANNOTATE_MODELS_PREFS
::
USE_PLUGIN
:
false
end
desc
"Add schema information (as comments) to model and fixture files"
task
:annotate_models
=>
:environment
do
if
is_plugin?
require
File
.
expand_path
(
File
.
dirname
(
__FILE__
)
+
'/../annotate/annotate_models'
)
else
require
'annotate_models'
end
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
desc
"Remove schema information from model and fixture files"
task
:remove_annotation
=>
:environment
do
if
is_plugin?
require
File
.
expand_path
(
File
.
dirname
(
__FILE__
)
+
'/../annotate/annotate_models'
)
else
require
'annotate_models'
end
AnnotateModels
.
remove_annotations
end
\ No newline at end of file
tasks/migrate.rake
View file @
6ac41da4
...
...
@@ -5,15 +5,32 @@
# run after doing db:migrate.
# Unfortunately it relies on ENV for options; it'd be nice to be able to set options
# in a per-project config file so this task can read them.
def
run_annotate_models?
update_on_migrate
=
true
(
defined?
ANNOTATE_MODELS_PREFS
::
UPDATE_ON_MIGRATE
)
&&
(
!
ANNOTATE_MODELS_PREFS
::
UPDATE_ON_MIGRATE
.
nil?
)
?
ANNOTATE_MODELS_PREFS
::
UPDATE_ON_MIGRATE
:
true
end
namespace
:db
do
task
:migrate
do
if
run_annotate_models?
Annotate
::
Migration
.
update_annotations
end
end
task
:update
=>
[
:migrate
]
do
Annotate
::
Migration
.
update_annotations
end
namespace
:migrate
do
[
:up
,
:down
,
:reset
,
:redo
].
each
do
|
t
|
task
t
do
Annotate
::
Migration
.
update_annotations
if
run_annotate_models?
Annotate
::
Migration
.
update_annotations
end
end
end
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