Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Composer fix plus ability to run the install using composer from the repository #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ vendor/
bin/box.phar
composer.lock
jupyter-php-installer.phar
jupyter-php-installer.phar.pubkey
jupyter-php-installer.phar.pubkey
/dist/
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
68 changes: 68 additions & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
@@ -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 ..
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Binary file added images/9f8869ef.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
7 changes: 5 additions & 2 deletions src/Installer/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.* '
Expand Down Expand Up @@ -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));
}
}
}