Module: Ohai

Defined in:
lib/ohai/version.rb,
lib/ohai/log.rb,
lib/ohai/hints.rb,
lib/ohai/runner.rb,
lib/ohai/system.rb,
lib/ohai/config.rb,
lib/ohai/loader.rb,
lib/ohai/mixin/os.rb,
lib/ohai/exception.rb,
lib/ohai/dsl/plugin.rb,
lib/ohai/util/win32.rb,
lib/ohai/common/dmi.rb,
lib/ohai/provides_map.rb,
lib/ohai/mixin/command.rb,
lib/ohai/util/ip_helper.rb,
lib/ohai/util/file_helper.rb,
lib/ohai/mixin/gce_metadata.rb,
lib/ohai/mixin/ec2_metadata.rb,
lib/ohai/dsl/plugin/versionvi.rb,
lib/ohai/mixin/constant_helper.rb,
lib/ohai/dsl/plugin/versionvii.rb,
lib/ohai/mixin/seconds_to_human.rb,
lib/ohai/mixin/network_constants.rb,
lib/ohai/util/win32/group_helper.rb,
lib/ohai/mixin/cloudstack_metadata.rb

Overview

Author

Serdar Sutay (<[email protected]>)

Copyright

Copyright © 2014 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.

Defined Under Namespace

Modules: Common, DSL, Exceptions, Hints, Mixin, NamedPlugin, Util Classes: Application, Config, Loader, Log, ProvidesMap, Runner, System

Constant Summary collapse

OHAI_ROOT =
File.expand_path(File.dirname(__FILE__))
VERSION =
'8.1.1'

Class Method Summary collapse

Class Method Details

.abs_path(abs_path) ⇒ Object

Extracted abs_path to support testability: This method gets overridden at test time, to force the shell to check ohai/spec/unit/path/original/absolute/path/to/exe


74
75
76
# File 'lib/ohai/dsl/plugin.rb', line 74

def self.abs_path( abs_path )
  abs_path
end

.dev_nullObject

Cross platform /dev/null to support testability


63
64
65
66
67
68
69
# File 'lib/ohai/dsl/plugin.rb', line 63

def self.dev_null
  if RUBY_PLATFORM =~ /mswin|mingw|windows/
    "NUL"
  else
    "/dev/null"
  end
end

.plugin(name, &block) ⇒ Object


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ohai/dsl/plugin.rb', line 46

def self.plugin(name, &block)
  raise Ohai::Exceptions::InvalidPluginName, "#{name} is not a valid plugin name. A valid plugin name is a symbol which begins with a capital letter and contains no underscores" unless NamedPlugin.valid_name?(name)

  plugin = nil

  if NamedPlugin.strict_const_defined?(name)
    plugin = NamedPlugin.const_get(name)
    plugin.class_eval(&block)
  else
    klass = Class.new(DSL::Plugin::VersionVII, &block)
    plugin = NamedPlugin.const_set(name, klass)
  end

  plugin
end