ScriptHost Class

Summary

The script host works as a context for scripts.
graph BT Type-->Base0["object"] Type-.->Interface0["IScriptHost"] click Interface0 "/api/Cake.Core.Scripting/IScriptHost" Type["ScriptHost"] class Type type-node Derived0["DryRunScriptHost"]-->Type click Derived0 "/api/Cake.Scripting/DryRunScriptHost" Derived1["TaskTreeScriptHost"]-->Type click Derived1 "/api/Cake.Scripting/TaskTreeScriptHost" Derived2["DescriptionScriptHost"]-->Type click Derived2 "/api/Cake.Scripting/DescriptionScriptHost" Derived3["BuildScriptHost"]-->Type click Derived3 "/api/Cake.Scripting/BuildScriptHost"

Syntax

public abstract class ScriptHost : IScriptHost

Constructors

Name Summary
ScriptHost(ICakeEngine, ICakeContext) Initializes a new instance of the ScriptHost class.

Properties

Name Value Summary
Context ICakeContext
Gets the context.
Engine ICakeEngine
Gets the engine.
Settings ExecutionSettings
Gets the settings.
Tasks IReadOnlyList<ICakeTaskInfo>
Gets all registered tasks.

Methods

Name Value Summary
RunTarget(string) CakeReport
Runs the specified target.
RunTargetAsync(string) Task<CakeReport>
Runs the specified target.
Setup(Action<ISetupContext>) void
Allows registration of an action that's executed before any tasks are run. If setup fails, no tasks will be executed but teardown will be performed.
Setup<TData>(Func<ISetupContext, TData>) void
Allows registration of an action that's executed before any tasks are run. If setup fails, no tasks will be executed but teardown will be performed.
Task(string) CakeTaskBuilder
Registers a new task.
TaskSetup(Action<ITaskSetupContext>) void
Allows registration of an action that's executed before each task is run. If the task setup fails, its task will not be executed but the task teardown will be performed.
TaskSetup<TData>(Action<ITaskSetupContext, TData>) void
Allows registration of an action that's executed before each task is run. If the task setup fails, its task will not be executed but the task teardown will be performed.
TaskTeardown(Action<ITaskTeardownContext>) void
Allows registration of an action that's executed after each task has been run. If a task setup action or a task fails with or without recovery, the specified task teardown action will still be executed.
TaskTeardown<TData>(Action<ITaskTeardownContext, TData>) void
Allows registration of an action that's executed after each task has been run. If a task setup action or a task fails with or without recovery, the specified task teardown action will still be executed.
Teardown(Action<ITeardownContext>) void
Allows registration of an action that's executed after all other tasks have been run. If a setup action or a task fails with or without recovery, the specified teardown action will still be executed.
Teardown<TData>(Action<ITeardownContext, TData>) void
Allows registration of an action that's executed after all other tasks have been run. If a setup action or a task fails with or without recovery, the specified teardown action will still be executed.

Extension Methods

Name Value Summary
Dump<ScriptHost>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<ScriptHost>(ScriptHost[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<ScriptHost>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
NotNull<ScriptHost>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Issues addin
ThrowIfNull<ScriptHost>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<ScriptHost>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin