Improved Pdepend plugin. Issue #107.
This commit is contained in:
parent
4956775121
commit
cf7fb7a551
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@
|
||||||
/runtime
|
/runtime
|
||||||
/app/config.yml
|
/app/config.yml
|
||||||
/public/assets/vendor
|
/public/assets/vendor
|
||||||
|
/public/artifacts
|
||||||
|
!/public/artifacts/.gitkeep
|
||||||
|
|
0
public/artifacts/.gitkeep
Normal file
0
public/artifacts/.gitkeep
Normal file
|
@ -8,13 +8,18 @@ use PHPCensor\Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pdepend Plugin - Allows Pdepend report
|
* Pdepend Plugin - Allows Pdepend report
|
||||||
*
|
*
|
||||||
* @author Johan van der Heide <info@japaveh.nl>
|
* @author Johan van der Heide <info@japaveh.nl>
|
||||||
*/
|
*/
|
||||||
class Pdepend extends Plugin
|
class Pdepend extends Plugin
|
||||||
{
|
{
|
||||||
protected $args;
|
protected $args;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $buildDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Directory which needs to be scanned
|
* @var string Directory which needs to be scanned
|
||||||
*/
|
*/
|
||||||
|
@ -56,13 +61,16 @@ class Pdepend extends Plugin
|
||||||
{
|
{
|
||||||
parent::__construct($builder, $build, $options);
|
parent::__construct($builder, $build, $options);
|
||||||
|
|
||||||
$this->directory = isset($options['directory']) ? $options['directory'] : $this->builder->buildPath;
|
$this->directory = isset($options['directory'])
|
||||||
|
? $options['directory']
|
||||||
|
: $this->builder->buildPath;
|
||||||
|
|
||||||
$title = $this->builder->getBuildProjectTitle();
|
$this->summary = 'summary.xml';
|
||||||
$this->summary = $title . '-summary.xml';
|
$this->pyramid = 'pyramid.svg';
|
||||||
$this->pyramid = $title . '-pyramid.svg';
|
$this->chart = 'chart.svg';
|
||||||
$this->chart = $title . '-chart.svg';
|
|
||||||
$this->location = $this->builder->buildPath . '..' . DIRECTORY_SEPARATOR . 'pdepend';
|
$this->buildDirectory = $build->getProjectId() . '/' . $build->getId();
|
||||||
|
$this->location = PUBLIC_DIR . 'artifacts/pdepend/' . $this->buildDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +79,7 @@ class Pdepend extends Plugin
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
if (!file_exists($this->location)) {
|
if (!file_exists($this->location)) {
|
||||||
mkdir($this->location);
|
mkdir($this->location, 0777, true);
|
||||||
}
|
}
|
||||||
if (!is_writable($this->location)) {
|
if (!is_writable($this->location)) {
|
||||||
throw new \Exception(sprintf('The location %s is not writable or does not exist.', $this->location));
|
throw new \Exception(sprintf('The location %s is not writable or does not exist.', $this->location));
|
||||||
|
@ -104,12 +112,10 @@ class Pdepend extends Plugin
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->builder->logSuccess(
|
$this->builder->logSuccess(
|
||||||
sprintf(
|
sprintf(
|
||||||
"Pdepend successful. You can use %s\n, ![Chart](%s \"Pdepend Chart\")\n
|
"\nPdepend successful.\nYou can use: %s,\n![Chart](%s \"Pdepend Chart\") and\n![Pyramid](%s \"Pdepend Pyramid\")\nfor inclusion in the readme.md file",
|
||||||
and ![Pyramid](%s \"Pdepend Pyramid\")\n
|
$config['url'] . '/artifacts/pdepend/' . $this->buildDirectory . '/' . $this->summary,
|
||||||
for inclusion in the readme.md file",
|
$config['url'] . '/artifacts/pdepend/' . $this->buildDirectory . '/' . $this->chart,
|
||||||
$config['url'] . '/build/pdepend/' . $this->summary,
|
$config['url'] . '/artifacts/pdepend/' . $this->buildDirectory . '/' . $this->pyramid
|
||||||
$config['url'] . '/build/pdepend/' . $this->chart,
|
|
||||||
$config['url'] . '/build/pdepend/' . $this->pyramid
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue