Rename commands [enable=install, disable=remove] + Augment preview + shortcut `xdrm-framework` shell redirecting script

This commit is contained in:
xdrm-brackets 2016-12-05 15:57:08 +01:00
parent 425363334c
commit 17d573e9ee
5 changed files with 22 additions and 15 deletions

View File

@ -7,8 +7,8 @@ xdrm-framework is a tool that wraps my framework and all it's component's versio
To use the xdrm-framework's project builder, just open a linux terminal and type :
1. `xdrm-framework modules` - to display the available modules
2. `xdrm-framework enable {moduleName} 1.2` - to enable a module and its version (1.2 here)
3. `xdrm-framework disable {moduleName}` - to disable a module
2. `xdrm-framework install {moduleName} 1.2` - to enable a module and its version (1.2 here)
3. `xdrm-framework remove {moduleName}` - to disable a module
4. `xdrm-framework build` - will create your project in the folder `built`
5. `mv built {yourPath}/{yourProjectName}` - to move your project wherever you want

View File

@ -62,12 +62,12 @@
*
* @pModule<String> Module's name
* @pVersion<String> Module's version
* @pDep<Boolean> TRUE if dependency
* @pDep<Boolean> dependency level
*
* @return err_msg<String> Error message | TRUE (if all is ok)
*
*/
public function enable($pModule=null, $pVersion=null, $pDep=false){
public function enable($pModule=null, $pVersion=null, $pDep=0){
/* [1] Module management
=========================================================*/
@ -141,17 +141,19 @@
/* (5) If not a dependency or higher version -> set/update version */
if( !$pDep || $this->lower($module, $this->modules['enabled'][$mname], $vname) ){
if( $pDep == 0 || $this->lower($module, $this->modules['enabled'][$mname], $vname) ){
// if a dependency, set new params
if( $pDep )
echo " [x] $mname:$vname (version $vname+ required)\n";
if( $pDep > 0 )
echo str_repeat(" ", $pDep)."[x] $mname:$vname ($mname:$vname+ required)\n";
else
echo str_repeat(" ", $pDep)."[x] $mname:$vname\n";
// else, store new module
// in any case -> store new module's version
$this->modules['enabled'][$mname] = $vname;
}else if( $pDep )
echo " [x] $mname:".$this->modules['enabled'][$mname]." (version $vname+ required)\n";
}else if( $pDep > 0 )
echo str_repeat(" ", $pDep)."[x] $mname:".$this->modules['enabled'][$mname]." ($mname:$vname+ required)\n";
/* [4] Loading dependencies
@ -159,10 +161,11 @@
/* (1) Loading each dependency */
if( count($version) > 0 ){
echo "\n".str_repeat(" ", $pDep);
echo "dependencies:\n";
foreach($version as $depMod=>$depVer)
$enabled = $this->enable($depMod, $depVer, true);
$enabled = $this->enable($depMod, $depVer, $pDep+1);
}

View File

@ -55,7 +55,7 @@
/* (2) Enables a module and its version
---------------------------------------------------------*/
case 'enable': {
case 'install': {
if( $arglen < 2 || !preg_match("/^(.+):([0-9\.-]+)$/i", $arguments[1], $matches) ){
echo "You must specify @module:@version.\n";
@ -72,7 +72,7 @@
/* (3) Disabled a module
---------------------------------------------------------*/
case 'disable': {
case 'remove': {
if( $arglen < 2 ){
echo "You must specify @module.\n";

View File

@ -36,8 +36,10 @@
}
},
"enabled": {
"api": "2.0",
"orm": "0.8.2",
"database": "2.0",
"error": "2.0",
"database": "2.0"
"api": "2.0",
"router": "1.0"
}
}

2
xdrm-framework Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
php exporter/main.php $*