diff options
author | Claire McQuin <claire@opscode.com> | 2013-10-11 18:00:57 -0700 |
---|---|---|
committer | Claire McQuin <claire@opscode.com> | 2013-10-17 12:07:30 -0700 |
commit | 49336a8f6be9192cb32cf8ecceb786f18dc86fbc (patch) | |
tree | 9371cbf75cc62d34eae296221d390140891ca063 | |
parent | c981c39117e6b9644c27e69c0ad3d600a792cf15 (diff) | |
download | ohai-49336a8f6be9192cb32cf8ecceb786f18dc86fbc.tar.gz |
make Ohai::OS a mixin (Ohai::Mixin::OS)
-rw-r--r-- | lib/ohai/dsl/plugin.rb | 2 | ||||
-rw-r--r-- | lib/ohai/mixin/os.rb (renamed from lib/ohai/os.rb) | 46 | ||||
-rw-r--r-- | lib/ohai/plugins/os.rb | 2 | ||||
-rw-r--r-- | lib/ohai/system.rb | 2 |
4 files changed, 19 insertions, 33 deletions
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb index 97fa72e2..b2e2cb3e 100644 --- a/lib/ohai/dsl/plugin.rb +++ b/lib/ohai/dsl/plugin.rb @@ -19,7 +19,7 @@ # # @todo: move os to mixin -require 'ohai/os' +require 'ohai/mixin/os' require 'ohai/mixin/command' require 'ohai/mixin/seconds_to_human' diff --git a/lib/ohai/os.rb b/lib/ohai/mixin/os.rb index 8daad297..e9e8c27f 100644 --- a/lib/ohai/os.rb +++ b/lib/ohai/mixin/os.rb @@ -1,5 +1,20 @@ # +# Author:: Adam Jacob (<adam@opscode.com>) +# Copyright:: Copyright (c) 2008 Opscode, Inc. +# License:: Apache License, Version 2.0 # +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. # require 'rbconfig' @@ -7,36 +22,6 @@ require 'rbconfig' module Ohai module OS - def self.collect_os - case ::RbConfig::CONFIG['host_os'] - when /aix(.+)$/ - return "aix" - when /darwin(.+)$/ - return "darwin" - when /hpux(.+)$/ - return "hpux" - when /linux/ - return "linux" - when /freebsd(.+)$/ - return "freebsd" - when /openbsd(.+)$/ - return "openbsd" - when /netbsd(.*)$/ - return "netbsd" - when /solaris2/ - return "solaris2" - when /mswin|mingw32|windows/ - # After long discussion in IRC the "powers that be" have come to a consensus - # that no Windows platform exists that was not based on the - # Windows_NT kernel, so we herby decree that "windows" will refer to all - # platforms built upon the Windows_NT kernel and have access to win32 or win64 - # subsystems. - return "windows" - else - return ::RbConfig::CONFIG['host_os'] - end - end - def collect_os case ::RbConfig::CONFIG['host_os'] when /aix(.+)$/ @@ -67,5 +52,6 @@ module Ohai end end + module_function :collect_os end end diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb index 631ed237..2a9e7d5b 100644 --- a/lib/ohai/plugins/os.rb +++ b/lib/ohai/plugins/os.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'ohai/os' +require 'ohai/mixin/os' Ohai.plugin(:OS) do provides "os", "os_version" diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb index ee506de2..dc68deaa 100644 --- a/lib/ohai/system.rb +++ b/lib/ohai/system.rb @@ -19,11 +19,11 @@ require 'ohai/loader' require 'ohai/log' require 'ohai/mash' -require 'ohai/os' require 'ohai/runner' require 'ohai/dsl/plugin' require 'ohai/mixin/from_file' require 'ohai/mixin/command' +require 'ohai/mixin/os' require 'ohai/mixin/string' require 'mixlib/shellout' |