Permalink
Browse files

add name collision checking script

  • Loading branch information...
1 parent 44b1428 commit 635f4216bcc2ab5aa3898e9104819c62a6185f37 Rich Lane committed Nov 14, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 devel/collisions.rb
View
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+# Find collisions between VMODL property names and Ruby methods
+require 'rbvmomi'
+VIM = RbVmomi::VIM
+
+conn = VIM.new(:ns => 'urn:vim25', :rev => '4.0')
+
+VIM.loader.typenames.each do |name|
+ klass = VIM.loader.get name
+ next unless klass.respond_to? :kind and [:managed, :data].member? klass.kind
+ methods = klass.kind == :managed ?
+ RbVmomi::BasicTypes::ObjectWithMethods.instance_methods :
+ RbVmomi::BasicTypes::ObjectWithProperties.instance_methods
+ klass.props_desc.each do |x|
+ name = x['name']
+ puts "collision: #{klass}##{name}" if methods.member? name.to_sym
+ end
+end

0 comments on commit 635f421

Please sign in to comment.