diff --git a/.gitignore b/.gitignore index 749f654..a68dafa 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ vendor/ bin/box.phar composer.lock jupyter-php-installer.phar -jupyter-php-installer.phar.pubkey \ No newline at end of file +jupyter-php-installer.phar.pubkey +/dist/ diff --git a/README.md b/README.md index 92d87f7..3bb1a5c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,33 @@ Go to the [main page](https://litipk.github.io/Jupyter-PHP-Installer/) and follo * First of all, you can take a look on the [bugtracker](https://github.com/Litipk/Jupyter-PHP-Installer/issues) and decide if there is something that you want to do :wink: . If you think there are missing improvements in this file, then you are invited to modify the TODO list. * You can also send us bug reports using the same bugtracker. * If you are really interested on helping to improve Litipk\BigNumbers, we recommend to read the [contributing guidelines](https://github.com/Litipk/Jupyter-PHP-Installer/blob/master/CONTRIBUTING.md). + +## Addendum +If you just want to run the installer from this repository without building a phar file you can do the following: + +```bash +composer install +composer execute install +``` + +To create an installer that works with the latest composer, you can run. Unfortunately this will need to be modified to work for Windows. + +```bash +chmod +x bin/build.sh && bin/build.sh +``` + +The other important thing is to make sure you have the ZeroMQ extension installed or you will hit problems. The Jupyter notebook needs it for communicating with the language engine. + +[Installing ZeroMQ](https://gist.github.com/qutek/42889d82a4cbebf0e801943a9addbbab) + +And finally after you have your successful install + +```bash +jupyter notebook +``` + +![](images/9f8869ef.png) ## License diff --git a/bin/build.sh b/bin/build.sh new file mode 100755 index 0000000..8b2f06e --- /dev/null +++ b/bin/build.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +echo "Starting build"; + +# We only generate packages for tagged versions +git describe --tags --exact-match HEAD || { + echo "Skipped build"; + exit 0; +} + +if ! command -v openssl &> /dev/null +then + echo "openssl could not be found, please install it" + exit +fi + +openssl genrsa -out .travis/phar_private.key 1024 + +#check for wget +if ! command -v wget &> /dev/null +then + echo "wget could not be found, please install it" + exit +fi + +if ! command -v ./bin/box.phar &> /dev/null +then + # Get Box and build + echo "getting the box builder" + wget https://github.com/box-project/box2/releases/download/2.7.0/box-2.7.0.phar -O ./bin/box.phar + chmod a+x ./bin/box.phar +fi + +# Unsigned build +php -d phar.readonly=0 ./bin/box.phar build -vv +mv jupyter-php-installer.phar jupyter-php-installer.phar.tmp + +# Signed build +php -d phar.readonly=0 ./bin/box.phar build -c box.signed.json -vv +mv jupyter-php-installer.phar jupyter-php-installer.signed.phar.tmp +mv jupyter-php-installer.phar.pubkey jupyter-php-installer.signed.phar.pubkey.tmp + +mkdir -p dist + +if ! command -v md5sum &> /dev/null +then + echo "md5sum could not be found, please install it (md5sha1sum)" + exit +fi + +if ! command -v md5sum &> /dev/null +then + echo "sha1sum could not be found, please install it (sha2)" + exit +fi + +# Moving unsigned build +mv jupyter-php-installer.phar.tmp dist/jupyter-php-installer.phar +cd dist && md5sum jupyter-php-installer.phar > jupyter-php-installer.phar.md5 && cd .. +cd dist && sha1sum jupyter-php-installer.phar > jupyter-php-installer.phar.sha1 && cd .. + +# Moving signed build +mv jupyter-php-installer.signed.phar.tmp dist/jupyter-php-installer.signed.phar +mv jupyter-php-installer.signed.phar.pubkey.tmp dist/jupyter-php-installer.signed.phar.pubkey +cd dist && md5sum jupyter-php-installer.signed.phar > jupyter-php-installer.signed.phar.md5 && cd .. +cd dist && sha1sum jupyter-php-installer.signed.phar > jupyter-php-installer.signed.phar.sha1 && cd .. +cd dist && md5sum jupyter-php-installer.signed.phar.pubkey > jupyter-php-installer.signed.phar.pubkey.md5 && cd .. +cd dist && sha1sum jupyter-php-installer.signed.phar.pubkey > jupyter-php-installer.signed.phar.pubkey.sha1 && cd .. \ No newline at end of file diff --git a/composer.json b/composer.json index d9ddd6b..483286e 100644 --- a/composer.json +++ b/composer.json @@ -9,12 +9,13 @@ "seld/cli-prompt": "^1.0" }, "require-dev": { + "roave/security-advisories": "dev-latest", "phpunit/phpunit": "^6.1" }, "autoload": { "psr-4": { "Litipk\\JupyterPhpInstaller\\": "src/"} }, "scripts": { - + "execute": "@php src/EntryPoint/main.php" } } diff --git a/images/9f8869ef.png b/images/9f8869ef.png new file mode 100644 index 0000000..698ca91 Binary files /dev/null and b/images/9f8869ef.png differ diff --git a/src/Console/Application.php b/src/Console/Application.php index 863da85..f95da12 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -54,6 +54,7 @@ public function __construct() * @param InputInterface|null $input * @param OutputInterface|null $output * @return int + * @throws \Exception */ public function run(InputInterface $input = null, OutputInterface $output = null) { @@ -76,6 +77,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null * @param InputInterface $input * @param OutputInterface $output * @return int + * @throws \Throwable */ public function doRun(InputInterface $input, OutputInterface $output) { diff --git a/src/Installer/Installer.php b/src/Installer/Installer.php index 839d2fa..6bd64b6 100644 --- a/src/Installer/Installer.php +++ b/src/Installer/Installer.php @@ -143,7 +143,7 @@ private function getComposerInitCommand(string $pkgsDir, bool $silent = false): $cmd = ( $this->composerCmd . ' init ' . ' --no-interaction ' . - ' --name=jupyter-php-instance ' . + ' --name=jupyter_php_instance ' . ' --type=project ' . ' --working-dir="' . $pkgsDir . '" ' . ' --require=litipk/jupyter-php=0.* ' @@ -189,6 +189,9 @@ protected function preparePackagesDir(string $pkgsDir) } rmdir($pkgsDir); } - mkdir($pkgsDir); + + if (!mkdir($pkgsDir) && !is_dir($pkgsDir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $pkgsDir)); + } } }