forked from sous-chefs/ark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sous-chefsGH-107] Correcting Chef/Ruby quality offenses
- Loading branch information
Showing
2 changed files
with
82 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
module Ark | ||
module DirUtils | ||
|
||
# Delete all files and directories inside the given directory. | ||
# @param work_dir Path of the directory to be cleaned up. | ||
def delete_files_and_directories_inside(work_dir) | ||
# Ensure we only have "/"-like separators in the provided path | ||
# (windows path separator is not supported by Dir) | ||
directory_content_pattern = ::File.join(work_dir, "*").gsub(%r:\\:, "/") | ||
directory_content_pattern = ::File.join(work_dir, '*').gsub(/\\/, '/') | ||
|
||
::Dir[directory_content_pattern].each do |path| | ||
::FileUtils.rm_rf(path) | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters