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
f1cae617
Commit
f1cae617
authored
Sep 06, 2018
by
Jeremy Mickelson
Committed by
Cuong Tran
Sep 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure and use wrappers, even if --force isn't used (#571)
parent
37adad4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
annotate_models.rb
lib/annotate/annotate_models.rb
+7
-6
No files found.
lib/annotate/annotate_models.rb
View file @
f1cae617
...
...
@@ -517,15 +517,16 @@ module AnnotateModels
return
false
else
# Replace inline the old schema info with the new schema info
new_content
=
old_content
.
sub
(
annotate_pattern
(
options
),
info_block
+
"
\n
"
)
if
new_content
.
end_with?
(
info_block
+
"
\n
"
)
new_content
=
old_content
.
sub
(
annotate_pattern
(
options
),
"
\n
"
+
info_block
)
end
wrapper_open
=
options
[
:wrapper_open
]
?
"#
#{
options
[
:wrapper_open
]
}
\n
"
:
""
wrapper_close
=
options
[
:wrapper_close
]
?
"#
#{
options
[
:wrapper_close
]
}
\n
"
:
""
wrapped_info_block
=
"
#{
wrapper_open
}#{
info_block
}#{
wrapper_close
}
"
new_content
=
old_content
.
sub
(
annotate_pattern
(
options
),
wrapped_info_block
+
"
\n
"
)
if
new_content
.
end_with?
(
wrapped_info_block
+
"
\n
"
)
new_content
=
old_content
.
sub
(
annotate_pattern
(
options
),
"
\n
"
+
wrapped_info_block
)
end
# if there *was* no old schema info (no substitution happened) or :force was passed,
# we simply need to insert it in correct position
if
new_content
==
old_content
||
options
[
:force
]
...
...
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