Method: Jets::Builders::GemReplacer#tidy_gem
- Defined in:
- lib/jets/builders/gem_replacer.rb
#tidy_gem(path) ⇒ Object
Clean up some unneeded files to try to keep the package size down In a generated jets app this made a decent 9% difference:
175M test2
191M test3
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/jets/builders/gem_replacer.rb', line 64 def tidy_gem(path) # remove top level tests and cache folders Dir.glob("#{path}/*").each do |path| next unless File.directory?(path) folder = File.basename(path) if %w[test tests spec features benchmark cache doc].include?(folder) FileUtils.rm_rf(path) end end Dir.glob("#{path}/**/*").each do |path| next unless File.file?(path) ext = File.extname(path) if %w[.rdoc .md .markdown].include?(ext) or path =~ /LICENSE|CHANGELOG|README/ FileUtils.rm_f(path) end end end |