ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Setup\BuildArtifactObjective Class Reference

This is an objective to build some artifact. More...

+ Inheritance diagram for ILIAS\Setup\BuildArtifactObjective:
+ Collaboration diagram for ILIAS\Setup\BuildArtifactObjective:

Public Member Functions

 getArtifactPath ()
 Get the filename where the builder wants to put its artifact. More...
 
 build ()
 Build the artifact based. More...
 
 buildIn (Environment $env)
 Builds an artifact in some given Environment. More...
 
 getPreconditions (Environment $environment)
 Defaults to no preconditions. More...
 
 getHash ()
 Uses hashed Path. More...
 
 getLabel ()
 Defaults to "Build $this->getArtifactPath()". More...
 
 isNotable ()
 Defaults to 'true'. More...
 
 achieve (Environment $environment)
 Builds the artifact and puts it in its location. More...
 

Protected Member Functions

 makeDirectoryFor (string $path)
 

Detailed Description

This is an objective to build some artifact.

Definition at line 11 of file BuildArtifactObjective.php.

Member Function Documentation

◆ achieve()

ILIAS\Setup\BuildArtifactObjective::achieve ( Environment  $environment)

Builds the artifact and puts it in its location.

Implements ILIAS\Setup\Objective.

Definition at line 84 of file BuildArtifactObjective.php.

References ILIAS\Setup\BuildArtifactObjective\buildIn(), ILIAS\Setup\BuildArtifactObjective\getArtifactPath(), and ILIAS\Setup\BuildArtifactObjective\makeDirectoryFor().

84  : Environment
85  {
86  $artifact = $this->buildIn($environment);
87 
88  // TODO: Do we want to configure this?
89  $base_path = getcwd();
90  $path = $base_path . "/" . $this->getArtifactPath();
91 
92  $this->makeDirectoryFor($path);
93 
94  file_put_contents($path, $artifact->serialize());
95 
96  return $environment;
97  }
buildIn(Environment $env)
Builds an artifact in some given Environment.
getArtifactPath()
Get the filename where the builder wants to put its artifact.
+ Here is the call graph for this function:

◆ build()

ILIAS\Setup\BuildArtifactObjective::build ( )
abstract

Build the artifact based.

If you want to use the environment reimplement buildIn instead.

Referenced by ILIAS\Setup\BuildArtifactObjective\buildIn().

+ Here is the caller graph for this function:

◆ buildIn()

ILIAS\Setup\BuildArtifactObjective::buildIn ( Environment  $env)

Builds an artifact in some given Environment.

Defaults to just dropping the environment and using build.

If you want to reimplement this, you most probably also want to reimplement getPreconditions to prepare the environment properly.

Definition at line 34 of file BuildArtifactObjective.php.

References ILIAS\Setup\BuildArtifactObjective\build().

Referenced by ILIAS\Setup\BuildArtifactObjective\achieve().

34  : Artifact
35  {
36  return $this->build();
37  }
build()
Build the artifact based.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getArtifactPath()

ILIAS\Setup\BuildArtifactObjective::getArtifactPath ( )
abstract

Get the filename where the builder wants to put its artifact.

This is understood to be a path relative to the ILIAS root directory.

Referenced by ILIAS\Setup\BuildArtifactObjective\achieve(), ILIAS\Setup\BuildArtifactObjective\getHash(), and ILIAS\Setup\BuildArtifactObjective\getLabel().

+ Here is the caller graph for this function:

◆ getHash()

ILIAS\Setup\BuildArtifactObjective::getHash ( )

Uses hashed Path.

Implements ILIAS\Setup\Objective.

Definition at line 54 of file BuildArtifactObjective.php.

References ILIAS\Setup\BuildArtifactObjective\getArtifactPath().

54  : string
55  {
56  return hash("sha256", $this->getArtifactPath());
57  }
getArtifactPath()
Get the filename where the builder wants to put its artifact.
+ Here is the call graph for this function:

◆ getLabel()

ILIAS\Setup\BuildArtifactObjective::getLabel ( )

Defaults to "Build $this->getArtifactPath()".

Implements ILIAS\Setup\Objective.

Definition at line 64 of file BuildArtifactObjective.php.

References ILIAS\Setup\BuildArtifactObjective\getArtifactPath().

64  : string
65  {
66  return 'Build ' . $this->getArtifactPath();
67  }
getArtifactPath()
Get the filename where the builder wants to put its artifact.
+ Here is the call graph for this function:

◆ getPreconditions()

ILIAS\Setup\BuildArtifactObjective::getPreconditions ( Environment  $environment)

Defaults to no preconditions.

Implements ILIAS\Setup\Objective.

Definition at line 44 of file BuildArtifactObjective.php.

44  : array
45  {
46  return [];
47  }

◆ isNotable()

ILIAS\Setup\BuildArtifactObjective::isNotable ( )

Defaults to 'true'.

Implements ILIAS\Setup\Objective.

Definition at line 74 of file BuildArtifactObjective.php.

74  : bool
75  {
76  return true;
77  }

◆ makeDirectoryFor()

ILIAS\Setup\BuildArtifactObjective::makeDirectoryFor ( string  $path)
protected

Definition at line 99 of file BuildArtifactObjective.php.

Referenced by ILIAS\Setup\BuildArtifactObjective\achieve().

99  : void
100  {
101  $dir = pathinfo($path)["dirname"];
102  if (!file_exists($dir)) {
103  mkdir($dir, 0755, true);
104  }
105  }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: