#!/usr/bin/env ruby #!/usr/bin/env ruby require 'enumerator' desc "Show extension conflicts" task :conflict do #$: << 'lib' libs = (ENV['LIBS'] || "").split(/[;:]/) original = `task/method_dump`.split(' ') facets = `task/method_dump lib/facets`.split(' ') other = `task/method_dump #{libs.join(' ')}`.split(' ') facets = facets - original other = other - original puts (facets & other).sort.join("\n") end ARGV.each{ |lib| require lib } total_method_list = [] ObjectSpace.each_object(Class) do |klass| insta_methods = klass.public_instance_methods(false) + klass.private_instance_methods(false) + klass.protected_instance_methods(false) class_methods = klass.public_methods(false) + klass.private_methods(false) + klass.protected_methods(false) if klass.superclass insta_methods -= klass.superclass.public_instance_methods + klass.superclass.private_instance_methods + klass.superclass.protected_instance_methods class_methods -= klass.superclass.public_methods + klass.superclass.private_methods + klass.superclass.protected_methods end class_methods.map!{|c| "#{klass}." + c} insta_methods.map!{|c| "#{klass}#" + c} total_method_list.concat(class_methods) total_method_list.concat(insta_methods) end puts total_method_list.join(" ")