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
febb1fe4
Commit
febb1fe4
authored
Aug 13, 2010
by
Marcin Michalowski and Marcin Nowicki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant empty lines in models
parent
9c68c8c9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
Rakefile
Rakefile
+1
-0
annotate.gemspec
annotate.gemspec
+6
-6
annotate_models.rb
lib/annotate/annotate_models.rb
+3
-3
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+0
-1
No files found.
Rakefile
View file @
febb1fe4
require
'rubygems'
require
'rubygems'
require
'rake'
require
'rake'
require
'lib/annotate'
require
'lib/annotate'
require
'yaml'
# want other tests/tasks run by default? Add them to the list
# want other tests/tasks run by default? Add them to the list
task
:default
=>
[
:spec
]
task
:default
=>
[
:spec
]
...
...
annotate.gemspec
View file @
febb1fe4
...
@@ -4,15 +4,15 @@
...
@@ -4,15 +4,15 @@
# -*- encoding: utf-8 -*-
# -*- encoding: utf-8 -*-
Gem
::
Specification
.
new
do
|
s
|
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
%q{annotate}
s
.
name
=
%q{
doubledrones-
annotate}
s
.
version
=
"2.4.0"
s
.
version
=
"2.4.0
.1
"
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"
,
"Marcin Michałowski"
,
"Marcin Nowicki"
]
s
.
date
=
%q{20
09-10-2
3}
s
.
date
=
%q{20
10-08-1
3}
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"
,
"dev@doubledrones.com"
]
s
.
executables
=
[
"annotate"
]
s
.
executables
=
[
"annotate"
]
s
.
extra_rdoc_files
=
[
s
.
extra_rdoc_files
=
[
"README.rdoc"
"README.rdoc"
...
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
...
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
"spec/spec_helper.rb"
,
"spec/spec_helper.rb"
,
"tasks/migrate.rake"
"tasks/migrate.rake"
]
]
s
.
homepage
=
%q{http://github.com/
ctran/annotate
}
s
.
homepage
=
%q{http://github.com/
doubledrones/annotate_models
}
s
.
rdoc_options
=
[
"--charset=UTF-8"
]
s
.
rdoc_options
=
[
"--charset=UTF-8"
]
s
.
require_paths
=
[
"lib"
]
s
.
require_paths
=
[
"lib"
]
s
.
rubygems_version
=
%q{1.3.5}
s
.
rubygems_version
=
%q{1.3.5}
...
...
lib/annotate/annotate_models.rb
View file @
febb1fe4
...
@@ -84,7 +84,7 @@ module AnnotateModels
...
@@ -84,7 +84,7 @@ module AnnotateModels
info
<<
get_index_info
(
klass
)
info
<<
get_index_info
(
klass
)
end
end
info
<<
"#
\n
\n
"
info
<<
"#
\n
"
end
end
def
get_index_info
(
klass
)
def
get_index_info
(
klass
)
...
@@ -119,7 +119,7 @@ module AnnotateModels
...
@@ -119,7 +119,7 @@ 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(#.*\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
...
@@ -130,7 +130,7 @@ module AnnotateModels
...
@@ -130,7 +130,7 @@ module AnnotateModels
old_content
.
sub!
(
/^#
#{
COMPAT_PREFIX
}
.*?\n(#.*\n)*\n/
,
''
)
old_content
.
sub!
(
/^#
#{
COMPAT_PREFIX
}
.*?\n(#.*\n)*\n/
,
''
)
# 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
+
info_block
)
File
.
open
(
file_name
,
"wb"
)
{
|
f
|
f
.
puts
new_content
}
File
.
open
(
file_name
,
"wb"
)
{
|
f
|
f
.
puts
new_content
}
true
true
...
...
spec/annotate/annotate_models_spec.rb
View file @
febb1fe4
...
@@ -38,7 +38,6 @@ describe AnnotateModels do
...
@@ -38,7 +38,6 @@ describe AnnotateModels do
# id :integer not null, primary key
# id :integer not null, primary key
# id :integer not null, primary key
# id :integer not null, primary key
#
#
EOS
EOS
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