Skip to content

Commit

Permalink
show install and composer version
Browse files Browse the repository at this point in the history
  • Loading branch information
cjzamora committed Apr 19, 2018
1 parent eda2571 commit 57ac351
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
// get the package config
$config = $this->package('global')->config('packages');

// load composer lock
$composerLock = json_decode(
file_get_contents(
$this->package('global')->path('root') . '/composer.lock'
),
true
);

// available composer packages
$composerPackages = [];

// iterate on each package on lock file
foreach($composerLock['packages'] as $composerPackage) {
// get the composer package name and version
$composerPackages[$composerPackage['name']] = $composerPackage['version'];
}

// set package list action
$request->setStage(0, 'list');
// we just only need the data
Expand Down Expand Up @@ -114,6 +131,13 @@
unset($composer['type']);
}

// get composer installed version
$packages[$key]['composer_version'] = null;

if (isset($composerPackages[$key])) {
$packages[$key]['composer_version'] = $composerPackages[$key];
}

// merge composer data
$packages[$key] = array_merge($packages[$key], $composer);
}
Expand Down
10 changes: 9 additions & 1 deletion src/template/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ <h3 class="main-title">
<tr>
<th>Actions</th>
<th>Name</th>
<th>Version</th>
<th>Install Version</th>
<th>Composer Version</th>
<th>Type</th>
<th>Last Status</th>
</tr>
Expand Down Expand Up @@ -120,6 +121,13 @@ <h3 class="main-title">
Not Available
{{/if}}
</td>
<td>
{{#if composer_version}}
{{composer_version}}
{{else}}
Not Available
{{/if}}
</td>
<td>
<span
{{#when type '===' 'root'}}
Expand Down

0 comments on commit 57ac351

Please sign in to comment.