From 9f4b3867250cac6fd75cc3e410fbff58f817cf8f Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 3 Mar 2012 21:09:14 +0100 Subject: Initial commit. --- r7r-plugin-packer.php | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 r7r-plugin-packer.php (limited to 'r7r-plugin-packer.php') diff --git a/r7r-plugin-packer.php b/r7r-plugin-packer.php new file mode 100755 index 0000000..6baef7a --- /dev/null +++ b/r7r-plugin-packer.php @@ -0,0 +1,101 @@ +#!/usr/bin/env php +). + --versiontext=VER A short text, that describes this version (something like: 1.0 beta). + --versioncount=C A number that increases with every release. + --api=APIVER The version number of the plugin API. + --shortdesc=DESC A short description of your plugin. You can use #hashtags. + +Optional options: + --updatepath=URL A URL where Ratatöskr can check, if there is a new version (URL should point to a serialize()'d array("current-version" => VERSIONCOUNT, "dl-path" => DOWNLOAD PATH); Will get overwritten by the default repository software). + --web=HOMEPAGE Homepage of the Plugin. + --licensefile=FILE Should a license be included? + --helpfile=FILE A HTML file that acts as a help/manual for your plugin. + --custompub=DIR Directory that contains custom public(i.e. can later be accessed from the web) data. + --custompriv=DIR Directory that contains custom private data. + --tpldir=DIR Directory that contains templates used by this plugin. +USAGE +; + +if(!(isset($options["output"]) and isset($options["codefile"]) and isset($options["classname"]) and isset($options["pluginname"]) and isset($options["author"]) and isset($options["versiontext"]) and isset($options["versioncount"]) and isset($options["api"]) and isset($options["shortdesc"]))) +{ + fprintf(STDERR, "Missing options\n\n" . $usage); + exit(1); +} + +$code = file_get_contents($options["codefile"]); +if($code === FALSE) +{ + fprintf(STDERR, "Can not open '${options['codefile']}'.\n"); + exit(1); +} + +/* Remove trailing delimiters */ +$code = preg_replace("/^\\<\\?php(.*)\\?\\>\\s*?$/s", "\\1", $code); + +$plugin = new PluginPackage(); + +$plugin->code = $code; +$plugin->classname = $options["classname"]; +$plugin->name = $options["pluginname"]; +$plugin->author = $options["author"]; +$plugin->versiontext = $options["versiontext"]; +$plugin->versioncount = $options["versioncount"]; +$plugin->api = $options["api"]; +$plugin->short_description = $options["shortdesc"]; + +if(isset($options["updatepath"])) + $plugin->updatepath = $options["updatepath"]; +if(isset($options["web"])) + $plugin->web = $options["web"]; +if(isset($options["licensefile"])) + $plugin->license = @file_get_contents($options["licensefile"]); +if(isset($options["helpfile"])) + $plugin->help = @file_get_contents($options["helpfile"]); +if(isset($options["custompub"])) + $plugin->custompub = dir2array($options["custompub"]); +if(isset($options["custompriv"])) + $plugin->custompriv = dir2array($options["custompriv"]); +if(isset($options["tpldir"])) + $plugin->tpls = dir2array($options["tpldir"]); + +file_put_contents($options["output"], $plugin->save()); + +?> -- cgit v1.2.3-70-g09d2