Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
ce38a6b8
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce38a6b8
编写于
3月 16, 2014
作者:
R
robertomiranda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Shadowing extensions variable in Register Annotation Exentsions
上级
f43421cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
7 deletion
+7
-7
railties/lib/rails/source_annotation_extractor.rb
railties/lib/rails/source_annotation_extractor.rb
+2
-2
railties/test/application/rake/notes_test.rb
railties/test/application/rake/notes_test.rb
+5
-5
未找到文件。
railties/lib/rails/source_annotation_extractor.rb
浏览文件 @
ce38a6b8
...
...
@@ -24,8 +24,8 @@ def self.extensions
# Registers new Annotations File Extensions
# SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
def
self
.
register_extensions
(
*
ext
ension
s
,
&
block
)
self
.
extensions
[
/\.(
#{
extension
s
.
join
(
"|"
)
}
)$/
]
=
block
def
self
.
register_extensions
(
*
exts
,
&
block
)
extensions
[
/\.(
#{
ext
s
.
join
(
"|"
)
}
)$/
]
=
block
end
register_extensions
(
"builder"
,
"rb"
,
"rake"
,
"yml"
,
"yaml"
,
"ruby"
)
{
|
tag
|
/#\s*(
#{
tag
}
):?\s*(.*)$/
}
...
...
railties/test/application/rake/notes_test.rb
浏览文件 @
ce38a6b8
...
...
@@ -25,7 +25,7 @@ def teardown
app_file
"lib/tasks/task.rake"
,
"# TODO: note in rake"
app_file
'app/views/home/index.html.builder'
,
'# TODO: note in builder'
app_file
'config/locales/en.yml'
,
'# TODO: note in yml'
app_file
'config/locales/en.yaml'
,
'# TODO: note in yml'
app_file
'config/locales/en.yaml'
,
'# TODO: note in y
a
ml'
app_file
"app/views/home/index.ruby"
,
"# TODO: note in ruby"
boot_rails
...
...
@@ -40,13 +40,13 @@ def teardown
lines
=
output
.
scan
(
/\[([0-9\s]+)\](\s)/
)
assert_match
(
/note in erb/
,
output
)
assert_match
(
/note in ruby/
,
output
)
assert_match
(
/note in js/
,
output
)
assert_match
(
/note in css/
,
output
)
assert_match
(
/note in rake/
,
output
)
assert_match
(
/note in builder/
,
output
)
assert_match
(
/note in yml/
,
output
)
assert_match
(
/note in yaml/
,
output
)
assert_match
(
/note in ruby/
,
output
)
assert_equal
9
,
lines
.
size
...
...
@@ -170,9 +170,9 @@ def teardown
end
test
'register a new extension'
do
SourceAnnotationExtractor
::
Annotation
.
register_extensions
(
"
.test1"
,
".test2"
)
{
|
tag
|
/
#{
tag
}
/
}
assert
SourceAnnotationExtractor
::
Annotation
.
extensions
[
/(\.test1|\.test2)
/
]
assert_
blank
SourceAnnotationExtractor
::
Annotation
.
extensions
[
/(\.haml)
/
]
SourceAnnotationExtractor
::
Annotation
.
register_extensions
(
"
test1"
,
"test2"
)
{
|
tag
|
/
#{
tag
}
/
}
assert
_not_nil
SourceAnnotationExtractor
::
Annotation
.
extensions
[
/\.(test1|test2)$
/
]
assert_
nil
SourceAnnotationExtractor
::
Annotation
.
extensions
[
/\.(haml)$
/
]
end
private
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录