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
be794769
Commit
be794769
authored
Feb 16, 2011
by
Brent Greeff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using railtie to load rake tasks under Rails 3, this is not workiing as a gem anymore?
parent
6d11436b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
14 deletions
+19
-14
annotate.rb
lib/annotate.rb
+3
-11
railtie.rb
lib/annotate/railtie.rb
+13
-0
annotate_models.rake
lib/tasks/annotate_models.rake
+2
-2
annotate_routes.rake
lib/tasks/annotate_routes.rake
+1
-1
No files found.
lib/annotate.rb
View file @
be794769
$:
.
unshift
(
File
.
dirname
(
__FILE__
))
unless
$:
.
include?
(
File
.
dirname
(
__FILE__
))
||
$:
.
include?
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)))
#
$:.unshift(File.dirname(__FILE__)) unless
#
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
module
Annotate
def
self
.
load_tasks
if
File
.
exists?
(
'Rakefile'
)
load
'Rakefile'
Dir
[
File
.
join
(
File
.
dirname
(
__FILE__
),
'tasks'
,
'**/*.rake'
)].
each
{
|
rake
|
load
rake
}
return
true
else
return
false
end
end
require
'annotate/railtie'
if
defined?
(
Rails
)
end
lib/annotate/railtie.rb
0 → 100644
View file @
be794769
require
'annotate'
require
'rails'
module
Annotate
class
Railtie
<
Rails
::
Railtie
railtie_name
:annotate
rake_tasks
do
load
"lib/tasks/annotate_models.rake"
load
"lib/tasks/annotate_old.rake"
end
end
end
lib/tasks/annotate_models.rake
View file @
be794769
desc
"Add schema information (as comments) to model and fixture files"
task
:annotate_models
=>
:environment
do
require
'annotate/annotate_models'
require
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'annotate_models'
))
options
=
{}
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
||
:before
...
...
@@ -14,7 +14,7 @@ end
desc
"Remove schema information from model and fixture files"
task
:remove_annotation
=>
:environment
do
require
'annotate/annotate_models'
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'annotate_models'
))
options
=
{}
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
AnnotateModels
.
remove_annotations
(
options
)
...
...
lib/tasks/annotate_routes.rake
View file @
be794769
desc
"Prepends the route map to the top of routes.rb"
task
:annotate_routes
do
require
'annotate/annotate_routes'
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'annotate'
,
'annotate_routes'
))
AnnotateRoutes
.
do_annotate
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