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
ed2cf5ec
Commit
ed2cf5ec
authored
Oct 23, 2009
by
Alex Chaffee
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'zapnap/master'
* zapnap/master: correct rake task name add auto-annotate magic for ActiveRecord migrations in Rails
parents
43d02fcf
86a7893a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
README.rdoc
README.rdoc
+5
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-1
migrate.rake
tasks/migrate.rake
+27
-0
No files found.
README.rdoc
View file @
ed2cf5ec
...
@@ -89,6 +89,11 @@ More options:
...
@@ -89,6 +89,11 @@ More options:
-R, --require path Additional files to require before loading models
-R, --require path Additional files to require before loading models
-e, --exclude [tests,fixtures] Do not annotate fixtures, test files, or both
-e, --exclude [tests,fixtures] Do not annotate fixtures, test files, or both
If you install annotate_models as a plugin, it will automatically
adjust your <tt>rake db:migrate</tt> tasks so that they update the
annotations in your model files for you once the migration is
completed.
== LICENSE:
== LICENSE:
Released under the same license as Ruby. No Support. No Warranty.
Released under the same license as Ruby. No Support. No Warranty.
...
...
lib/annotate/annotate_models.rb
View file @
ed2cf5ec
...
@@ -185,7 +185,7 @@ module AnnotateModels
...
@@ -185,7 +185,7 @@ module AnnotateModels
def
get_model_files
def
get_model_files
models
=
ARGV
.
dup
models
=
ARGV
.
dup
models
.
shift
models
.
shift
models
.
reject!
{
|
m
|
m
.
starts_with?
(
"position="
)}
models
.
reject!
{
|
m
|
m
.
match
(
/^(.*)=/
)}
if
models
.
empty?
if
models
.
empty?
begin
begin
Dir
.
chdir
(
model_dir
)
do
Dir
.
chdir
(
model_dir
)
do
...
...
tasks/migrate.rake
0 → 100644
View file @
ed2cf5ec
# append annotations to Rake tasks (for ActiveRecord)
namespace
:db
do
task
:migrate
do
Annotate
::
Migration
.
update_annotations
end
namespace
:migrate
do
[
:up
,
:down
,
:reset
,
:redo
].
each
do
|
t
|
task
t
do
Annotate
::
Migration
.
update_annotations
end
end
end
end
module
Annotate
class
Migration
@@working
=
false
def
self
.
update_annotations
unless
@@working
@@working
=
true
Rake
::
Task
[
'annotate_models'
].
invoke
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