-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from dealroadshow/configurable-objects
Configurable objects
- Loading branch information
Showing
50 changed files
with
261 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,39 @@ | ||
<?php | ||
|
||
|
||
namespace Dealroadshow\K8S\Framework\App; | ||
|
||
use Dealroadshow\K8S\Framework\Core\ManifestProcessor; | ||
use Dealroadshow\K8S\Framework\Dumper\Context\ContextInterface; | ||
use Dealroadshow\K8S\Framework\Project\ProjectInterface; | ||
use Dealroadshow\K8S\Framework\Registry\ManifestRegistry; | ||
|
||
class AppProcessor | ||
{ | ||
private ManifestRegistry $manifestRegistry; | ||
private ManifestProcessor $manifestProcessor; | ||
/** | ||
* @var ContextInterface | ||
*/ | ||
private ContextInterface $context; | ||
public function __construct( | ||
private ManifestRegistry $manifestRegistry, | ||
private ManifestProcessor $manifestProcessor, | ||
private ContextInterface $context | ||
) { | ||
} | ||
|
||
public function __construct(ManifestRegistry $manifestRegistry, ManifestProcessor $manifestProcessor, ContextInterface $context) | ||
public function processAll(AppInterface ...$apps): void | ||
{ | ||
$this->manifestRegistry = $manifestRegistry; | ||
$this->manifestProcessor = $manifestProcessor; | ||
$this->context = $context; | ||
foreach ($apps as $app) { | ||
$this->process($app); | ||
} | ||
} | ||
|
||
public function process(AppInterface $app, ProjectInterface $project): void | ||
public function process(AppInterface $app): void | ||
{ | ||
$app->setProject($project); | ||
$query = $this->manifestRegistry->query(); | ||
$query->app($app); | ||
if($tags = $this->context->includeTags()) { | ||
if ($tags = $this->context->includeTags()) { | ||
$query->includeTags($tags); | ||
} | ||
if($tags = $this->context->excludeTags()) { | ||
if ($tags = $this->context->excludeTags()) { | ||
$query->excludeTags($tags); | ||
} | ||
foreach ($query->execute() as $manifest) { | ||
$this->manifestProcessor->process($manifest, $app); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Dealroadshow\K8S\Framework\Config; | ||
|
||
interface ConfigAwareInterface | ||
{ | ||
public function setConfig(array $config): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Dealroadshow\K8S\Framework\Config; | ||
|
||
trait ConfigAwareTrait | ||
{ | ||
protected array $config = []; | ||
|
||
public function setConfig(array $config): void | ||
{ | ||
$this->config = $config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Dealroadshow\K8S\Framework\Config; | ||
|
||
interface ConfigProviderInterface | ||
{ | ||
public function config(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Dealroadshow\K8S\Framework\Config; | ||
|
||
interface ConfigurableInterface extends ConfigAwareInterface, ConfigProviderInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Dealroadshow\K8S\Framework\Core; | ||
|
||
use Dealroadshow\K8S\Framework\App\AppInterface; | ||
use Dealroadshow\K8S\Framework\Config\ConfigAwareTrait; | ||
|
||
abstract class AbstractManifest implements ManifestInterface | ||
{ | ||
use ConfigAwareTrait; | ||
|
||
protected AppInterface $app; | ||
|
||
public function metadata(MetadataConfigurator $meta): void | ||
{ | ||
} | ||
|
||
public function setApp(AppInterface $app): void | ||
{ | ||
$this->app = $app; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.