ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Setup\Artifact\BuildArtifactObjective Class Reference

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

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

Public Member Functions

 getArtifactPath ()
 Get the filename where the builder wants to put its artifact. More...
 
 build ()
 Build the artifact based. More...
 
 buildIn (Setup\Environment $env)
 Builds an artifact in some given Environment. More...
 
 getPreconditions (Setup\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 (Setup\Environment $environment)
 Builds the artifact and puts it in its location. More...
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Protected Member Functions

 makeDirectoryFor (string $path)
 

Detailed Description

This is an objective to build some artifact.

Definition at line 13 of file BuildArtifactObjective.php.

Member Function Documentation

◆ achieve()

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

Builds the artifact and puts it in its location.

Definition at line 86 of file BuildArtifactObjective.php.

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

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

◆ build()

ILIAS\Setup\Artifact\BuildArtifactObjective::build ( )
abstract

Build the artifact based.

If you want to use the environment reimplement buildIn instead.

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

+ Here is the caller graph for this function:

◆ buildIn()

ILIAS\Setup\Artifact\BuildArtifactObjective::buildIn ( Setup\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 36 of file BuildArtifactObjective.php.

References ILIAS\Setup\Artifact\BuildArtifactObjective\build().

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

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

◆ getArtifactPath()

ILIAS\Setup\Artifact\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\Artifact\BuildArtifactObjective\achieve(), ILIAS\Setup\Artifact\BuildArtifactObjective\getHash(), and ILIAS\Setup\Artifact\BuildArtifactObjective\getLabel().

+ Here is the caller graph for this function:

◆ getHash()

ILIAS\Setup\Artifact\BuildArtifactObjective::getHash ( )

Uses hashed Path.

Implements ILIAS\Setup\Objective.

Definition at line 56 of file BuildArtifactObjective.php.

References ILIAS\Setup\Artifact\BuildArtifactObjective\getArtifactPath().

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

◆ getLabel()

ILIAS\Setup\Artifact\BuildArtifactObjective::getLabel ( )

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

Implements ILIAS\Setup\Objective.

Definition at line 66 of file BuildArtifactObjective.php.

References ILIAS\Setup\Artifact\BuildArtifactObjective\getArtifactPath().

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

◆ getPreconditions()

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

Defaults to no preconditions.

Definition at line 46 of file BuildArtifactObjective.php.

46  : array
47  {
48  return [];
49  }

◆ isApplicable()

ILIAS\Setup\Artifact\BuildArtifactObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 101 of file BuildArtifactObjective.php.

101  : bool
102  {
103  return true;
104  }

◆ isNotable()

ILIAS\Setup\Artifact\BuildArtifactObjective::isNotable ( )

Defaults to 'true'.

Implements ILIAS\Setup\Objective.

Definition at line 76 of file BuildArtifactObjective.php.

76  : bool
77  {
78  return true;
79  }

◆ makeDirectoryFor()

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

Definition at line 106 of file BuildArtifactObjective.php.

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

106  : void
107  {
108  $dir = pathinfo($path)["dirname"];
109  if (!file_exists($dir)) {
110  mkdir($dir, 0755, true);
111  }
112  }
+ Here is the caller graph for this function:

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