Skip to content

Commit

Permalink
New major release!
Browse files Browse the repository at this point in the history
More documentation, more grimas, more organization!
  • Loading branch information
zemkat committed Sep 11, 2018
1 parent 5e2c8dc commit 99b6aac
Show file tree
Hide file tree
Showing 204 changed files with 8,089 additions and 894 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
grima-config.php
.bundle
.htaccess
docs/dev
dist
releases
node_modules
112 changes: 0 additions & 112 deletions Boundwith.php

This file was deleted.

59 changes: 59 additions & 0 deletions CreatePhar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
$pharFile = 'grima.phar';
$pharDir = '.';
$pharPort = 23115;

@unlink($pharFile);
ini_set("phar.readonly", 0);
$p = new Phar($pharFile);
$p->buildFromDirectory($pharDir,",(?!(?:/config(?:|/.*)|.*\.sql)),");
$p->setSignatureAlgorithm(Phar::SHA512);
$p->compressFiles(Phar::GZ);
$p->setStub('<?php
$pharFile = "' . $pharFile . '";
$pharPort = ' . $pharPort . ';
try {
if(PHP_SAPI === "cli") {
if(function_exists("pcntl_exec")) {
pcntl_exec(PHP_BINARY, array("-S","127.0.0.1:$pharPort",$argv[0]));
} else {
$cmd = PHP_BINARY . " -S 127.0.0.1:$pharPort " . escapeshellarg($argv[0]);
print("Run $cmd instead\n");
system("open http://127.0.0.1:$pharPort/index.html;exec $cmd");
}
} else {
Phar::mapPhar($pharFile);
$script = "phar://$pharFile{$_SERVER["SCRIPT_NAME"]}";
error_log($script);
if( $_SERVER["SCRIPT_NAME"] == "/" ) {
$script = "{$script}index.html";
}
if( file_exists($script) ) {
$pathinfo = pathinfo($script);
switch( $pathinfo["extension"] ) {
case "mjs":
case "js": header("Content-type: text/javascript"); break;
case "css": header("Content-type: text/css"); break;
case "html": header("Content-type: text/html"); break;
case "svg": header("Content-type: image/svg+xml"); break;
case "png": header("Content-type: image/png"); break;
case "jpeg":
case "jpg": header("Content-type: image/jpeg"); break;
case "gif": header("Content-type: image/gif"); break;
case "ttf": header("Content-type: application/font-sfnt"); break;
case "woff": header("Content-type: application/font-woff"); break;
default: error_log("Hrm, new extension: $script");
}
require( $script );
} else {
error_log("no such $script");
http_response_code(404);
}
}
} catch( Error $x ) {
error_log($x);
}
__HALT_COMPILER();');
$p = new Phar($pharFile);
$s = $p->getSignature();
echo "$pharFile successfully created\n";
Loading

0 comments on commit 99b6aac

Please sign in to comment.