Created
December 30, 2015 18:11
-
-
Save eohtake/32a72f984790719a482d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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