Skip to content

Commit 00f477f

Browse files
committed
Merge branch 'Pingu501-ah/bugfix/use-guzzle-for-downloads'
2 parents a7884aa + 1bbdb50 commit 00f477f

4 files changed

Lines changed: 14 additions & 73 deletions

File tree

Classes/Command/PrunnerCommandController.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

Classes/Composer/InstallerScripts.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Flowpack\Prunner\Composer;
55

6-
use Composer\Script\Event;
6+
use GuzzleHttp\Client;
77
use Neos\Utility\Files;
88
use PharData;
99

@@ -45,12 +45,13 @@ class InstallerScripts
4545

4646
const DEFAULT_VERSION_TO_INSTALL = '0.8.1';
4747

48-
public static function postUpdateAndInstall(Event $event)
48+
public static function postUpdateAndInstall()
4949
{
5050
$platform = php_uname('s'); // stuff like Darwin etc
5151
$architecture = php_uname('m'); // x86_64
5252

53-
$extra = $event->getComposer()->getPackage()->getExtra();
53+
$composerJson = json_decode(file_get_contents('composer.json'), true);
54+
$extra = isset($composerJson['extra']) ? $composerJson['extra'] : [];
5455
$version = self::DEFAULT_VERSION_TO_INSTALL;
5556
$versionMessage = '';
5657
if (isset($extra['prunner-version'])) {
@@ -71,11 +72,12 @@ public static function postUpdateAndInstall(Event $event)
7172
echo '> Version: ' . $version . $versionMessage . "\n";
7273
echo '> Platform: ' . $platform . "\n";
7374
echo '> Architecture: ' . $architecture . "\n";
74-
$downloadLink = sprintf('https://github.com/Flowpack/prunner/releases/download/v%s/prunner_%s_%s_%s.tar.gz', $version, $version, $platform, $architecture);
75-
$downloadedFileContents = file_get_contents($downloadLink);
75+
76+
$downloadLink = sprintf('https://github.com/Flowpack/prunner/releases/download/v%1$s/prunner_%1$s_%2$s_%3$s.tar.gz', $version, $platform, $architecture);
77+
$httpClient = new Client();
78+
$httpClient->get($downloadLink, ['sink' => 'Data/Temporary/prunner.tar.gz']);
7679
echo '> Download complete.' . "\n";
7780

78-
file_put_contents('Data/Temporary/prunner.tar.gz', $downloadedFileContents);
7981
Files::unlink('Data/Temporary/prunner.tar');
8082

8183
// decompress from gz

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,7 @@ A Neos/Flow PHP package providing a backend module for the current pipeline stat
2222
## Installation
2323

2424
```bash
25-
# add the package
2625
composer require flowpack/prunner
27-
28-
# patch main composer.json to add Flowpack\Prunner\Composer\InstallerScripts::postUpdateAndInstall to post-install-cmd and post-update-cmd
29-
./flow prunner:setupProject
30-
31-
# run composer install again, to download prunner.
32-
composer install
33-
34-
# prunner is now installed in your project root, as "prunner/prunner"
3526
```
3627

3728
Now, start up prunner via the following command:
@@ -40,7 +31,7 @@ Now, start up prunner via the following command:
4031
prunner/prunner --path Packages --data Data/Persistent/prunner
4132
```
4233

43-
This will parse all packages for `pipelines.yml` files.
34+
This will parse all packages for `pipelines.yml` files.
4435

4536
## Overriding the Prunner Version
4637

@@ -65,7 +56,7 @@ Then, copy the `index.js` and `index.css` files to this package:
6556
```bash
6657
export PRUNNERUI=/path/to/prunner-ui
6758
cp $PRUNNERUI/build/dist/index.js* Resources/Public/prunner-ui/
68-
cp $PRUNNERUI/build/index.css Resources/Public/prunner-ui/index.css
59+
cp $PRUNNERUI/build/index.css Resources/Public/prunner-ui/index.css
6960
```
7061

7162
## License

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"extra": {
2121
"neos": {
2222
"package-key": "Flowpack.Prunner"
23+
},
24+
"neos/flow": {
25+
"post-install": "Flowpack\\Prunner\\Composer\\InstallerScripts::postUpdateAndInstall",
26+
"post-update": "Flowpack\\Prunner\\Composer\\InstallerScripts::postUpdateAndInstall"
2327
}
2428
}
2529
}

0 commit comments

Comments
 (0)