Skip to content

Commit

Permalink
JPPM 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dim-s committed May 9, 2018
1 parent 84a2576 commit ec8720e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
4 changes: 4 additions & 0 deletions packager/example/simple/package.php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ deps:
plugins:
- Doc
- Hub
- App

app:
disable-launcher: '1'
bootstrap: index.php
encoding: UTF-8
metrics: ''
trace: ''

sources:
- src

doc:
langs:
en: English
Expand Down
5 changes: 2 additions & 3 deletions packager/package.php.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: jppm
version: 0.2.5
version: 0.2.6

plugins: [GitHub, Hub, Doc]

Expand All @@ -14,8 +14,7 @@ github:
> JPHP Package Manager v%version%
**What's new**
+ Add Plugin API and plugin example.
+ Add test task.
+ Improve error handlers.
**Downloads**
+ For Windows: [JPPM Windows Installer](%github.address%/releases/download/jppm-%version%/jppm-setup-%version%.exe)
Expand Down
24 changes: 17 additions & 7 deletions packager/src-php/packager/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ public function findPackage(string $name, string $versionPattern, ?PackageLock $
$newInfo = $cached ? $this->getVersionInfoFromExternal($repo, $name, $versionPattern) : null;

if (!$newInfo) {
$newInfo = $repo->getVersions($name)[$versionPattern];
try {
$newInfo = $repo->getVersions($name)[$versionPattern];
} catch (\Throwable $e) {
Console::warn($e->getMessage());
continue;
}
}

if ($oldInfo['hash'] !== $newInfo['hash']) {
Expand Down Expand Up @@ -390,12 +395,17 @@ public function findPackage(string $name, string $versionPattern, ?PackageLock $
$dirFile = "$this->dir/$name/$foundVersion";
fs::ensureParent($archFile);

if ($foundVersionSource->downloadTo($name, $foundVersion, $archFile)) {
$this->installFromArchive($archFile);
fs::delete($archFile);
fs::format($indexFile, $foundVersionInfo, JsonProcessor::SERIALIZE_PRETTY_PRINT);
} else if ($foundVersionSource->downloadToDirectory($name, $foundVersion, $dirFile)) {
fs::format($indexFile, $foundVersionInfo, JsonProcessor::SERIALIZE_PRETTY_PRINT);
try {
if ($foundVersionSource->downloadTo($name, $foundVersion, $archFile)) {
$this->installFromArchive($archFile);
fs::delete($archFile);
fs::format($indexFile, $foundVersionInfo, JsonProcessor::SERIALIZE_PRETTY_PRINT);
} else if ($foundVersionSource->downloadToDirectory($name, $foundVersion, $dirFile)) {
fs::format($indexFile, $foundVersionInfo, JsonProcessor::SERIALIZE_PRETTY_PRINT);
}
} catch (\Throwable $e) {
Console::error($e->getMessage());
return null;
}
}

Expand Down
8 changes: 7 additions & 1 deletion packager/src-php/packager/repository/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use compress\GzipOutputStream;
use compress\TarArchive;
use git\Git;
use git\GitAPIException;
use packager\cli\Console;
use packager\Ignore;
use packager\Package;
Expand Down Expand Up @@ -180,7 +181,12 @@ protected function fetchGit()
}

$git->clean(['force' => true, 'cleanDirectories' => true]);
$git->fetch(['removeDeletedRefs' => true, 'remote' => 'origin', 'tagOpt' => 'FETCH_TAGS']);

try {
$git->fetch(['removeDeletedRefs' => true, 'remote' => 'origin', 'tagOpt' => 'FETCH_TAGS']);
} catch (GitAPIException $e) {
throw new IOException("Failed to fetch from git '{$e->getMessage()}'");
}

//

Expand Down

0 comments on commit ec8720e

Please sign in to comment.