Sha256: c99d835eec138dd801759d4d9a1b8fe4d9ee0e3c22e61a2c9c5c46175a06137a
Contents?: true
Size: 1.11 KB
Versions: 22
Compression:
Stored size: 1.11 KB
Contents
#!/usr/bin/env ruby # This is an utility to automatically remove a group of filters provided # to its standard input. # # This utility is to assist with removing a large group of filters spread # around multiple files that is being output by a command: # # rake mspec_ruby_nodejs RUBYSPECS=true INVERT_RUNNING_MODE=true # # It expects an input of format: # 1) "Set#filter! returns an Enumerator when passed no block" # 2) "Set#filter! yields every element of self" # 3) "Set#filter! keeps every element from self for which the passed block returns true" # 4) "Set#filter! returns self when self was modified" # 5) "Set#filter! returns nil when self was not modified" filters = $stdin.read.split("\n").map do |i| i.scan(/(?:\d+\)|fails) (".*")/).first.first end.compact filters = Regexp.union(*filters) remove_filters = -> path { file = File.read(path).split("\n") remove, good = file.partition { |i| i =~ filters } if remove.length > 0 puts "Removing #{remove.length} filters from #{path}" File.write(path, good.join("\n")+"\n") end } Dir['spec/filters/**/*.rb'].each do |path| remove_filters[path] end
Version data entries
22 entries across 22 versions & 1 rubygems