Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/dev-#2773' into dev-baserproject…
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiem-mb committed Nov 21, 2023
2 parents e420577 + f33c4ad commit 7c524f4
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions plugins/baser-core/src/Command/CreateReleaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace BaserCore\Command;

use BaserCore\Utility\BcFile;
use BaserCore\Utility\BcFolder;
use Cake\Command\Command;
use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Core\Configure;
use Cake\Filesystem\File;
use Cake\Filesystem\Folder;
use Composer\Package\Archiver\ZipArchiver;
use BaserCore\Annotation\UnitTest;
use BaserCore\Annotation\NoTodo;
Expand Down Expand Up @@ -59,8 +59,7 @@ public function execute(Arguments $args, ConsoleIo $io)
{
$packagePath = TMP . 'basercms' . DS;
if(is_dir($packagePath)) {
$folder = new Folder($packagePath);
$folder->delete();
(new BcFolder($packagePath))->delete();
}

$io->out(__d('baser_core', 'リリースパッケージを作成します。', TMP));
Expand All @@ -82,8 +81,7 @@ public function execute(Arguments $args, ConsoleIo $io)
$this->createZip($packagePath);

$io->out(__d('baser_core', '- クリーニング処理を実行します。'));
$folder = new Folder($packagePath);
$folder->delete();
(new BcFolder($packagePath))->delete();

$io->out();
$io->out(__d('baser_core', 'リリースパッケージの作成が完了しました。/tmp/basercms.zip を確認してください。'));
Expand All @@ -99,7 +97,7 @@ public function execute(Arguments $args, ConsoleIo $io)
public function setupComposer(string $packagePath)
{
$composer = $packagePath . 'composer.json';
$file = new File($composer);
$file = new BcFile($composer);
$data = $file->read();
$regex = '/^(.+?) "replace": {.+?},\n(.+?)/s';
$data = preg_replace($regex, "$1$2", $data);
Expand Down Expand Up @@ -136,13 +134,12 @@ public function clonePackage(string $packagePath, string $branch)
public function deletePlugins(string $packagePath)
{
$excludes = ['BcThemeSample', 'BcPluginSample'];
$folder = new Folder($packagePath . 'plugins');
$files = $folder->read(true, true, true);
foreach($files[0] as $path) {
$folder = new BcFolder($packagePath . 'plugins');
$files = $folder->getFolders(['full'=>true]);
foreach($files as $path) {
if(in_array(basename($path), $excludes)) continue;
$folder->delete($path);
(new BcFolder($path))->delete();
}
new File($packagePath . 'plugins' . DS . '.gitkeep');
}

/**
Expand Down Expand Up @@ -175,9 +172,9 @@ public function deleteExcludeFiles(string $packagePath)
foreach($excludeFiles as $file) {
$file = $packagePath . $file;
if(is_dir($file)) {
(new Folder($file))->delete();
(new BcFolder($file))->delete();
} elseif(file_exists($file)) {
(new File($file))->delete();
(new BcFile($file))->delete();
}
}
}
Expand Down

0 comments on commit 7c524f4

Please sign in to comment.