1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Use Robo to extract zip archive

This commit is contained in:
J. King 2019-08-03 22:06:57 -04:00
parent b514ac983b
commit b3566f8d48
3 changed files with 40 additions and 99 deletions

View file

@ -208,7 +208,6 @@ 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) {
@ -244,13 +243,11 @@ class RoboFile extends \Robo\Tasks {
} else { } else {
file_put_contents($tmp."highlightjs.zip", $hljs); file_put_contents($tmp."highlightjs.zip", $hljs);
} }
$z = new \ZipArchive; $this->taskExtract($tmp."highlightjs.zip")->to($tmp."hljs")->run();
$z->open($tmp."highlightjs.zip"); $this->taskFilesystemStack()->copy($tmp."hljs/highlight.pack.js", $themeout."/highlight.pack.js")->run();
$z->extractTo($themeout, "highlight.pack.js");
}, "downloadHighlightjs"); }, "downloadHighlightjs");
} else { // copy JavaScript files from the Daux theme
$this->say("Zip extension not installed; not updating hightlight.js"); # TODO
}
// execute the collection // execute the collection
return $t->run(); return $t->run();
} }

View file

@ -5,6 +5,5 @@
"symfony/process": "^3.0" "symfony/process": "^3.0"
}, },
"require-dev": { "require-dev": {
"splitbrain/php-archive": "^1.1"
} }
} }

View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "0f7d93d4c470b72b0f6f0bc0317d603f", "content-hash": "d95cf402fed434140db8ae87c3c8bf32",
"packages": [ "packages": [
{ {
"name": "consolidation/annotated-command", "name": "consolidation/annotated-command",
@ -1734,62 +1734,7 @@
"time": "2019-04-06T14:04:46+00:00" "time": "2019-04-06T14:04:46+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [],
{
"name": "splitbrain/php-archive",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"ext-bz2": "*",
"ext-zip": "*",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8"
},
"suggest": {
"ext-iconv": "Used for proper filename encode handling",
"ext-mbstring": "Can be used alternatively for handling filename encoding"
},
"type": "library",
"autoload": {
"psr-4": {
"splitbrain\\PHPArchive\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Gohr",
"email": "andi@splitbrain.org"
}
],
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
"keywords": [
"archive",
"extract",
"tar",
"unpack",
"unzip",
"zip"
],
"time": "2018-09-09T12:13:53+00:00"
}
],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": [],