-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ | |
/.reaol | ||
/storage/* | ||
/builds/logs | ||
/packagers | ||
.phpunit.result.cache | ||
/database/database.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Commands; | ||
|
||
use Illuminate\Support\Facades\Process; | ||
use LaravelZero\Framework\Commands\Command; | ||
|
||
class Package extends Command | ||
{ | ||
protected $signature = 'package'; | ||
|
||
protected $description = 'Bundle PHP with release for each operating system.'; | ||
|
||
protected array $packagers = [ | ||
'macos' => '/packagers/macos-micro-cli.sfx', | ||
'linux' => '/packagers/linux-micro-cli.sfx', | ||
]; | ||
|
||
public function handle() | ||
{ | ||
$build = base_path().'/builds/p3ol'; | ||
|
||
collect($this->packagers)->each(function (string $packager, string $os) use ($build) { | ||
Process::run('cat '.base_path().$packager.' '.$build.' > '.base_path().'/builds/'.$os.'/p3ol'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Updaters; | ||
|
||
use LaravelZero\Framework\Components\Updater\Strategy\StrategyInterface; | ||
use Phar; | ||
|
||
class GithubStrategy extends \Humbug\SelfUpdate\Strategy\GithubStrategy implements StrategyInterface | ||
{ | ||
protected function getDownloadUrl(array $package): string | ||
{ | ||
$downloadUrl = parent::getDownloadUrl($package); | ||
|
||
$downloadUrl = str_replace('releases/download', 'raw', $downloadUrl); | ||
|
||
$os = match (true) { | ||
str_contains(php_uname(), 'Darwin') => 'macos', | ||
default => 'linux' | ||
}; | ||
|
||
return $downloadUrl.'/builds/'.$os.'/'.basename(Phar::running()); | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
use App\Updaters\GithubStrategy; | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Self-updater Strategy | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may specify which update strategy class you wish to use when | ||
| updating your application via the "self-update" command. This must | ||
| be a class that implements the StrategyInterface from Humbug. | ||
| | ||
*/ | ||
|
||
'strategy' => GithubStrategy::class, | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
link="https://github.com/p3/p3ol-cli/raw/main/builds/macos/p3ol" | ||
curl --fail -OL "$link" | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
chmod 744 p3ol |