Skip to content

Commit 55e1b42

Browse files
committed
v2.0.1
- dont show the no log msg for install or uninstall
1 parent 753dc96 commit 55e1b42

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

src/Commands/PostInstall.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PostInstall extends Command
99
{
1010
use Messages;
1111

12-
protected $signature = 'pcl:post-install';
12+
protected $signature = 'pcl:post-install';
1313
protected $description = 'package-changelog post-install';
1414

1515
/**
@@ -19,6 +19,6 @@ class PostInstall extends Command
1919
*/
2020
public function handle()
2121
{
22-
return $this->buildLogs('install');
22+
return $this->buildLogs('install', false);
2323
}
2424
}

src/Commands/PostUpdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PostUpdate extends Command
99
{
1010
use Messages;
1111

12-
protected $signature = 'pcl:post-update';
12+
protected $signature = 'pcl:post-update';
1313
protected $description = 'package-changelog post-update';
1414

1515
/**

src/Commands/PreUninstall.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PreUninstall extends Command
99
{
1010
use Messages;
1111

12-
protected $signature = 'pcl:pre-uninstall';
12+
protected $signature = 'pcl:pre-uninstall';
1313
protected $description = 'package-changelog pre-uninstall';
1414

1515
/**
@@ -19,6 +19,6 @@ class PreUninstall extends Command
1919
*/
2020
public function handle()
2121
{
22-
return $this->buildLogs('uninstall');
22+
return $this->buildLogs('uninstall', false);
2323
}
2424
}

src/Traits/Messages.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ trait Messages
99
*
1010
* @param mixed $event
1111
* @param mixed $type
12+
* @param mixed $showEmptyLog
1213
*
1314
* @return [type] [description]
1415
*/
15-
public function buildLogs($type = null)
16+
public function buildLogs($type = null, $showEmptyLog = true)
1617
{
17-
$vendorPath = base_path('vendor');
18-
$refPath = '/composer/installed.json';
19-
$packages = [];
18+
$vendorPath = \base_path('vendor');
19+
$refPath = '/composer/installed.json';
20+
$packages = [];
2021

2122
if (file_exists($path = "{$vendorPath}{$refPath}")) {
2223
$installed = json_decode(file_get_contents($path), true);
@@ -28,19 +29,19 @@ public function buildLogs($type = null)
2829

2930
foreach ($packages as $one) {
3031
if (isset($one['extra']['changeLog'])) {
31-
$name = $this->format($vendorPath, $one['name']);
32-
$log_path = $one['extra']['changeLog'];
33-
$version = $one['version'];
32+
$name = $this->format($vendorPath, $one['name']);
33+
$log_path = $one['extra']['changeLog'];
34+
$version = $one['version'];
3435
$package_path = "$vendorPath/{$name}";
35-
$log_file = $type
36-
? glob("$package_path/$log_path/$type.*")
37-
: glob("$package_path/$log_path/$version.*");
36+
$log_file = $type
37+
? glob("$package_path/$log_path/$type.*")
38+
: glob("$package_path/$log_path/$version.*");
3839

3940
if (!$log_file) {
4041
continue;
4142
}
4243

43-
$no_log = false;
44+
$no_log = false;
4445
$log_content = file_get_contents($log_file[0]);
4546

4647
$this->header("\"$name\" {$version} ChangeLog:");
@@ -51,7 +52,7 @@ public function buildLogs($type = null)
5152
}
5253
}
5354

54-
if ($no_log) {
55+
if ($no_log && $showEmptyLog) {
5556
$this->header('No Available ChangeLogs At The Moment');
5657
}
5758

0 commit comments

Comments
 (0)