class Puppet::Pal::ScriptCompiler

Public Instance Methods

list_plans(filter_regex = nil, error_collector = nil) click to toggle source

Returns an array of TypedName objects for all plans, optionally filtered by a regular expression. The returned array has more information than just the leaf name - the typical thing is to just get the name as showing the following example.

Errors that occur during plan discovery will either be logged as warnings or collected by the optional `error_collector` array. When provided, it will receive {Puppet::DataTypes::Error} instances describing each error in detail and no warnings will be logged.

@example getting the names of all plans

compiler.list_plans.map {|tn| tn.name }

@param filter_regex [Regexp] an optional regexp that filters based on name (matching names are included in the result) @param error_collector [Array<Puppet::DataTypes::Error>] an optional array that will receive errors during load @return [Array<Puppet::Pops::Loader::TypedName>] an array of typed names

   # File lib/puppet/pal/script_compiler.rb
35 def list_plans(filter_regex = nil, error_collector = nil)
36   list_loadable_kind(:plan, filter_regex, error_collector)
37 end
list_tasks(filter_regex = nil, error_collector = nil) click to toggle source

Returns an array of TypedName objects for all tasks, optionally filtered by a regular expression. The returned array has more information than just the leaf name - the typical thing is to just get the name as showing the following example.

@example getting the names of all tasks

compiler.list_tasks.map {|tn| tn.name }

Errors that occur during task discovery will either be logged as warnings or collected by the optional `error_collector` array. When provided, it will receive {Puppet::DataTypes::Error} instances describing each error in detail and no warnings will be logged.

@param filter_regex [Regexp] an optional regexp that filters based on name (matching names are included in the result) @param error_collector [Array<Puppet::DataTypes::Error>] an optional array that will receive errors during load @return [Array<Puppet::Pops::Loader::TypedName>] an array of typed names

   # File lib/puppet/pal/script_compiler.rb
68 def list_tasks(filter_regex = nil, error_collector = nil)
69   list_loadable_kind(:task, filter_regex, error_collector)
70 end
plan_signature(plan_name) click to toggle source

Returns the signature of the given plan name @param plan_name [String] the name of the plan to get the signature of @return [Puppet::Pal::PlanSignature, nil] returns a PlanSignature, or nil if plan is not found

   # File lib/puppet/pal/script_compiler.rb
10 def plan_signature(plan_name)
11   loader = internal_compiler.loaders.private_environment_loader
12   func = loader.load(:plan, plan_name)
13   if func
14     return PlanSignature.new(func)
15   end
16   # Could not find plan
17   nil
18 end
task_signature(task_name) click to toggle source

Returns the signature callable of the given task (the arguments it accepts, and the data type it returns) @param task_name [String] the name of the task to get the signature of @return [Puppet::Pal::TaskSignature, nil] returns a TaskSignature, or nil if task is not found

   # File lib/puppet/pal/script_compiler.rb
43 def task_signature(task_name)
44   loader = internal_compiler.loaders.private_environment_loader
45   task = loader.load(:task, task_name)
46   if task
47     return TaskSignature.new(task)
48   end
49   # Could not find task
50   nil
51 end