#!/usr/bin/env ruby require 'enumerator' $: << 'lib' #$: << 'lib' libs = ARGV #(ENV['LIBS'] || "").split(/[;:]/) # We add time b/c both that's built-in but not loaded by Ruby. original = `script/methods time.rb yaml.rb`.split(/\s/) facets = `script/methods lib/facets`.split(/\s/) other = `script/methods #{libs.join(' ')}`.split(/\s/) facets = facets - original other = other - original clash = facets & other puts clash.sort.join("\n") puts " #{clash.size} Clashes" =begin # Return a hash for each defined class containing a array class and method. def methods_by_class Module. constants. map{|klass| eval(klass)}. select{|klass| klass.is_a? Class}. inject({}){|h,klass| h[klass] = [ klass.methods-klass.superclass.methods, klass.instance_methods-(klass.superclass ? klass.superclass.instance_methods : []) ] h } end before = methods_by_class ARGV.each{|a| require a } after = methods_by_class delta = after - before puts delta.join("\n") exit # Print the difference between the before and after method lists: before.keys.sort_by{|k| k.to_s}.each{|k| class_diff = after[k][0]-before[k][0] instance_diff = after[k][1]-before[k][1] next if class_diff.empty? && instance_diff.empty? puts((class_diff.sort.map{|c| "#{k}."+c} + instance_diff.sort.map{|c| "#{k}#"+c} )*"\n") } =end