Module: GemExtCleaner
- Defined in:
- lib/gem-ext-cleaner.rb
Class Method Summary collapse
Class Method Details
.clean(spec) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gem-ext-cleaner.rb', line 5 def self.clean(spec) (spec.full_require_paths - [spec.extension_dir]).each do |path| Dir.glob(File.join(path, "**/*")).each do |file| # Prevent deleting files in versioned directories like google-protobuf, nokogiri next if file.sub(/#{spec.full_gem_path}\//, "") =~ /(\d+\.\d+\/)/ if Pathname(file).extname == ".#{RbConfig::CONFIG["DLEXT"]}" File.delete(file) puts "Delete #{file}" end end rescue Errno::EPERM end end |