diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-03-11 10:27:14 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-03-11 10:29:15 -0700 |
commit | b858fe34ff8109893580d4fd74e70932d4e67545 (patch) | |
tree | 2a68dad3b68539ed9f397503b345dfc1553097dd /omnibus | |
parent | d0cff8ae1cd7e589e883bfd46357f4e27253bdc6 (diff) | |
download | chef-b858fe34ff8109893580d4fd74e70932d4e67545.tar.gz |
Use fileutils to delete files or dirsslim_the_install
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'omnibus')
-rw-r--r-- | omnibus/config/software/more-ruby-cleanup.rb | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/omnibus/config/software/more-ruby-cleanup.rb b/omnibus/config/software/more-ruby-cleanup.rb index c8725fbd1a..6cfb526def 100644 --- a/omnibus/config/software/more-ruby-cleanup.rb +++ b/omnibus/config/software/more-ruby-cleanup.rb @@ -73,31 +73,26 @@ build do next if File.basename(File.expand_path("..", f)).start_with?("chef-") puts "Deleting #{f}" - if File.directory?(f) - # recursively removes files and the dir - FileUtils.remove_dir(f) - else - File.delete(f) - end + FileUtils.rm_rf(f) end + end - block "Removing Gemspec / Rakefile / Gemfile unless there's a bin dir" do - # find the embedded ruby gems dir and clean it up for globbing - target_dir = "#{install_dir}/embedded/lib/ruby/gems/*/gems".tr('\\', "/") - files = %w{ - *.gemspec - Gemfile - Rakefile - tasks/*.rake - } + block "Removing Gemspec / Rakefile / Gemfile unless there's a bin dir" do + # find the embedded ruby gems dir and clean it up for globbing + target_dir = "#{install_dir}/embedded/lib/ruby/gems/*/gems".tr('\\', "/") + files = %w{ + *.gemspec + Gemfile + Rakefile + tasks/*.rake + } - Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f| - # don't delete these files if there's a bin dir in the same dir - unless Dir.exist?(File.join(File.dirname(f), "bin")) - puts "Deleting #{f}" - File.delete(f) - end + Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f| + # don't delete these files if there's a bin dir in the same dir + unless Dir.exist?(File.join(File.dirname(f), "bin")) + puts "Deleting #{f}" + File.delete(f) end end end -end +end
\ No newline at end of file |