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

Generate a `.keep` file in `tmp` folder

A lot of scripts assumes the existence of this folder and most would fail if it
is absent.

One example of this is `rake restart` (before the previous commit) – it tries to
`touch tmp/restart.txt`, which would fail if `tmp` does not exist, which was the
case for a freshly-cloned project as `tmp` is `.gitignored` by default.

See #20299.

[Yoong Kang Lim, Sunny Juneja]
上级 6fc83f8e
* 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
Set `config.static_index` to serve a static directory index file not named
......
......@@ -141,6 +141,7 @@ def test
end
def tmp
empty_directory_with_keep_file "tmp"
empty_directory "tmp/cache"
empty_directory "tmp/cache/assets"
end
......
......@@ -15,7 +15,8 @@
<% end -%>
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
<% if keeps? -%>
!/log/.keep
!/tmp/.keep
<% end -%>
/tmp
......@@ -44,6 +44,7 @@
vendor/assets
vendor/assets/stylesheets
vendor/assets/javascripts
tmp
tmp/cache
tmp/cache/assets
)
......@@ -606,6 +607,32 @@ def test_gitignore_when_non_sqlite3_db
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
run_generator
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.
先完成此消息的编辑!
想要评论请 注册