summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuo Yan <nuo@opscode.com>2010-05-03 15:41:47 -0700
committerNuo Yan <nuo@opscode.com>2010-05-03 15:41:47 -0700
commitab2be1e592af441eb843bae1917be13019dd0a90 (patch)
tree7674a733e433ca6242a69b0d5aa46b9a83541891
parent97e207191826912ba9183d9f757aaf3aa0cceac8 (diff)
downloadohai-ab2be1e592af441eb843bae1917be13019dd0a90.tar.gz
add mingw32 and windows to the platform matching so it knows to use the windows plugin
-rwxr-xr-xbin/ohai10
-rw-r--r--lib/ohai/plugins/kernel.rb2
-rw-r--r--lib/ohai/plugins/os.rb2
3 files changed, 12 insertions, 2 deletions
diff --git a/bin/ohai b/bin/ohai
index c1a434e0..4686be36 100755
--- a/bin/ohai
+++ b/bin/ohai
@@ -37,4 +37,14 @@ rescue LoadError
raise
end
+
+if RUBY_PLATFORM =~ /mswin|mingw32|windows/
+ begin
+ require 'ruby-wmi'
+ rescue LoadError
+ STDERR.puts "ruby-wmi failed to load - is it installed?"
+ raise
+ end
+end
+
Ohai::Application.new.run
diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb
index be7e9482..eaa1716c 100644
--- a/lib/ohai/plugins/kernel.rb
+++ b/lib/ohai/plugins/kernel.rb
@@ -22,7 +22,7 @@ require_plugin 'ruby'
kernel Mash.new
case languages[:ruby][:host_os]
-when /mswin/
+when /mswin|mingw32|windows/
require_plugin "windows::kernel"
else
kernel[:name] = from("uname -s")
diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb
index 6cebc6ee..57def493 100644
--- a/lib/ohai/plugins/os.rb
+++ b/lib/ohai/plugins/os.rb
@@ -34,7 +34,7 @@ when /netbsd(.+)$/
os "netbsd"
when /solaris2\.([\d]+)/
os "solaris2"
-when /mswin/
+when /mswin|mingw32|windows/
# After long discussion in IRC the "powers that be" have come to a concensus
# that there is no other Windows platforms exist that were not based on the
# Windows_NT kernel, so we herby decree that "windows" will refer to all