Exclude `*.gem` from generated package
Summary
Use excludes rather than delete command to clean up gems
Proposal
project.exclude
is better at excluding things from the build than deleting in the build seems to be: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/10.5.2+ce.0/config/software/gitlab-rails.rb#L165-166
$ find /opt -name \*.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/activesupport-5.0.6.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/ast-2.3.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/gitaly-proto-0.83.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/gitlab-styles-2.0.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/google-protobuf-3.5.1-x86_64-linux.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/googleauth-0.6.2.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/grpc-1.8.7-x86_64-linux.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/i18n-0.8.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/json-2.1.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/jwt-2.1.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/minitest-5.9.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/nokogiri-1.8.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/parallel-1.12.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/parser-2.4.0.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/powerpack-0.1.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/public_suffix-3.0.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rake-12.1.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rdoc-4.3.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rspec-3.6.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rspec-core-3.6.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rspec-expectations-3.6.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rspec-mocks-3.6.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rspec-support-3.6.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rubocop-0.50.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rubocop-gitlab-security-0.1.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/rubocop-rspec-1.17.0.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/ruby-progressbar-1.8.3.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/signet-0.8.1.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/tzinfo-1.2.2.gem
/opt/gitlab/embedded/lib/ruby/gems/2.3.0/cache/unicode-display_width-1.3.0.gem
exclude 'embedded/lib/ruby/gems/*/cache'
should do a better job of this and won't make us wonder 'what process also installed gems and didn't tidy up'