Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
366f0945
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
366f0945
编写于
12月 29, 2016
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #26443 from y-yagi/clear_all_environments_log_by_default
clear all environments log files by default
上级
fcec126e
eb6a6141
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
2 deletion
+43
-2
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/tasks/log.rake
railties/lib/rails/tasks/log.rake
+6
-2
railties/test/application/rake/log_test.rb
railties/test/application/rake/log_test.rb
+33
-0
未找到文件。
railties/CHANGELOG.md
浏览文件 @
366f0945
*
The
`log:clear`
task clear all environments log files by default.
*Yuji Yaginuma*
*
Add Webpack support in new apps via the --webpack option, which will delegate to the rails/webpacker gem.
To generate a new app that has Webpack dependencies configured and binstubs for webpack and webpack-watcher:
...
...
railties/lib/rails/tasks/log.rake
浏览文件 @
366f0945
...
...
@@ -3,7 +3,7 @@ namespace :log do
##
# Truncates all/specified log files
# ENV['LOGS']
# - defaults to
standard environment
log files i.e. 'development,test,production'
# - defaults to
all environments
log files i.e. 'development,test,production'
# - ENV['LOGS']=all truncates all files i.e. log/*.log
# - ENV['LOGS']='test,development' truncates only specified files
desc
"Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)"
...
...
@@ -19,7 +19,7 @@ namespace :log do
elsif
ENV
[
"LOGS"
]
log_files_to_truncate
(
ENV
[
"LOGS"
])
else
log_files_to_truncate
(
"development,test,production"
)
log_files_to_truncate
(
all_environments
.
join
(
","
)
)
end
end
...
...
@@ -33,4 +33,8 @@ namespace :log do
f
=
File
.
open
(
file
,
"w"
)
f
.
close
end
def
all_environments
Dir
[
"config/environments/*.rb"
].
map
{
|
fname
|
File
.
basename
(
fname
,
".*"
)
}
end
end
railties/test/application/rake/log_test.rb
0 → 100644
浏览文件 @
366f0945
require
"isolation/abstract_unit"
module
ApplicationTests
module
RakeTests
class
LogTest
<
ActiveSupport
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
end
def
teardown
teardown_app
end
test
"log:clear clear all environments log files by default"
do
Dir
.
chdir
(
app_path
)
do
File
.
open
(
"config/environments/staging.rb"
,
"w"
)
File
.
write
(
"log/staging.log"
,
"staging"
)
File
.
write
(
"log/test.log"
,
"test"
)
File
.
write
(
"log/dummy.log"
,
"dummy"
)
`rails log:clear`
assert_equal
0
,
File
.
size
(
"log/test.log"
)
assert_equal
0
,
File
.
size
(
"log/staging.log"
)
assert_equal
5
,
File
.
size
(
"log/dummy.log"
)
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录