update plugin controller to display plugin information as well as composer package information.

This commit is contained in:
meadsteve 2013-12-29 17:35:33 +00:00
commit 4b9207e05f
2 changed files with 38 additions and 9 deletions

View file

@ -11,6 +11,7 @@ namespace PHPCI\Controller;
use b8;
use PHPCI\Model\Build;
use PHPCI\Plugin\Util\LoadedPluginInformation;
/**
* Plugin Controller - Provides support for installing Composer packages.
@ -59,8 +60,13 @@ class PluginController extends \PHPCI\Controller
$this->view->required = $this->required;
$json = $this->getComposerJson();
$this->view->installed = $json['require'];
$this->view->suggested = $json['suggest'];
$this->view->installedPackages = $json['require'];
$this->view->suggestedPackages = $json['suggest'];
$pluginInfo = LoadedPluginInformation::buildFromYaml(
PHPCI_DIR . "vendor/composer/installed.json"
);
$this->view->plugins = $pluginInfo->getInstalledPlugins();
return $this->view->render();
}

View file

@ -1,4 +1,4 @@
<h1 id="title">Plugins</h1>
<h1 id="title">Packages and Provided Plugins</h1>
<?php if (!$canInstall): ?>
<p class="alert alert-danger">PHPCI cannot automatically install/remove plugins for you, as either the <strong>shell_exec()</strong>
function is disabled or PHPCI could not find Composer. PHPCI will update composer.json for you, but you will need to run Composer manually to make the changes.</p>
@ -21,7 +21,30 @@
<?php endif; ?>
<div class="box">
<h3 class="title">Installed Plugins</h3>
<h3 class="title">Available Plugins</h3>
<table class="table-striped table-bordered table">
<thead>
<tr>
<th>Name</th>
<th>Class</th>
<th>Provided by Package</th>
</tr>
</thead>
<tbody>
<?php foreach ($plugins as $plugin): ?>
<tr>
<td><?= $plugin->name; ?></td>
<td><?= $plugin->class; ?></td>
<td><?= $plugin->source; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="box">
<h3 class="title">Installed Packages</h3>
<table class="table-striped table-bordered table">
<thead>
@ -32,7 +55,7 @@
</tr>
</thead>
<tbody>
<?php foreach ($installed as $package => $version): ?>
<?php foreach ($installedPackages as $package => $version): ?>
<tr>
<td><?= $package; ?></td>
<td><?= $version; ?></td>
@ -48,7 +71,7 @@
</div>
<div class="box">
<h3 class="title">Suggested Plugins</h3>
<h3 class="title">Suggested Packages</h3>
<table class="table-striped table-bordered table">
<thead>
@ -59,8 +82,8 @@
</tr>
</thead>
<tbody>
<?php foreach ($suggested as $package => $version): ?>
<?php if (in_array($package, array_keys($installed))) { continue; } ?>
<?php foreach ($suggestedPackages as $package => $version): ?>
<?php if (in_array($package, array_keys($installedPackages))) { continue; } ?>
<tr>
<td><?= $package; ?></td>
<td><?= $version; ?></td>
@ -76,7 +99,7 @@
</div>
<div class="box">
<h3 class="title">Search Packagist for More Plugins</h3>
<h3 class="title">Search Packagist for More Packages</h3>
<div class="input-group">
<input id="search-query" type="text" class="form-control">