提交 6fc83f8e 编写于 作者: Y Yoong Kang Lim 提交者: Godfrey Chan

`rake restart` should work without a `tmp` folder

In restart.rake, the creation of tmp/restart.txt
would fail if the tmp folder does not exist in the
app. This is a problem because apps cloned using
git would not have the tmp folder, as the folder is
in .gitignore. This commit creates the tmp folder
if it does not exist.

Fixes #20299

[Yoong Kang Lim, Sunny Juneja]
上级 109e71d2
......@@ -25,5 +25,5 @@ chdir APP_ROOT do
system 'ruby bin/rake log:clear tmp:clear'
puts "\n== Restarting application server =="
touch 'tmp/restart.txt'
system 'ruby bin/rake restart'
end
desc "Restart app by touching tmp/restart.txt"
task :restart do
FileUtils.mkdir_p('tmp')
FileUtils.touch('tmp/restart.txt')
end
......@@ -13,12 +13,12 @@ def setup
def teardown
teardown_app
end
test 'rake restart touches tmp/restart.txt' do
Dir.chdir(app_path) do
`rake restart`
assert File.exist?("tmp/restart.txt")
prev_mtime = File.mtime("tmp/restart.txt")
sleep(1)
`rake restart`
......@@ -26,6 +26,14 @@ def teardown
assert_not_equal prev_mtime, curr_mtime
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册