Sha256: 245645442c2d0523c74026a042b1f07519ff5388336276cce4747ff7b22676a5
Contents?: true
Size: 617 Bytes
Versions: 4
Compression:
Stored size: 617 Bytes
Contents
require 'find' require 'highline' module Terragov class Cleaner def delete(path, pattern, force=false) cli = HighLine.new files = Find.find(path).grep(pattern) if files.empty? puts "No files found matching #{pattern} in #{path}" exit end puts "Files matching #{pattern} found:" files.each do |file| puts File.expand_path(file) end unless force exit unless HighLine.agree('Do you wish to delete?') end files.each do |file| File.delete(File.expand_path(file)) end puts "Done" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
terragov-0.2.2 | lib/terragov/cleaner.rb |
terragov-0.2.1 | lib/terragov/cleaner.rb |
terragov-0.2.0 | lib/terragov/cleaner.rb |
terragov-0.1.0 | lib/terragov/cleaner.rb |