Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6189086c
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,发现更多精彩内容 >>
提交
6189086c
编写于
7月 01, 2017
作者:
E
Eileen M. Uchitelle
提交者:
GitHub
7月 01, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #29534 from y-yagi/clear_screenshots_in_tmp_clear_task
Clear screenshots files in `tmp:clear` task
上级
678e23d3
6fbd405a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
57 addition
and
9 deletion
+57
-9
guides/source/command_line.md
guides/source/command_line.md
+8
-7
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/tasks/tmp.rake
railties/lib/rails/tasks/tmp.rake
+9
-2
railties/test/application/rake/tmp_test.rb
railties/test/application/rake/tmp_test.rb
+36
-0
未找到文件。
guides/source/command_line.md
浏览文件 @
6189086c
...
...
@@ -262,12 +262,12 @@ $ bin/rails db:migrate
==
CreateHighScores: migrated
(
0.0019s
)
======================================
```
INFO: Let's talk about unit tests. Unit tests are code that tests and makes assertions
about code. In unit testing, we take a little part of code, say a method of a model,
and test its inputs and outputs. Unit tests are your friend. The sooner you make
peace with the fact that your quality of life will drastically increase when you unit
test your code, the better. Seriously. Please visit
[
the testing guide
](
http://guides.rubyonrails.org/testing.html
)
for an in-depth
INFO: Let's talk about unit tests. Unit tests are code that tests and makes assertions
about code. In unit testing, we take a little part of code, say a method of a model,
and test its inputs and outputs. Unit tests are your friend. The sooner you make
peace with the fact that your quality of life will drastically increase when you unit
test your code, the better. Seriously. Please visit
[
the testing guide
](
http://guides.rubyonrails.org/testing.html
)
for an in-depth
look at unit testing.
Let's see the interface Rails created for us.
...
...
@@ -533,7 +533,8 @@ The `tmp:` namespaced tasks will help you clear and create the `Rails.root/tmp`
*
`rails tmp:cache:clear`
clears
`tmp/cache`
.
*
`rails tmp:sockets:clear`
clears
`tmp/sockets`
.
*
`rails tmp:clear`
clears all cache and sockets files.
*
`rails tmp:screenshots:clear`
clears
`tmp/screenshots`
.
*
`rails tmp:clear`
clears all cache, sockets and screenshot files.
*
`rails tmp:create`
creates tmp directories for cache, sockets and pids.
### Miscellaneous
...
...
railties/CHANGELOG.md
浏览文件 @
6189086c
*
Clear screenshot files in
`tmp:clear`
task.
*Yuji Yaginuma*
*
Add
`railtie.rb`
to the plugin generator
*Tsukuru Tanimichi*
...
...
railties/lib/rails/tasks/tmp.rake
浏览文件 @
6189086c
namespace
:tmp
do
desc
"Clear cache
and socket files from tmp/ (narrow w/ tmp:cache:clear, tmp:socke
ts:clear)"
task
clear:
[
"tmp:cache:clear"
,
"tmp:sockets:clear"
]
desc
"Clear cache
, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screensho
ts:clear)"
task
clear:
[
"tmp:cache:clear"
,
"tmp:sockets:clear"
,
"tmp:screenshots:clear"
]
tmp_dirs
=
[
"tmp/cache"
,
"tmp/sockets"
,
...
...
@@ -32,4 +32,11 @@ namespace :tmp do
rm
Dir
[
"tmp/pids/[^.]*"
],
verbose:
false
end
end
namespace
:screenshots
do
# desc "Clears all files in tmp/screenshots"
task
:clear
do
rm
Dir
[
"tmp/screenshots/[^.]*"
],
verbose:
false
end
end
end
railties/test/application/rake/tmp_test.rb
0 → 100644
浏览文件 @
6189086c
require
"isolation/abstract_unit"
module
ApplicationTests
module
RakeTests
class
TmpTest
<
ActiveSupport
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
end
def
teardown
teardown_app
end
test
"tmp:clear clear cache, socket and screenshot files"
do
Dir
.
chdir
(
app_path
)
do
FileUtils
.
mkdir_p
(
"tmp/cache"
)
FileUtils
.
touch
(
"tmp/cache/cache_file"
)
FileUtils
.
mkdir_p
(
"tmp/sockets"
)
FileUtils
.
touch
(
"tmp/sockets/socket_file"
)
FileUtils
.
mkdir_p
(
"tmp/screenshots"
)
FileUtils
.
touch
(
"tmp/screenshots/fail.png"
)
`rails tmp:clear`
assert_not
File
.
exist?
(
"tmp/cache/cache_file"
)
assert_not
File
.
exist?
(
"tmp/sockets/socket_file"
)
assert_not
File
.
exist?
(
"tmp/screenshots/fail.png"
)
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录