Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f42c7eee
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,发现更多精彩内容 >>
提交
f42c7eee
编写于
3月 22, 2014
作者:
D
Dmitrii Golub
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove sqlite3 lines from .gitignore if the application is not using sqlite3.
上级
2ca3f338
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
36 addition
and
2 deletion
+36
-2
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/generators/app_base.rb
railties/lib/rails/generators/app_base.rb
+4
-0
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+1
-1
railties/lib/rails/generators/rails/app/templates/gitignore
railties/lib/rails/generators/rails/app/templates/gitignore
+2
-0
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+25
-1
未找到文件。
railties/CHANGELOG.md
浏览文件 @
f42c7eee
*
Remove sqlite3 lines from
`.gitignore`
if the application is not using sqlite3.
*Dmitrii Golub*
*
Add public API to register new extensions for
`rake notes`
.
Example:
...
...
railties/lib/rails/generators/app_base.rb
浏览文件 @
f42c7eee
...
...
@@ -172,6 +172,10 @@ def comment_if(value)
options
[
value
]
?
'# '
:
''
end
def
sqlite3?
!
options
[
:skip_active_record
]
&&
options
[
:database
]
==
'sqlite3'
end
class
GemfileEntry
<
Struct
.
new
(
:name
,
:version
,
:comment
,
:options
,
:commented_out
)
def
initialize
(
name
,
version
,
comment
,
options
=
{},
commented_out
=
false
)
super
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
f42c7eee
...
...
@@ -50,7 +50,7 @@ def configru
end
def
gitignore
copy_fil
e
"gitignore"
,
".gitignore"
templat
e
"gitignore"
,
".gitignore"
end
def
app
...
...
railties/lib/rails/generators/rails/app/templates/gitignore
浏览文件 @
f42c7eee
...
...
@@ -7,10 +7,12 @@
# Ignore bundler config.
/.bundle
<% if sqlite3? -%>
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
<% end -%>
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
railties/test/generators/app_generator_test.rb
浏览文件 @
f42c7eee
...
...
@@ -408,7 +408,31 @@ def test_skip_spring
end
end
protected
def
test_gitignore_when_sqlite3
run_generator
assert_file
'.gitignore'
do
|
content
|
assert_match
(
/sqlite3/
,
content
)
end
end
def
test_gitignore_when_no_active_record
run_generator
[
destination_root
,
'--skip-active-record'
]
assert_file
'.gitignore'
do
|
content
|
assert_no_match
(
/sqlite3/
,
content
)
end
end
def
test_gitignore_when_non_sqlite3_db
run_generator
([
destination_root
,
"-d"
,
"mysql"
])
assert_file
'.gitignore'
do
|
content
|
assert_no_match
(
/sqlite3/
,
content
)
end
end
protected
def
action
(
*
args
,
&
block
)
silence
(
:stdout
)
{
generator
.
send
(
*
args
,
&
block
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录