summaryrefslogtreecommitdiff
path: root/omnibus/config/software/more-ruby-cleanup.rb
diff options
context:
space:
mode:
Diffstat (limited to 'omnibus/config/software/more-ruby-cleanup.rb')
-rw-r--r--omnibus/config/software/more-ruby-cleanup.rb34
1 files changed, 33 insertions, 1 deletions
diff --git a/omnibus/config/software/more-ruby-cleanup.rb b/omnibus/config/software/more-ruby-cleanup.rb
index 7fab72fca2..46bf36624b 100644
--- a/omnibus/config/software/more-ruby-cleanup.rb
+++ b/omnibus/config/software/more-ruby-cleanup.rb
@@ -68,6 +68,9 @@ build do
features
*Upgrade.md
vendor
+ *.blurb
+ autotest
+ VERSION
}
Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f|
@@ -78,4 +81,33 @@ build do
FileUtils.rm_rf(f)
end
end
-end \ No newline at end of file
+
+ block "Removing Gemspec / Rakefile / Gemfile unless there's a bin dir / not a chef gem" 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
+ }
+
+ 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 or we're in a chef owned gem
+ next if Dir.exist?(File.join(File.dirname(f), "bin")) || File.basename(File.expand_path("..", f)).start_with?("chef-")
+
+ puts "Deleting #{f}"
+ FileUtils.rm_rf(f)
+ end
+ end
+
+ block "Removing spec dirs from non-Chef gems" do
+ Dir.glob(Dir.glob("#{install_dir}/embedded/lib/ruby/gems/*/gems/*/spec".tr('\\', "/"))).each do |f|
+ # if we're in a chef- gem then don't remove the specs
+ next if File.basename(File.expand_path("..", f)).start_with?("chef-")
+
+ puts "Deleting #{f}"
+ FileUtils.rm_rf(f)
+ end
+ end
+end