33
44namespace Flowpack \Prunner \Composer ;
55
6- use Composer \ Script \ Event ;
6+ use GuzzleHttp \ Client ;
77use Neos \Utility \Files ;
88use 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
0 commit comments