Remove pluginconfig + added application parameter 'php-censor.build.remove_builds' for control artifacts

This commit is contained in:
Dmitry Khomutov 2017-01-08 22:11:26 +07:00
parent d07e98178e
commit cad14a7377
No known key found for this signature in database
GPG Key ID: 7EB36C9576F9ECB9
4 changed files with 11 additions and 32 deletions

1
.gitignore vendored
View File

@ -2,6 +2,5 @@
/composer.phar
/runtime
/app/loggerconfig.php
/app/pluginconfig.php
/app/config.yml
/public/assets/vendor

View File

@ -24,4 +24,6 @@ php-censor:
pull_request: false
authentication_settings:
state: false
user_id: 1
user_id: 1
build:
remove_builds: true

View File

@ -1,23 +0,0 @@
<?php
return function (PHPCensor\Plugin\Util\Factory $factory) {
$factory->registerResource(
// This function will be called when the resource is needed.
function() {
return [
'Foo' => "Stuff",
'Bar' => "More Stuff"
];
},
// In addition to the function for building the resource the system
// also needs to be told when to load the resource. Either or both
// of the following arguments can be used (null to ignore)
// This resource will only be given when the argument name is:
"ResourceArray",
// The resource will only be given when the type hint is:
PHPCensor\Plugin\Util\Factory::TYPE_ARRAY
);
};

View File

@ -109,10 +109,8 @@ class Builder implements LoggerAwareInterface
$this->build = $build;
$this->store = Factory::getStore('Build', 'PHPCensor');
$this->buildLogger = new BuildLogger($logger, $build);
$pluginFactory = $this->buildPluginFactory($build);
$pluginFactory->addConfigFromFile(APP_DIR . "pluginconfig.php");
$this->buildLogger = new BuildLogger($logger, $build);
$pluginFactory = $this->buildPluginFactory($build);
$this->pluginExecutor = new Plugin\Util\Executor($pluginFactory, $this->buildLogger);
$executorClass = 'PHPCensor\Helper\UnixCommandExecutor';
@ -251,9 +249,12 @@ class Builder implements LoggerAwareInterface
$this->build->sendStatusPostback();
$this->build->setFinished(new \DateTime());
// Clean up:
$this->buildLogger->log("\n" . Lang::get('removing_build'));
$this->build->removeBuildDirectory();
$removeBuilds = (bool)Config::getInstance()->get('php-censor.build.remove_builds', true);
if ($removeBuilds) {
// Clean up:
$this->buildLogger->log("\n" . Lang::get('removing_build'));
$this->build->removeBuildDirectory();
}
$this->store->save($this->build);
}