Source for file Ethna_Plugin_Handle_AddProject.php

Documentation is available at Ethna_Plugin_Handle_AddProject.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Ethna_Plugin_Handle_AddProject.php
  5.  *
  6.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: Ethna_Plugin_Handle_AddProject.php 444 2007-01-05 06:57:21Z ichii386 $
  10.  */
  11.  
  12. // {{{ Ethna_Plugin_Handle_AddProject
  13. /**
  14.  *  add-project handler
  15.  *
  16.  *  @author     Masaki Fujimoto <fujimoto@php.net>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /**
  22.      *  add project:)
  23.      *
  24.      *  @access public
  25.      */
  26.     function perform()
  27.     {
  28.         $r $this->_getopt(array('basedir='));
  29.         if (Ethna::isError($r)) {
  30.             return $r;
  31.         }
  32.         list($opt_list$arg_list$r;
  33.  
  34.         // app_id
  35.         $app_id array_shift($arg_list);
  36.         if ($app_id == null{
  37.             return Ethna::raiseError('project id isn\'t set.''usage');
  38.         }
  39.         $r Ethna_Controller::checkAppId($app_id);
  40.         if (Ethna::isError($r)) {
  41.             return $r;
  42.         }
  43.  
  44.         // basedir
  45.         if (isset($opt_list['basedir'])) {
  46.             $basedir realpath(end($opt_list['basedir']));
  47.         else {
  48.             $basedir getcwd();
  49.         }
  50.  
  51.         $r Ethna_Generator::generate('Project'null$app_id$basedir);
  52.         if (Ethna::isError($r)) {
  53.             printf("error occurred while generating skelton. please see also error messages given above\n\n");
  54.             return $r;
  55.         }
  56.  
  57.         printf("\nproject skelton for [%s] is successfully generated at [%s]\n\n"$app_id$basedir);
  58.         return true;
  59.     }
  60.  
  61.     /**
  62.      *  get handler's description
  63.      *
  64.      *  @access public
  65.      */
  66.     function getDescription()
  67.     {
  68.         return <<<EOS
  69. add new project:
  70.     {$this->id} [-b|--basedir=dir] [project-id]
  71.  
  72. EOS;
  73.     }
  74.  
  75.     /**
  76.      *  get usage
  77.      *
  78.      *  @access public
  79.      */
  80.     function getUsage()
  81.     {
  82.         return <<<EOS
  83. ethna {$this->id} [-b|--basedir=dir] [project-id]
  84. EOS;
  85.     }
  86. }
  87. // }}}
  88. ?>

Documentation generated on Thu, 08 May 2008 00:15:12 +0900 by phpDocumentor 1.4.2