Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
d7cbdbef
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,发现更多精彩内容 >>
提交
d7cbdbef
编写于
5月 30, 2015
作者:
G
Godfrey Chan
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20370 from manishspuri/master
Add tmp directory before touching
上级
109e71d2
0cb327c5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
56 addition
and
4 deletion
+56
-4
railties/CHANGELOG.md
railties/CHANGELOG.md
+7
-0
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+1
-0
railties/lib/rails/generators/rails/app/templates/bin/setup
railties/lib/rails/generators/rails/app/templates/bin/setup
+1
-1
railties/lib/rails/generators/rails/app/templates/gitignore
railties/lib/rails/generators/rails/app/templates/gitignore
+2
-1
railties/lib/rails/tasks/restart.rake
railties/lib/rails/tasks/restart.rake
+1
-0
railties/test/application/rake/restart_test.rb
railties/test/application/rake/restart_test.rb
+10
-2
railties/test/application/rake_test.rb
railties/test/application/rake_test.rb
+7
-0
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+27
-0
未找到文件。
railties/CHANGELOG.md
浏览文件 @
d7cbdbef
*
Generator a
`.keep`
file in the
`tmp`
folder by default as many scripts
assume the existence of this folder and most would fail if it is absent.
See #20299.
*Yoong Kang Lim*, *Sunny Juneja*
*
`config.static_index`
configures directory
`index.html`
filename
*
`config.static_index`
configures directory
`index.html`
filename
Set `config.static_index` to serve a static directory index file not named
Set `config.static_index` to serve a static directory index file not named
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
d7cbdbef
...
@@ -141,6 +141,7 @@ def test
...
@@ -141,6 +141,7 @@ def test
end
end
def
tmp
def
tmp
empty_directory_with_keep_file
"tmp"
empty_directory
"tmp/cache"
empty_directory
"tmp/cache"
empty_directory
"tmp/cache/assets"
empty_directory
"tmp/cache/assets"
end
end
...
...
railties/lib/rails/generators/rails/app/templates/bin/setup
浏览文件 @
d7cbdbef
...
@@ -25,5 +25,5 @@ chdir APP_ROOT do
...
@@ -25,5 +25,5 @@ chdir APP_ROOT do
system 'ruby bin/rake log:clear tmp:clear'
system 'ruby bin/rake log:clear tmp:clear'
puts "\n== Restarting application server =="
puts "\n== Restarting application server =="
touch 'tmp/restart.tx
t'
system 'ruby bin/rake restar
t'
end
end
railties/lib/rails/generators/rails/app/templates/gitignore
浏览文件 @
d7cbdbef
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
<% end -%>
<% end -%>
# Ignore all logfiles and tempfiles.
# Ignore all logfiles and tempfiles.
/log/*
/log/*
/tmp/*
<% if keeps? -%>
<% if keeps? -%>
!/log/.keep
!/log/.keep
!/tmp/.keep
<% end -%>
<% end -%>
/tmp
railties/lib/rails/tasks/restart.rake
浏览文件 @
d7cbdbef
desc
"Restart app by touching tmp/restart.txt"
desc
"Restart app by touching tmp/restart.txt"
task
:restart
do
task
:restart
do
FileUtils
.
mkdir_p
(
'tmp'
)
FileUtils
.
touch
(
'tmp/restart.txt'
)
FileUtils
.
touch
(
'tmp/restart.txt'
)
end
end
railties/test/application/rake/restart_test.rb
浏览文件 @
d7cbdbef
...
@@ -13,12 +13,12 @@ def setup
...
@@ -13,12 +13,12 @@ def setup
def
teardown
def
teardown
teardown_app
teardown_app
end
end
test
'rake restart touches tmp/restart.txt'
do
test
'rake restart touches tmp/restart.txt'
do
Dir
.
chdir
(
app_path
)
do
Dir
.
chdir
(
app_path
)
do
`rake restart`
`rake restart`
assert
File
.
exist?
(
"tmp/restart.txt"
)
assert
File
.
exist?
(
"tmp/restart.txt"
)
prev_mtime
=
File
.
mtime
(
"tmp/restart.txt"
)
prev_mtime
=
File
.
mtime
(
"tmp/restart.txt"
)
sleep
(
1
)
sleep
(
1
)
`rake restart`
`rake restart`
...
@@ -26,6 +26,14 @@ def teardown
...
@@ -26,6 +26,14 @@ def teardown
assert_not_equal
prev_mtime
,
curr_mtime
assert_not_equal
prev_mtime
,
curr_mtime
end
end
end
end
test
'rake restart should work even if tmp folder does not exist'
do
Dir
.
chdir
(
app_path
)
do
FileUtils
.
remove_dir
(
'tmp'
)
`rake restart`
assert
File
.
exist?
(
'tmp/restart.txt'
)
end
end
end
end
end
end
end
end
railties/test/application/rake_test.rb
浏览文件 @
d7cbdbef
...
@@ -285,5 +285,12 @@ def test_template_load_initializers
...
@@ -285,5 +285,12 @@ def test_template_load_initializers
assert_match
(
/Hello, World!/
,
output
)
assert_match
(
/Hello, World!/
,
output
)
end
end
def
test_tmp_clear_should_work_if_folder_missing
FileUtils
.
remove_dir
(
"
#{
app_path
}
/tmp"
)
errormsg
=
Dir
.
chdir
(
app_path
)
{
`bundle exec rake tmp:clear`
}
assert_predicate
$?
,
:success?
assert_empty
errormsg
end
end
end
end
end
railties/test/generators/app_generator_test.rb
浏览文件 @
d7cbdbef
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
vendor/assets
vendor/assets
vendor/assets/stylesheets
vendor/assets/stylesheets
vendor/assets/javascripts
vendor/assets/javascripts
tmp
tmp/cache
tmp/cache
tmp/cache/assets
tmp/cache/assets
)
)
...
@@ -606,6 +607,32 @@ def test_gitignore_when_non_sqlite3_db
...
@@ -606,6 +607,32 @@ def test_gitignore_when_non_sqlite3_db
end
end
end
end
def
test_create_keeps
run_generator
folders_with_keep
=
%w(
app/assets/images
app/mailers
app/models
app/controllers/concerns
app/models/concerns
lib/tasks
lib/assets
log
test/fixtures
test/fixtures/files
test/controllers
test/mailers
test/models
test/helpers
test/integration
tmp
vendor/assets/stylesheets
)
folders_with_keep
.
each
do
|
folder
|
assert_file
(
"
#{
folder
}
/.keep"
)
end
end
def
test_psych_gem
def
test_psych_gem
run_generator
run_generator
gem_regex
=
/gem 'psych',\s+'~> 2.0',\s+platforms: :rbx/
gem_regex
=
/gem 'psych',\s+'~> 2.0',\s+platforms: :rbx/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录