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
a43c08f0
Commit
a43c08f0
authored
Jan 28, 2012
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69 from davidxia/master
Annotation position defaulted to 'before'. Bugfix: annotate_models.rake uses string instead of symbol.
parents
03256565
449bd7f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+3
-3
annotate_models.rake
lib/tasks/annotate_models.rake
+2
-2
No files found.
lib/annotate/annotate_models.rb
View file @
a43c08f0
...
...
@@ -145,9 +145,9 @@ module AnnotateModels
# But, if there *was* no old schema info, we simply need to insert it
if
new_content
==
old_content
old_content
.
sub!
(
encoding
,
''
)
new_content
=
options
[
:position
]
==
'
before
'
?
(
encoding_header
+
info_block
+
old_content
)
:
(
encoding_header
+
(
old_content
=~
/\n$/
?
old_content
:
old_content
+
'\n'
)
+
info_block
)
new_content
=
options
[
:position
]
==
'
after
'
?
(
encoding_header
+
(
old_content
=~
/\n$/
?
old_content
:
old_content
+
'\n'
)
+
info_block
)
:
(
encoding_header
+
info_block
+
old_content
)
end
File
.
open
(
file_name
,
"wb"
)
{
|
f
|
f
.
puts
new_content
}
...
...
lib/tasks/annotate_models.rake
View file @
a43c08f0
...
...
@@ -5,8 +5,8 @@ task :annotate_models => :environment do
true_re
=
/(true|t|yes|y|1)$/i
options
=
{}
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
||
'before'
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
||
'before'
options
[
:show_indexes
]
=
ENV
[
'show_indexes'
]
=~
true_re
options
[
:simple_indexes
]
=
ENV
[
'simple_indexes'
]
=~
true_re
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
...
...
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