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
0076e085
Commit
0076e085
authored
Jun 21, 2011
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31 from wbharding/master
Updates to make annotate smarter about when to touch a model
parents
8057b920
f0c138cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
annotate.gemspec
annotate.gemspec
+1
-1
annotate_models.rb
lib/annotate/annotate_models.rb
+5
-2
No files found.
annotate.gemspec
View file @
0076e085
...
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
...
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
authors
=
[
"Cuong Tran"
,
"Alex Chaffee"
,
"Marcos Piccinini"
]
s
.
authors
=
[
"Cuong Tran"
,
"Alex Chaffee"
,
"Marcos Piccinini"
]
s
.
date
=
%q{2009-10-23}
s
.
date
=
%q{2009-10-23}
s
.
default_executable
=
%q{annotate}
#
s.default_executable = %q{annotate}
s
.
description
=
%q{Annotates Rails Models, routes, fixtures, and others based on the database schema.}
s
.
description
=
%q{Annotates Rails Models, routes, fixtures, and others based on the database schema.}
s
.
email
=
[
"alex@stinky.com"
,
"ctran@pragmaquest.com"
,
"x@nofxx.com"
]
s
.
email
=
[
"alex@stinky.com"
,
"ctran@pragmaquest.com"
,
"x@nofxx.com"
]
s
.
executables
=
[
"annotate"
]
s
.
executables
=
[
"annotate"
]
...
...
lib/annotate/annotate_models.rb
View file @
0076e085
...
@@ -119,11 +119,14 @@ module AnnotateModels
...
@@ -119,11 +119,14 @@ module AnnotateModels
old_content
=
File
.
read
(
file_name
)
old_content
=
File
.
read
(
file_name
)
# Ignore the Schema version line because it changes with each migration
# Ignore the Schema version line because it changes with each migration
header
=
Regexp
.
new
(
/(^# Table name:.*?\n(#.*
\n)*
\n)/
)
header
=
Regexp
.
new
(
/(^# Table name:.*?\n(#.*
[\r]?\n)*[\r]?
\n)/
)
old_header
=
old_content
.
match
(
header
).
to_s
old_header
=
old_content
.
match
(
header
).
to_s
new_header
=
info_block
.
match
(
header
).
to_s
new_header
=
info_block
.
match
(
header
).
to_s
if
old_header
==
new_header
old_columns
=
old_header
&&
old_header
.
scan
(
/#[\t\s]+([\w\d]+)[\t\s]+\:([\d\w]+)/
).
sort
new_columns
=
new_header
&&
new_header
.
scan
(
/#[\t\s]+([\w\d]+)[\t\s]+\:([\d\w]+)/
).
sort
if
old_columns
==
new_columns
false
false
else
else
# Replace the old schema info with the new schema info
# Replace the old schema info with the new schema info
...
...
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