Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggressively clean up files in the workstation install #830

Merged
merged 4 commits into from
Dec 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 87 additions & 45 deletions omnibus/config/software/more-ruby-cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,63 +34,73 @@
files = %w{
.github
.kokoro
examples
example
docs
doc
doc-api
sample
samples
test
tests
Appraisals
ARCHITECTURE.md
autotest/*
bench
benchmark
benchmarks
rakelib
CHANGELOG
CHANGELOG.md
CONTRIBUTORS.md
README.md
README.markdown
HISTORY.md
TODO.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md
UPGRADING.md
CODE_OF_CONDUCT.md
Code-of-Conduct.md
ARCHITECTURE.md
CHANGELOG.rdoc
CHANGELOG.txt
CHANGES
CHANGES.md
README.YARD.md
GUIDE.md
MIGRATING.md
README.txt
HISTORY.txt
Manifest.txt
Manifest
CHANGES.txt
CHANGELOG.txt
warning.txt
Code-of-Conduct.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CONTRIBUTING.rdoc
CONTRIBUTORS.md
doc
doc-api
docs
donate.png
ed25519.png
example
examples
ext
FAQ.txt
release-script.txt
TODO
frozen_old_spec
Gemfile.devtools
Gemfile.lock
Gemfile.travis
GUIDE.md
HISTORY
CHANGES
CHANGELOG
HISTORY.md
History.rdoc
HISTORY.txt
INSTALL
ISSUE_TEMPLATE.md
logo.png
man
Manifest
Manifest.txt
MIGRATING.md
rakelib
readme.erb
README
README-json-jruby.md
Gemfile.travis
Gemfile.lock
Gemfile.devtools
README.markdown
README.md
README.rdoc
CHANGELOG.rdoc
History.rdoc
CONTRIBUTING.rdoc
README.txt
README.YARD.md
README_INDEX.rdoc
logo.png
donate.png
Appraisals
website
man
release-script.txt
sample
samples
site
test
tests
THANKS.txt
TODO
TODO*.md
travis_build_script.sh
UPGRADING.md
warning.txt
website
yard-template
}

Dir.glob(Dir.glob("#{target_dir}/*/{#{files.join(",")}}")).each do |f|
Expand All @@ -102,5 +112,37 @@
File.delete(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
}

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

block "Removing spec dirs unless we're in components we test in the verify command" do
# find the embedded ruby gems dir and clean it up for globbing
target_dir = "#{install_dir}/embedded/lib/ruby/gems/*/gems".tr('\\', "/")

Dir.glob(Dir.glob("#{target_dir}/*/spec")).each do |f|

# don't delete these files if we use them in our verify tests
unless File.basename(File.expand_path("..", f)).match?(/^(berkshelf|test-kitchen|chef|chef-cli|chef-apply|chefspec)-\d/)
puts "Deleting unused spec dir #{f}"
FileUtils.remove_dir(f)
end
end
end
end
end