Permalink
Browse files

Add --delete argument to install-jsdeps.sh

  • Loading branch information...
1 parent c761f5b commit 3679cb7c34ec93d5e68c880488e6185c3bd8da55 @alecpl alecpl committed Dec 30, 2016
Showing with 25 additions and 1 deletion.
  1. +24 −1 bin/install-jsdeps.sh
  2. +1 −0 jsdeps.json
View
@@ -254,10 +254,28 @@ function extract_zipfile($package, $srcfile)
}
}
+/**
+ * Delete the package destination file/dir
+ */
+function delete_destfile($package)
+{
+ $destdir = INSTALL_PATH . ($package['rm'] ?: $package['dest']);
+
+ if (file_exists($destdir)) {
+ if (PHP_OS === 'Windows') {
+ exec(sprintf("rd /s /q %s", escapeshellarg($destdir)));
+ }
+ else {
+ exec(sprintf("rm -rf %s", escapeshellarg($destdir)));
+ }
+ }
+}
+
//////////////// Execution
-$args = rcube_utils::get_opt(array('f' => 'force:bool')) + array('force' => false);
+$args = rcube_utils::get_opt(array('f' => 'force:bool', 'd' => 'delete:bool'))
+ + array('force' => false, 'delete' => false);
$WHAT = $args[0];
foreach ($SOURCES['dependencies'] as $package) {
@@ -269,6 +287,11 @@ foreach ($SOURCES['dependencies'] as $package) {
continue;
}
+ if ($args['delete']) {
+ delete_destfile($package);
+ continue;
+ }
+
echo "Installing $package[name]...\n";
$srcfile = fetch_from_source($package, !$args['force'], $filetype);
View
@@ -41,6 +41,7 @@
"sha1": "e358301ac9fefafcd0ee21643c6aaed2c8b83470",
"license": "LGPL",
"copyright": "Copyright (c) 1999-2015 Ephox Corp. All rights reserved",
+ "rm": "program/js/tinymce",
"map": {
"tinymce/js/tinymce": "tinymce"
},

0 comments on commit 3679cb7

Please sign in to comment.