mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
rails tmp:clear
: clear tmp/storage
This commit is contained in:
parent
e888e3cf87
commit
00feff918e
3 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
* `bin/rails tmp:clear` deletes files and directories in `tmp/storage`.
|
||||
|
||||
*George Claghorn*
|
||||
|
||||
* Fix compatibility with `psych >= 4`.
|
||||
|
||||
Starting in Psych 4.0.0 `YAML.load` behaves like `YAML.safe_load`. To preserve compatibility
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace :tmp do
|
||||
desc "Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)"
|
||||
task clear: ["tmp:cache:clear", "tmp:sockets:clear", "tmp:screenshots:clear"]
|
||||
task clear: ["tmp:cache:clear", "tmp:sockets:clear", "tmp:screenshots:clear", "tmp:storage:clear"]
|
||||
|
||||
tmp_dirs = [ "tmp/cache",
|
||||
"tmp/sockets",
|
||||
|
@ -41,4 +41,11 @@ namespace :tmp do
|
|||
rm Dir["tmp/screenshots/[^.]*"], verbose: false
|
||||
end
|
||||
end
|
||||
|
||||
namespace :storage do
|
||||
# desc "Clear all files and directories in tmp/storage"
|
||||
task :clear do
|
||||
rm_rf Dir["tmp/storage/[^.]*"], verbose: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ module ApplicationTests
|
|||
teardown_app
|
||||
end
|
||||
|
||||
test "tmp:clear clear cache, socket and screenshot files" do
|
||||
test "tmp:clear clear cache, socket, screenshot, and storage files" do
|
||||
Dir.chdir(app_path) do
|
||||
FileUtils.mkdir_p("tmp/cache")
|
||||
FileUtils.touch("tmp/cache/cache_file")
|
||||
|
@ -26,11 +26,15 @@ module ApplicationTests
|
|||
FileUtils.mkdir_p("tmp/screenshots")
|
||||
FileUtils.touch("tmp/screenshots/fail.png")
|
||||
|
||||
FileUtils.mkdir_p("tmp/storage/6h/np")
|
||||
FileUtils.touch("tmp/storage/6h/np/6hnp81jvgt42pcfqtlpoy8qshfb0")
|
||||
|
||||
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")
|
||||
assert_not File.exist?("tmp/storage/6h/np/6hnp81jvgt42pcfqtlpoy8qshfb0")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue