class Hiera::Backend::Eyaml::Plugins

Public Class Methods

commands() click to toggle source
# File lib/hiera/backend/eyaml/plugins.rb, line 63
def self.commands
  @@commands
end
find() click to toggle source
# File lib/hiera/backend/eyaml/plugins.rb, line 26
def self.find

  this_version = Gem::Version.create(Hiera::Backend::Eyaml::VERSION)
  index = Gem::VERSION >= "1.8.0" ? Gem::Specification : Gem.source_index

  [index].flatten.each do |source|
    specs = Gem::VERSION >= "1.6.0" ? source.latest_specs(true) : source.latest_specs

    specs.each do |spec|
      next if @@plugins.include? spec

      dependency = spec.dependencies.find { |d| d.name == "hiera-eyaml" }
      next if dependency && !dependency.requirement.satisfied_by?( this_version )

      file = nil
      if Gem::VERSION >= "1.8.0"
        file = spec.matches_for_glob("**/eyaml_init.rb").first
      else
        file = Gem.searcher.matching_files(spec, "**/eyaml_init.rb").first
      end

      next unless file

      @@plugins << spec
      load file
    end

  end

  @@plugins

end
options() click to toggle source
# File lib/hiera/backend/eyaml/plugins.rb, line 22
def self.options
  @@options
end
plugins() click to toggle source
# File lib/hiera/backend/eyaml/plugins.rb, line 59
def self.plugins
  @@plugins
end
register_options(args) click to toggle source
# File lib/hiera/backend/eyaml/plugins.rb, line 12
def self.register_options args
  options = args[ :options ]
  plugin = args[ :plugin ]
  options.each do |name, option_hash|
    new_option = {:name => "#{plugin}_#{name}"}
    new_option.merge! option_hash
    @@options << new_option
  end
end