Changeset 722

Show
Ignore:
Timestamp:
01/02/08 12:35:05 (1 year ago)
Author:
laurentj
Message:

fixed a bug in tests avout jRequest
fixed a little bug in createapp command, and now, createapp create a module by default

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix-scripts/commands/createapp.cmd.php

    r673 r722  
    1414 
    1515    public  $name = 'createapp'; 
    16     public  $allowed_options=array('-withdefaultmodule'=>false, '-withcmdline'=>false); 
     16    public  $allowed_options=array('-nodefaultmodule'=>false, '-withcmdline'=>false); 
    1717    public  $allowed_parameters=array(); 
    1818 
    19     public  $syntaxhelp = "[-withdefaultmodule] [-withcmdline] [-withrpc]"; 
     19    public  $syntaxhelp = "[-nodefaultmodule] [-withcmdline] [-withrpc]"; 
    2020    public  $help=''; 
    2121 
     
    2323        $this->help= array( 
    2424            'fr'=>" 
    25     Créer une nouvelle application avec tous les répertoires nécessaires. 
     25    Créer une nouvelle application avec tous les répertoires nécessaires et un module 
     26    du même nom que l'application. 
    2627 
    27     Si l'option -withdefaultmodule est présente, créer également un module du 
    28     même nom que l'application. 
     28    Si l'option -nodefaultmodule est présente, le module n'est pas crée. 
    2929 
    3030    Si l'option -withcmdline est présente, créer un point d'entrée afin de  
     
    3737    ", 
    3838            'en'=>" 
    39     Create a new application with all directories 
     39    Create a new application with all directories and a module which have  
     40    the same name of the application. 
    4041 
    41     If you give -withdefaultmodule option, it create also a module which have  
    42     the same name of the application. 
     42    If you give -nodefaultmodule option, it won't create the module.  
    4343 
    4444    If you give the -withcmdline option, it will create an entry point for 
     
    5555    public function run(){ 
    5656       if(file_exists(JELIX_APP_PATH)){ 
    57            die("Erreur : application déjà existante\n"); 
     57           die("Error : this application already created\n"); 
    5858       } 
    5959 
     
    9090       $this->createFile(JELIX_APP_CONFIG_PATH.'index/config.ini.php','var/config/index/config.ini.php.tpl',$param); 
    9191 
    92        $param['rp_temp']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH,true); 
    93        $param['rp_var'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,true); 
    94        $param['rp_log'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,true); 
    95        $param['rp_conf']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH,true); 
    96        $param['rp_www'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,true); 
    97        $param['rp_cmd'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,true); 
     92       $param['rp_temp']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH, true, true); 
     93       $param['rp_var'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,  true, true); 
     94       $param['rp_log'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,  true, true); 
     95       $param['rp_conf']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH, true, true); 
     96       $param['rp_www'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,  true, true); 
     97       $param['rp_cmd'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,  true, true); 
    9898 
    9999       $this->createFile(JELIX_APP_PATH.'application.init.php','application.init.php.tpl',$param); 
    100100 
    101101       $param = array('appname'=>$GLOBALS['APPNAME']); 
    102        $param['rp_jelix']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH ,true); 
    103        $param['rp_app']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH,true ); 
     102       $param['rp_jelix'] = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH, true, true); 
     103       $param['rp_app']   = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH, true, true); 
    104104 
    105105       $this->createFile(JELIX_APP_WWW_PATH.'index.php','www/index.php.tpl',$param); 
    106         
    107        if($this->getOption('-withdefaultmodule')){ 
     106 
     107       if(!$this->getOption('-nodefaultmodule')){ 
    108108            $cmd = jxs_load_command('createmodule'); 
    109109            $cmd->init(array(),array('module'=>$GLOBALS['APPNAME'])); 
  • trunk/lib/jelix-scripts/commands/createapp.cmd.php

    r673 r722  
    1414 
    1515    public  $name = 'createapp'; 
    16     public  $allowed_options=array('-withdefaultmodule'=>false, '-withcmdline'=>false); 
     16    public  $allowed_options=array('-nodefaultmodule'=>false, '-withcmdline'=>false); 
    1717    public  $allowed_parameters=array(); 
    1818 
    19     public  $syntaxhelp = "[-withdefaultmodule] [-withcmdline] [-withrpc]"; 
     19    public  $syntaxhelp = "[-nodefaultmodule] [-withcmdline] [-withrpc]"; 
    2020    public  $help=''; 
    2121 
     
    2323        $this->help= array( 
    2424            'fr'=>" 
    25     Créer une nouvelle application avec tous les répertoires nécessaires. 
     25    Créer une nouvelle application avec tous les répertoires nécessaires et un module 
     26    du même nom que l'application. 
    2627 
    27     Si l'option -withdefaultmodule est présente, créer également un module du 
    28     même nom que l'application. 
     28    Si l'option -nodefaultmodule est présente, le module n'est pas crée. 
    2929 
    3030    Si l'option -withcmdline est présente, créer un point d'entrée afin de  
     
    3737    ", 
    3838            'en'=>" 
    39     Create a new application with all directories 
     39    Create a new application with all directories and a module which have  
     40    the same name of the application. 
    4041 
    41     If you give -withdefaultmodule option, it create also a module which have  
    42     the same name of the application. 
     42    If you give -nodefaultmodule option, it won't create the module.  
    4343 
    4444    If you give the -withcmdline option, it will create an entry point for 
     
    5555    public function run(){ 
    5656       if(file_exists(JELIX_APP_PATH)){ 
    57            die("Erreur : application déjà existante\n"); 
     57           die("Error : this application already created\n"); 
    5858       } 
    5959 
     
    9090       $this->createFile(JELIX_APP_CONFIG_PATH.'index/config.ini.php','var/config/index/config.ini.php.tpl',$param); 
    9191 
    92        $param['rp_temp']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH,true); 
    93        $param['rp_var'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,true); 
    94        $param['rp_log'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,true); 
    95        $param['rp_conf']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH,true); 
    96        $param['rp_www'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,true); 
    97        $param['rp_cmd'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,true); 
     92       $param['rp_temp']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH, true, true); 
     93       $param['rp_var'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,  true, true); 
     94       $param['rp_log'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,  true, true); 
     95       $param['rp_conf']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH, true, true); 
     96       $param['rp_www'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,  true, true); 
     97       $param['rp_cmd'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,  true, true); 
    9898 
    9999       $this->createFile(JELIX_APP_PATH.'application.init.php','application.init.php.tpl',$param); 
    100100 
    101101       $param = array('appname'=>$GLOBALS['APPNAME']); 
    102        $param['rp_jelix']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH ,true); 
    103        $param['rp_app']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH,true ); 
     102       $param['rp_jelix'] = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH, true, true); 
     103       $param['rp_app']   = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH, true, true); 
    104104 
    105105       $this->createFile(JELIX_APP_WWW_PATH.'index.php','www/index.php.tpl',$param); 
    106         
    107        if($this->getOption('-withdefaultmodule')){ 
     106 
     107       if(!$this->getOption('-nodefaultmodule')){ 
    108108            $cmd = jxs_load_command('createmodule'); 
    109109            $cmd->init(array(),array('module'=>$GLOBALS['APPNAME'])); 
  • trunk/lib/jelix-scripts/commands/createapp.cmd.php

    r673 r722  
    1414 
    1515    public  $name = 'createapp'; 
    16     public  $allowed_options=array('-withdefaultmodule'=>false, '-withcmdline'=>false); 
     16    public  $allowed_options=array('-nodefaultmodule'=>false, '-withcmdline'=>false); 
    1717    public  $allowed_parameters=array(); 
    1818 
    19     public  $syntaxhelp = "[-withdefaultmodule] [-withcmdline] [-withrpc]"; 
     19    public  $syntaxhelp = "[-nodefaultmodule] [-withcmdline] [-withrpc]"; 
    2020    public  $help=''; 
    2121 
     
    2323        $this->help= array( 
    2424            'fr'=>" 
    25     Créer une nouvelle application avec tous les répertoires nécessaires. 
     25    Créer une nouvelle application avec tous les répertoires nécessaires et un module 
     26    du même nom que l'application. 
    2627 
    27     Si l'option -withdefaultmodule est présente, créer également un module du 
    28     même nom que l'application. 
     28    Si l'option -nodefaultmodule est présente, le module n'est pas crée. 
    2929 
    3030    Si l'option -withcmdline est présente, créer un point d'entrée afin de  
     
    3737    ", 
    3838            'en'=>" 
    39     Create a new application with all directories 
     39    Create a new application with all directories and a module which have  
     40    the same name of the application. 
    4041 
    41     If you give -withdefaultmodule option, it create also a module which have  
    42     the same name of the application. 
     42    If you give -nodefaultmodule option, it won't create the module.  
    4343 
    4444    If you give the -withcmdline option, it will create an entry point for 
     
    5555    public function run(){ 
    5656       if(file_exists(JELIX_APP_PATH)){ 
    57            die("Erreur : application déjà existante\n"); 
     57           die("Error : this application already created\n"); 
    5858       } 
    5959 
     
    9090       $this->createFile(JELIX_APP_CONFIG_PATH.'index/config.ini.php','var/config/index/config.ini.php.tpl',$param); 
    9191 
    92        $param['rp_temp']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH,true); 
    93        $param['rp_var'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,true); 
    94        $param['rp_log'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,true); 
    95        $param['rp_conf']=jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH,true); 
    96        $param['rp_www'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,true); 
    97        $param['rp_cmd'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,true); 
     92       $param['rp_temp']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_TEMP_PATH, true, true); 
     93       $param['rp_var'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_VAR_PATH,  true, true); 
     94       $param['rp_log'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_LOG_PATH,  true, true); 
     95       $param['rp_conf']= jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CONFIG_PATH, true, true); 
     96       $param['rp_www'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_WWW_PATH,  true, true); 
     97       $param['rp_cmd'] = jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,  true, true); 
    9898 
    9999       $this->createFile(JELIX_APP_PATH.'application.init.php','application.init.php.tpl',$param); 
    100100 
    101101       $param = array('appname'=>$GLOBALS['APPNAME']); 
    102        $param['rp_jelix']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH ,true); 
    103        $param['rp_app']=jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH,true ); 
     102       $param['rp_jelix'] = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH, true, true); 
     103       $param['rp_app']   = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH, true, true); 
    104104 
    105105       $this->createFile(JELIX_APP_WWW_PATH.'index.php','www/index.php.tpl',$param); 
    106         
    107        if($this->getOption('-withdefaultmodule')){ 
     106 
     107       if(!$this->getOption('-nodefaultmodule')){ 
    108108            $cmd = jxs_load_command('createmodule'); 
    109109            $cmd->init(array(),array('module'=>$GLOBALS['APPNAME'])); 
  • trunk/lib/jelix-scripts/includes/utils.lib.php

    r575 r722  
    104104 
    105105 
    106 function jxs_getRelativePath($path, $targetPath, $intoString=false){ 
     106function jxs_getRelativePath($path, $targetPath, $intoString=false, $useDSConst = false){ 
    107107    $cut = (DIRECTORY_SEPARATOR == '/'? '!/!': "![/\\\\]!"); 
    108108    $sep = DIRECTORY_SEPARATOR; 
     
    121121    } 
    122122    if(count($path)){ 
    123       $relativePath=str_repeat('..'.$sep,count($path)); 
     123        $relativePath=str_repeat('..'.$sep,count($path)); 
    124124    }else{ 
    125       $relativePath='.'.$sep; 
     125        $relativePath='.'.$sep; 
    126126    } 
    127127    if(count($targetPath) && $dir != $targetdir){ 
    128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
     128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
    129129    }elseif(count($targetPath) ){ 
    130130        $relativePath.= implode($sep,$targetPath); 
    131131    } 
    132132    if(substr($relativePath,-1) != $sep) 
    133        $relativePath.=$sep; 
    134     if($intoString && $sep =='\\') 
    135       $relativePath = str_replace('\\','\\\\', $relativePath); 
     133        $relativePath.=$sep; 
     134    if($intoString && $sep =='\\') { 
     135        if ($useDSConst) 
     136            $relativePath = str_replace('\\','\'.DIRECTORY_SEPARATOR.\'', $relativePath); 
     137        else 
     138            $relativePath = str_replace('\\','\\\\', $relativePath); 
     139    } 
    136140    return $relativePath; 
    137141} 
  • trunk/lib/jelix-scripts/includes/utils.lib.php

    r575 r722  
    104104 
    105105 
    106 function jxs_getRelativePath($path, $targetPath, $intoString=false){ 
     106function jxs_getRelativePath($path, $targetPath, $intoString=false, $useDSConst = false){ 
    107107    $cut = (DIRECTORY_SEPARATOR == '/'? '!/!': "![/\\\\]!"); 
    108108    $sep = DIRECTORY_SEPARATOR; 
     
    121121    } 
    122122    if(count($path)){ 
    123       $relativePath=str_repeat('..'.$sep,count($path)); 
     123        $relativePath=str_repeat('..'.$sep,count($path)); 
    124124    }else{ 
    125       $relativePath='.'.$sep; 
     125        $relativePath='.'.$sep; 
    126126    } 
    127127    if(count($targetPath) && $dir != $targetdir){ 
    128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
     128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
    129129    }elseif(count($targetPath) ){ 
    130130        $relativePath.= implode($sep,$targetPath); 
    131131    } 
    132132    if(substr($relativePath,-1) != $sep) 
    133        $relativePath.=$sep; 
    134     if($intoString && $sep =='\\') 
    135       $relativePath = str_replace('\\','\\\\', $relativePath); 
     133        $relativePath.=$sep; 
     134    if($intoString && $sep =='\\') { 
     135        if ($useDSConst) 
     136            $relativePath = str_replace('\\','\'.DIRECTORY_SEPARATOR.\'', $relativePath); 
     137        else 
     138            $relativePath = str_replace('\\','\\\\', $relativePath); 
     139    } 
    136140    return $relativePath; 
    137141} 
  • trunk/lib/jelix-scripts/includes/utils.lib.php

    r575 r722  
    104104 
    105105 
    106 function jxs_getRelativePath($path, $targetPath, $intoString=false){ 
     106function jxs_getRelativePath($path, $targetPath, $intoString=false, $useDSConst = false){ 
    107107    $cut = (DIRECTORY_SEPARATOR == '/'? '!/!': "![/\\\\]!"); 
    108108    $sep = DIRECTORY_SEPARATOR; 
     
    121121    } 
    122122    if(count($path)){ 
    123       $relativePath=str_repeat('..'.$sep,count($path)); 
     123        $relativePath=str_repeat('..'.$sep,count($path)); 
    124124    }else{ 
    125       $relativePath='.'.$sep; 
     125        $relativePath='.'.$sep; 
    126126    } 
    127127    if(count($targetPath) && $dir != $targetdir){ 
    128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
     128        $relativePath.= $targetdir.$sep.implode($sep,$targetPath); 
    129129    }elseif(count($targetPath) ){ 
    130130        $relativePath.= implode($sep,$targetPath); 
    131131    } 
    132132    if(substr($relativePath,-1) != $sep) 
    133        $relativePath.=$sep; 
    134     if($intoString && $sep =='\\') 
    135       $relativePath = str_replace('\\','\\\\', $relativePath); 
     133        $relativePath.=$sep; 
     134    if($intoString && $sep =='\\') { 
     135        if ($useDSConst) 
     136            $relativePath = str_replace('\\','\'.DIRECTORY_SEPARATOR.\'', $relativePath); 
     137        else 
     138            $relativePath = str_replace('\\','\\\\', $relativePath); 
     139    } 
    136140    return $relativePath; 
    137141} 
  • trunk/testapp/INSTALL.txt

    r716 r722  
    88    testapppdo if you have pdo extension and testapp_pgsql if you have postgresql sql 
    99    don't touch other sections. 
     10- create the "testapp/" directory in the temp directory of Jelix 
    1011- put write access for apache on temp/testapp/ 
  • trunk/testapp/INSTALL.txt

    r716 r722  
    88    testapppdo if you have pdo extension and testapp_pgsql if you have postgresql sql 
    99    don't touch other sections. 
     10- create the "testapp/" directory in the temp directory of Jelix 
    1011- put write access for apache on temp/testapp/ 
  • trunk/testapp/INSTALL.txt

    r716 r722  
    88    testapppdo if you have pdo extension and testapp_pgsql if you have postgresql sql 
    99    don't touch other sections. 
     10- create the "testapp/" directory in the temp directory of Jelix 
    1011- put write access for apache on temp/testapp/ 
  • trunk/testapp/modules/jelix_tests/tests/core.jrequest.html_cli.php

    r716 r722  
    2121class UTjrequest extends jUnitTestCase { 
    2222    protected $currentServer; 
     23    protected $currentBasePath; 
     24    protected $currentConfigScriptName; 
    2325 
    2426    function setUp() { 
    2527        $this->currentServer = $_SERVER; 
    2628        $this->currentConfigScriptName = $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable']; 
     29        $this->currentBasePath = $GLOBALS['gJConfig']->urlengine['basePath']; 
     30        $GLOBALS['gJConfig']->urlengine['basePath'] = '/'; 
    2731    } 
    2832 
     
    3034        $_SERVER = $this->currentServer; 
    3135        $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable'] = $this->currentConfigScriptName; 
     36        $GLOBALS['gJConfig']->urlengine['basePath'] = $this->currentBasePath; 
    3237    } 
    3338 
  • trunk/testapp/modules/jelix_tests/tests/core.jrequest.html_cli.php

    r716 r722  
    2121class UTjrequest extends jUnitTestCase { 
    2222    protected $currentServer; 
     23    protected $currentBasePath; 
     24    protected $currentConfigScriptName; 
    2325 
    2426    function setUp() { 
    2527        $this->currentServer = $_SERVER; 
    2628        $this->currentConfigScriptName = $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable']; 
     29        $this->currentBasePath = $GLOBALS['gJConfig']->urlengine['basePath']; 
     30        $GLOBALS['gJConfig']->urlengine['basePath'] = '/'; 
    2731    } 
    2832 
     
    3034        $_SERVER = $this->currentServer; 
    3135        $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable'] = $this->currentConfigScriptName; 
     36        $GLOBALS['gJConfig']->urlengine['basePath'] = $this->currentBasePath; 
    3237    } 
    3338 
  • trunk/testapp/modules/jelix_tests/tests/core.jrequest.html_cli.php

    r716 r722  
    2121class UTjrequest extends jUnitTestCase { 
    2222    protected $currentServer; 
     23    protected $currentBasePath; 
     24    protected $currentConfigScriptName; 
    2325 
    2426    function setUp() { 
    2527        $this->currentServer = $_SERVER; 
    2628        $this->currentConfigScriptName = $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable']; 
     29        $this->currentBasePath = $GLOBALS['gJConfig']->urlengine['basePath']; 
     30        $GLOBALS['gJConfig']->urlengine['basePath'] = '/'; 
    2731    } 
    2832 
     
    3034        $_SERVER = $this->currentServer; 
    3135        $GLOBALS['gJConfig']->urlengine['scriptNameServerVariable'] = $this->currentConfigScriptName; 
     36        $GLOBALS['gJConfig']->urlengine['basePath'] = $this->currentBasePath; 
    3237    } 
    3338 
Download in other formats: Unified Diff Zip Archive