import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Framework
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
* @version $Id: Project.php 16972 2009-07-22 18:44:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -34,12 +34,14 @@ require_once 'Zend/Tool/Project/Provider/Abstract.php';
|
||||
class Zend_Tool_Project_Provider_Project extends Zend_Tool_Project_Provider_Abstract
|
||||
{
|
||||
|
||||
protected $_specialties = array('Info');
|
||||
|
||||
/**
|
||||
* create()
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
public function create($path)
|
||||
public function create($path, $nameOfProfile = null, $fileOfProfile = null)
|
||||
{
|
||||
if ($path == null) {
|
||||
$path = getcwd();
|
||||
@ -62,9 +64,24 @@ class Zend_Tool_Project_Provider_Project extends Zend_Tool_Project_Provider_Abst
|
||||
throw new Zend_Tool_Framework_Client_Exception('A project already exists here');
|
||||
}
|
||||
|
||||
$profileData = null;
|
||||
|
||||
if ($fileOfProfile != null && file_exists($fileOfProfile)) {
|
||||
$profileData = file_get_contents($fileOfProfile);
|
||||
}
|
||||
|
||||
$storage = $this->_registry->getStorage();
|
||||
if ($profileData == '' && $nameOfProfile != null && $storage->isEnabled()) {
|
||||
$profileData = $storage->get('project/profiles/' . $nameOfProfile . '.xml');
|
||||
}
|
||||
|
||||
if ($profileData == '') {
|
||||
$profileData = $this->_getDefaultProfile();
|
||||
}
|
||||
|
||||
$newProfile = new Zend_Tool_Project_Profile(array(
|
||||
'projectDirectory' => $path,
|
||||
'profileData' => $this->_getDefaultProfile()
|
||||
'profileData' => $profileData
|
||||
));
|
||||
|
||||
$newProfile->loadFromData();
|
||||
@ -75,6 +92,21 @@ class Zend_Tool_Project_Provider_Project extends Zend_Tool_Project_Provider_Abst
|
||||
$resource->create();
|
||||
}
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
$this->_registry->getResponse()->appendContent('You probably meant to run "show project.info".', array('color' => 'yellow'));
|
||||
}
|
||||
|
||||
public function showInfo()
|
||||
{
|
||||
$profile = $this->_loadProfile(self::NO_PROFILE_RETURN_FALSE);
|
||||
if (!$profile) {
|
||||
$this->_registry->getResponse()->appendContent('No project found.');
|
||||
} else {
|
||||
$this->_registry->getResponse()->appendContent('Working with project located at: ' . $profile->getAttribute('projectDirectory'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function _getDefaultProfile()
|
||||
{
|
||||
|
Reference in New Issue
Block a user