Skip to content

Instantly share code, notes, and snippets.

@eohtake
Created December 30, 2015 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eohtake/32a72f984790719a482d to your computer and use it in GitHub Desktop.
Save eohtake/32a72f984790719a482d to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
#
#
#
# This custom fact fetches the Java Plugin 32 bits version currently installed on the system.
#
Facter.add("javaplugin32") do
confine :kernel => :windows
javaplugin32 = "unknown"
begin
if RUBY_PLATFORM.downcase.include?("mswin") or RUBY_PLATFORM.downcase.include?("mingw32")
require 'win32/registry'
Win32::Registry::HKEY_CLASSES_ROOT.open('Installer\Products\4EA42A62D9304AC4784BF2381208660F') do |reg|
reg.each do |name,type,data|
if name.eql?("ProductName")
javaplugin32 = data
end
end
end
end
rescue
end
setcode do
javaplugin32
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment