lib/sensu/extensions/loader.rb
# Load an extension from a Rubygem.
#
# @param [String] gem name.
Load an extension from a Rubygem.
Load an extension from a Rubygem .
def load_gem(raw_gem, version=nil)
        warning("loading extension gem", :gem => raw_gem, :version => version)
        begin
          gem(raw_gem, version) if version
          if raw_gem.start_with?(GEM_PREFIX)
            lib = raw_gem.sub(/^#{GEM_PREFIX}/, "")
            require_path = "sensu/extensions/#{lib}"
          else
            require_path = raw_gem
          end
          warning("requiring extension gem", :require => require_path)
          require require_path
          @loaded_gems << raw_gem
        rescue ScriptError, StandardError => error
          warning("failed to require extension", {
            :gem => raw_gem,
            :version => version,
            :error => error
          })
          warning("ignoring extension", :gem => raw_gem)
        end
      end
def load_gem ( raw_gem , version = nil ) warning ( "loading extension gem" , :gem => raw_gem , :version => version ) begin gem ( raw_gem , version ) if version if raw_gem . start_with? ( GEM_PREFIX ) lib = raw_gem . sub ( / ^ #{ GEM_PREFIX } / , "" ) require_path = "sensu/extensions/#{lib}" else require_path = raw_gem end warning ( "requiring extension gem" , :require => require_path ) require require_path @loaded_gems << raw_gem rescue ScriptError , StandardError => error warning ( "failed to require extension" , { :gem => raw_gem , :version => version , :error => error } ) warning ( "ignoring extension" , :gem => raw_gem ) end end
Load an extension from a Rubygem.
Load an extension from a Rubygem .
raw_gem
<not_specific>
version
<not_specific>
<not_specific>
None