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
24e3e743
Commit
24e3e743
authored
Dec 20, 2011
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #65 from ijcd/options-parsing
Options parsing should dig booleans from ENV
parents
02def679
b72dc16d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+2
-2
annotate_models.rake
lib/tasks/annotate_models.rake
+8
-3
No files found.
lib/annotate/annotate_models.rb
View file @
24e3e743
...
@@ -182,7 +182,7 @@ module AnnotateModels
...
@@ -182,7 +182,7 @@ module AnnotateModels
annotated
=
true
annotated
=
true
end
end
unless
ENV
[
'exclude_tests'
]
unless
options
[
:exclude_tests
]
[
[
File
.
join
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
File
.
join
(
UNIT_TEST_DIR
,
"
#{
model_name
}
_test.rb"
),
# test
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
File
.
join
(
SPEC_MODEL_DIR
,
"
#{
model_name
}
_spec.rb"
),
# spec
...
@@ -194,7 +194,7 @@ module AnnotateModels
...
@@ -194,7 +194,7 @@ module AnnotateModels
end
end
end
end
unless
ENV
[
'exclude_fixtures'
]
unless
options
[
:exclude_fixtures
]
[
[
File
.
join
(
EXEMPLARS_TEST_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
File
.
join
(
EXEMPLARS_TEST_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
File
.
join
(
EXEMPLARS_SPEC_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
File
.
join
(
EXEMPLARS_SPEC_DIR
,
"
#{
model_name
}
_exemplar.rb"
),
# Object Daddy
...
...
lib/tasks/annotate_models.rake
View file @
24e3e743
desc
"Add schema information (as comments) to model and fixture files"
desc
"Add schema information (as comments) to model and fixture files"
task
:annotate_models
=>
:environment
do
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'
,
'annotate_models'
))
true_re
=
/(true|t|yes|y|1)$/i
options
=
{}
options
=
{}
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_class
]
=
ENV
[
'position_in_class'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
||
:before
options
[
:position_in_fixture
]
=
ENV
[
'position_in_fixture'
]
||
ENV
[
'position'
]
||
:before
options
[
:show_indexes
]
=
ENV
[
'show_indexes'
]
options
[
:show_indexes
]
=
ENV
[
'show_indexes'
]
=~
true_re
options
[
:simple_indexes
]
=
ENV
[
'simple_indexes'
]
options
[
:simple_indexes
]
=
ENV
[
'simple_indexes'
]
=~
true_re
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
options
[
:model_dir
]
=
ENV
[
'model_dir'
]
options
[
:include_version
]
=
ENV
[
'include_version'
]
options
[
:include_version
]
=
ENV
[
'include_version'
]
=~
true_re
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
options
[
:require
]
=
ENV
[
'require'
]
?
ENV
[
'require'
].
split
(
','
)
:
[]
options
[
:exclude_tests
]
=
ENV
[
'exclude_tests'
]
=~
true_re
options
[
:exclude_fixtures
]
=
ENV
[
'exclude_fixtures'
]
=~
true_re
AnnotateModels
.
do_annotations
(
options
)
AnnotateModels
.
do_annotations
(
options
)
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