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
bb4a37e2
Commit
bb4a37e2
authored
Dec 25, 2008
by
Marcos Augusto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More lil fixes
Adds compat mode for annotate plugin version Tim Charper binary write mode back Updates history
parent
0c3673a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
History.txt
History.txt
+12
-0
annotate.rb
lib/annotate.rb
+1
-1
annotate_models.rb
lib/annotate_models/annotate_models.rb
+6
-4
No files found.
History.txt
View file @
bb4a37e2
...
@@ -13,3 +13,15 @@
...
@@ -13,3 +13,15 @@
* More intuitive info messages
* More intuitive info messages
* Update README file with update-to-date example
* Update README file with update-to-date example
== 2.0.0 2008-12-25
* Add annotate_models plugin fork additions
* Annotates Rspec and Test Unit models
* Annotates Object Daddy exemplars
* Annotates geometrical columns
* Add AnnotateRoutes rake task
* Up gem structure to newgem defaults
lib/annotate.rb
View file @
bb4a37e2
...
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
...
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
$:
.
include?
(
File
.
dirname
(
__FILE__
))
||
$:
.
include?
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)))
$:
.
include?
(
File
.
dirname
(
__FILE__
))
||
$:
.
include?
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)))
module
Annotate
module
Annotate
VERSION
=
'2.1.
0
'
VERSION
=
'2.1.
1
'
end
end
...
...
lib/annotate_models/annotate_models.rb
View file @
bb4a37e2
...
@@ -7,6 +7,7 @@ module AnnotateModels
...
@@ -7,6 +7,7 @@ module AnnotateModels
# Object Daddy http://github.com/flogic/object_daddy/tree/master
# Object Daddy http://github.com/flogic/object_daddy/tree/master
EXEMPLARS_DIR
=
File
.
join
(
RAILS_ROOT
,
"spec/exemplars"
)
EXEMPLARS_DIR
=
File
.
join
(
RAILS_ROOT
,
"spec/exemplars"
)
PREFIX
=
"== Schema Information"
PREFIX
=
"== Schema Information"
# Annotate Models as plugin use this header
COMPAT_PREFIX
=
"== Schema Info"
COMPAT_PREFIX
=
"== Schema Info"
# Simple quoting for the default column value
# Simple quoting for the default column value
...
@@ -44,7 +45,9 @@ module AnnotateModels
...
@@ -44,7 +45,9 @@ module AnnotateModels
else
else
col_type
<<
"(
#{
col
.
limit
}
)"
if
col
.
limit
col_type
<<
"(
#{
col
.
limit
}
)"
if
col
.
limit
end
end
# Check out if we got a geometric column
# and print the type and SRID
if
col
.
respond_to?
(
:geometry_type
)
if
col
.
respond_to?
(
:geometry_type
)
attrs
<<
"
#{
col
.
geometry_type
}
,
#{
col
.
srid
}
"
attrs
<<
"
#{
col
.
geometry_type
}
,
#{
col
.
srid
}
"
end
end
...
@@ -85,7 +88,7 @@ module AnnotateModels
...
@@ -85,7 +88,7 @@ module AnnotateModels
# Write it back
# Write it back
new_content
=
options
[
:position
]
==
"before"
?
(
info_block
+
old_content
)
:
(
old_content
+
"
\n
"
+
info_block
)
new_content
=
options
[
:position
]
==
"before"
?
(
info_block
+
old_content
)
:
(
old_content
+
"
\n
"
+
info_block
)
File
.
open
(
file_name
,
"w"
)
{
|
f
|
f
.
puts
new_content
}
File
.
open
(
file_name
,
"w
b
"
)
{
|
f
|
f
.
puts
new_content
}
true
true
end
end
end
end
...
@@ -97,7 +100,7 @@ module AnnotateModels
...
@@ -97,7 +100,7 @@ module AnnotateModels
content
.
sub!
(
/^#
#{
COMPAT_PREFIX
}
.*?\n(#.*\n)*\n/
,
''
)
content
.
sub!
(
/^#
#{
COMPAT_PREFIX
}
.*?\n(#.*\n)*\n/
,
''
)
File
.
open
(
file_name
,
"w"
)
{
|
f
|
f
.
puts
content
}
File
.
open
(
file_name
,
"w
b
"
)
{
|
f
|
f
.
puts
content
}
end
end
end
end
...
@@ -124,7 +127,6 @@ module AnnotateModels
...
@@ -124,7 +127,6 @@ module AnnotateModels
File
.
join
(
EXEMPLARS_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
File
.
join
(
EXEMPLARS_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
].
each
{
|
file
|
annotate_one_file
(
file
,
info
)
}
].
each
{
|
file
|
annotate_one_file
(
file
,
info
)
}
FIXTURE_DIRS
.
each
do
|
dir
|
FIXTURE_DIRS
.
each
do
|
dir
|
fixture_file_name
=
File
.
join
(
dir
,
klass
.
table_name
+
".yml"
)
fixture_file_name
=
File
.
join
(
dir
,
klass
.
table_name
+
".yml"
)
annotate_one_file
(
fixture_file_name
,
info
,
options
.
merge
(
:position
=>
(
options
[
:position_in_fixture
]
||
options
[
:position
])))
if
File
.
exist?
(
fixture_file_name
)
annotate_one_file
(
fixture_file_name
,
info
,
options
.
merge
(
:position
=>
(
options
[
:position_in_fixture
]
||
options
[
:position
])))
if
File
.
exist?
(
fixture_file_name
)
...
...
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