|
@ -1,7 +1,6 @@ |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
use Robo\Result; |
|
|
use Robo\Result; |
|
|
use splitbrain\PHPArchive\Zip; |
|
|
|
|
|
|
|
|
|
|
|
class RoboFile extends \Robo\Tasks { |
|
|
class RoboFile extends \Robo\Tasks { |
|
|
const BASE = __DIR__.\DIRECTORY_SEPARATOR; |
|
|
const BASE = __DIR__.\DIRECTORY_SEPARATOR; |
|
@ -209,6 +208,7 @@ class RoboFile extends \Robo\Tasks { |
|
|
// compile the stylesheet |
|
|
// compile the stylesheet |
|
|
$t->taskExec($postcss)->arg($scss)->option("-o", $css); |
|
|
$t->taskExec($postcss)->arg($scss)->option("-o", $css); |
|
|
// download highlight.js |
|
|
// download highlight.js |
|
|
|
|
|
if (extension_loaded("zip")) { |
|
|
$t->addCode(function() use ($tmp, $themeout) { |
|
|
$t->addCode(function() use ($tmp, $themeout) { |
|
|
$languages = ["php", "bash", "shell", "xml", "nginx", "apache"]; |
|
|
$languages = ["php", "bash", "shell", "xml", "nginx", "apache"]; |
|
|
$post = http_build_query((function($langs) { |
|
|
$post = http_build_query((function($langs) { |
|
@ -218,7 +218,7 @@ class RoboFile extends \Robo\Tasks { |
|
|
} |
|
|
} |
|
|
return $out; |
|
|
return $out; |
|
|
})($languages)); |
|
|
})($languages)); |
|
|
$conn = fopen("https://highlightjs.org/download/", "r"); |
|
|
$conn = @fopen("https://highlightjs.org/download/", "r"); |
|
|
if ($conn === false) { |
|
|
if ($conn === false) { |
|
|
throw new Exception("Unable to download Highlight.js"); |
|
|
throw new Exception("Unable to download Highlight.js"); |
|
|
} |
|
|
} |
|
@ -230,7 +230,7 @@ class RoboFile extends \Robo\Tasks { |
|
|
$token = stream_get_contents($conn); |
|
|
$token = stream_get_contents($conn); |
|
|
preg_match("/<input type='hidden' name='csrfmiddlewaretoken' value='([^']*)'/", $token, $token); |
|
|
preg_match("/<input type='hidden' name='csrfmiddlewaretoken' value='([^']*)'/", $token, $token); |
|
|
$post = "csrfmiddlewaretoken={$token[1]}&$post"; |
|
|
$post = "csrfmiddlewaretoken={$token[1]}&$post"; |
|
|
$hljs = file_get_contents("https://highlightjs.org/download/", false, stream_context_create(['http' => [ |
|
|
$hljs = @file_get_contents("https://highlightjs.org/download/", false, stream_context_create(['http' => [ |
|
|
'method' => "POST", |
|
|
'method' => "POST", |
|
|
'content' => $post, |
|
|
'content' => $post, |
|
|
'header' => [ |
|
|
'header' => [ |
|
@ -244,10 +244,13 @@ class RoboFile extends \Robo\Tasks { |
|
|
} else { |
|
|
} else { |
|
|
file_put_contents($tmp."highlightjs.zip", $hljs); |
|
|
file_put_contents($tmp."highlightjs.zip", $hljs); |
|
|
} |
|
|
} |
|
|
$z = new Zip; |
|
|
$z = new \ZipArchive; |
|
|
$z->open($tmp."highlightjs.zip"); |
|
|
$z->open($tmp."highlightjs.zip"); |
|
|
$z->extract($themeout, "", "", "highlight.pack.js"); |
|
|
$z->extractTo($themeout, "highlight.pack.js"); |
|
|
}, "downloadHighlightjs"); |
|
|
}, "downloadHighlightjs"); |
|
|
|
|
|
} else { |
|
|
|
|
|
$this->say("Zip extension not installed; not updating hightlight.js"); |
|
|
|
|
|
} |
|
|
// execute the collection |
|
|
// execute the collection |
|
|
return $t->run(); |
|
|
return $t->run(); |
|
|
} |
|
|
} |
|
|