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
aae82380
Commit
aae82380
authored
Feb 27, 2012
by
pinny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor out active_record monkey patch to permit extending without side effects
parent
a43c08f0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
10 deletions
+14
-10
annotate.gemspec
annotate.gemspec
+1
-0
active_record_patch.rb
lib/annotate/active_record_patch.rb
+10
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+0
-10
annotate_models.rake
lib/tasks/annotate_models.rake
+2
-0
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+1
-0
No files found.
annotate.gemspec
View file @
aae82380
...
...
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
"annotate.gemspec"
,
"bin/annotate"
,
"lib/annotate.rb"
,
"lib/annotate/active_record_patch.rb"
,
"lib/annotate/annotate_models.rb"
,
"lib/annotate/annotate_routes.rb"
,
"lib/tasks/annotate_models.rake"
,
...
...
lib/annotate/active_record_patch.rb
0 → 100644
View file @
aae82380
# monkey patches
module
::
ActiveRecord
class
Base
def
self
.
method_missing
(
name
,
*
args
)
# ignore this, so unknown/unloaded macros won't cause parsing to fail
end
end
end
\ No newline at end of file
lib/annotate/annotate_models.rb
View file @
aae82380
...
...
@@ -353,13 +353,3 @@ module AnnotateModels
end
end
end
# monkey patches
module
::
ActiveRecord
class
Base
def
self
.
method_missing
(
name
,
*
args
)
# ignore this, so unknown/unloaded macros won't cause parsing to fail
end
end
end
lib/tasks/annotate_models.rake
View file @
aae82380
desc
"Add schema information (as comments) to model and fixture files"
task
:annotate_models
=>
:environment
do
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'annotate_models'
))
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'active_record_patch'
))
true_re
=
/(true|t|yes|y|1)$/i
...
...
@@ -20,6 +21,7 @@ end
desc
"Remove schema information from model and fixture files"
task
:remove_annotation
=>
:environment
do
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'annotate_models'
))
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'active_record_patch'
))
options
=
{}
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
AnnotateModels
.
remove_annotations
(
options
)
...
...
spec/annotate/annotate_models_spec.rb
View file @
aae82380
require
File
.
dirname
(
__FILE__
)
+
'/../spec_helper.rb'
require
'annotate/annotate_models'
require
'annotate/active_record_patch'
require
'rubygems'
require
'active_support'
...
...
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