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
219 def self.define(name, path, confiner, &block)
220   definer = new(name, path, confiner)
221   definer.instance_eval(&block) if block
222   definer.command
223 end
new(name, path, confiner) click to toggle source
    # File lib/puppet/provider.rb
225 def initialize(name, path, confiner)
226   @name = name
227   @path = path
228   @optional = false
229   @confiner = confiner
230   @custom_environment = {}
231 end

Private Class Methods

new(closure_scope, loader) click to toggle source
Calls superclass method Object::new
   # File lib/puppet/functions/match.rb
49 def initialize(closure_scope, loader)
50   super
51 
52   # Make this visitor shared among all instantiations of this function since it is faster.
53   # This can be used because it is not possible to replace
54   # a puppet runtime (where this function is) without a reboot. If you model a function in a module after
55   # this class, use a regular instance variable instead to enable reloading of the module without reboot
56   #
57   @@match_visitor   ||= Puppet::Pops::Visitor.new(self, "match", 1, 1)
58 end

Public Instance Methods

command() click to toggle source
    # File lib/puppet/provider.rb
241 def command
242   if not @optional
243     @confiner.confine :exists => @path, :for_binary => true
244   end
245 
246   Puppet::Provider::Command.new(@name, @path, Puppet::Util, Puppet::Util::Execution, { :failonfail => true, :combine => true, :custom_environment => @custom_environment })
247 end
environment(env) click to toggle source
    # File lib/puppet/provider.rb
237 def environment(env)
238   @custom_environment = @custom_environment.merge(env)
239 end
is_optional() click to toggle source
    # File lib/puppet/provider.rb
233 def is_optional
234   @optional = true
235 end