class Puppet::Provider::CommandDefiner

Internal helper class when creating commands - undocumented. @api private

Public Class Methods

define(name, path, confiner, &block) click to toggle source
# File lib/puppet/provider.rb, line 245
def self.define(name, path, confiner, &block)
  definer = new(name, path, confiner)
  definer.instance_eval(&block) if block
  definer.command
end
new(name, path, confiner) click to toggle source
# File lib/puppet/provider.rb, line 251
def initialize(name, path, confiner)
  @name = name
  @path = path
  @optional = false
  @confiner = confiner
  @custom_environment = {}
end

Public Instance Methods

command() click to toggle source
# File lib/puppet/provider.rb, line 267
def command
  if not @optional
    @confiner.confine :exists => @path, :for_binary => true
  end

  Puppet::Provider::Command.new(@name, @path, Puppet::Util, Puppet::Util::Execution, { :failonfail => true, :combine => true, :custom_environment => @custom_environment })
end
environment(env) click to toggle source
# File lib/puppet/provider.rb, line 263
def environment(env)
  @custom_environment = @custom_environment.merge(env)
end
is_optional() click to toggle source
# File lib/puppet/provider.rb, line 259
def is_optional
  @optional = true
end