import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
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: Abstract.php 17795 2009-08-24 19:04:01Z ralph $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -120,32 +120,32 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
}
|
||||
|
||||
$profile = new Zend_Tool_Project_Profile();
|
||||
|
||||
|
||||
$parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim($projectDirectory, DIRECTORY_SEPARATOR));
|
||||
while ($parentDirectoriesArray) {
|
||||
$projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);
|
||||
|
||||
|
||||
if (DIRECTORY_SEPARATOR !== "\\") {
|
||||
$projectDirectoryAssembled = DIRECTORY_SEPARATOR . $projectDirectoryAssembled;
|
||||
}
|
||||
|
||||
|
||||
$profile->setAttribute('projectDirectory', $projectDirectoryAssembled);
|
||||
if ($profile->isLoadableFromFile()) {
|
||||
chdir($projectDirectoryAssembled);
|
||||
|
||||
|
||||
$profile->loadFromFile();
|
||||
$this->_loadedProfile = $profile;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// break after first run if we are not to check upper directories
|
||||
if ($searchParentDirectories == false) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
array_pop($parentDirectoriesArray);
|
||||
}
|
||||
|
||||
|
||||
if ($this->_loadedProfile == null) {
|
||||
if ($loadProfileFlag == self::NO_PROFILE_THROW_EXCEPTION) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.');
|
||||
@ -207,11 +207,11 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
|
||||
protected function _getContentForContext(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters)
|
||||
{
|
||||
$storage = $this->_registry->getStorage();
|
||||
$storage = $this->_registry->getStorage();
|
||||
if (!$storage->isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Zend_Tool_Project_Context_Content_Engine')) {
|
||||
require_once 'Zend/Tool/Project/Context/Content/Engine.php';
|
||||
}
|
||||
@ -219,7 +219,7 @@ abstract class Zend_Tool_Project_Provider_Abstract extends Zend_Tool_Framework_P
|
||||
$engine = new Zend_Tool_Project_Context_Content_Engine($storage);
|
||||
return $engine->getContent($context, $methodName, $parameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _loadContextClassesIntoRegistry() - This is called by the constructor
|
||||
* so that child providers can provide a list of contexts to load into the
|
||||
|
@ -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: Exception.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,5 +33,5 @@ require_once 'Zend/Tool/Project/Exception.php';
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Exception extends Zend_Tool_Project_Exception
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
@ -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: Form.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Form.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -28,11 +28,11 @@
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Form extends Zend_Tool_Project_Provider_Abstract
|
||||
{
|
||||
|
||||
|
||||
public function create($name)
|
||||
{
|
||||
echo '@todo - create form';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -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: Manifest.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Manifest.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -66,10 +66,10 @@ require_once 'Zend/Tool/Project/Provider/ProjectProvider.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Manifest implements
|
||||
class Zend_Tool_Project_Provider_Manifest implements
|
||||
Zend_Tool_Framework_Manifest_ProviderManifestable
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* getProviders()
|
||||
*
|
||||
|
@ -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: Model.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Model.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Model extends Zend_Tool_Project_Provider_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* create()
|
||||
*
|
||||
@ -38,6 +38,6 @@ class Zend_Tool_Project_Provider_Model extends Zend_Tool_Project_Provider_Abstra
|
||||
{
|
||||
echo '@todo - create model';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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: Module.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Module.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ require_once 'Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php';
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Module
|
||||
class Zend_Tool_Project_Provider_Module
|
||||
extends Zend_Tool_Project_Provider_Abstract
|
||||
implements Zend_Tool_Framework_Provider_Pretendable
|
||||
{
|
||||
@ -58,45 +58,45 @@ class Zend_Tool_Project_Provider_Module
|
||||
if ($targetModuleResource == null) {
|
||||
$targetModuleResource = $profile->search('applicationDirectory');
|
||||
$targetModuleEnabledResources = array(
|
||||
'ControllersDirectory', 'ModelsDirectory', 'ViewsDirectory',
|
||||
'ControllersDirectory', 'ModelsDirectory', 'ViewsDirectory',
|
||||
'ViewScriptsDirectory', 'ViewHelpersDirectory', 'ViewFiltersDirectory'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// find the actual modules directory we will use to house our module
|
||||
$modulesDirectory = $profile->search('modulesDirectory');
|
||||
|
||||
|
||||
// if there is a module directory already, except
|
||||
if ($modulesDirectory->search(array('moduleDirectory' => array('moduleName' => $moduleName)))) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('A module named "' . $moduleName . '" already exists.');
|
||||
}
|
||||
|
||||
|
||||
// create the module directory
|
||||
$moduleDirectory = $modulesDirectory->createResource('moduleDirectory', array('moduleName' => $moduleName));
|
||||
|
||||
|
||||
// create a context filter so that we can pull out only what we need from the module skeleton
|
||||
$moduleContextFilterIterator = new Zend_Tool_Project_Profile_Iterator_ContextFilter(
|
||||
$targetModuleResource,
|
||||
$targetModuleResource,
|
||||
array(
|
||||
'denyNames' => array('ModulesDirectory', 'ViewControllerScriptsDirectory'),
|
||||
'denyType' => 'Zend_Tool_Project_Context_Filesystem_File'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// the iterator for the module skeleton
|
||||
$targetIterator = new RecursiveIteratorIterator($moduleContextFilterIterator, RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
|
||||
// initialize some loop state information
|
||||
$currentDepth = 0;
|
||||
$parentResources = array();
|
||||
$currentResource = $moduleDirectory;
|
||||
|
||||
|
||||
// loop through the target module skeleton
|
||||
foreach ($targetIterator as $targetSubResource) {
|
||||
|
||||
|
||||
$depthDifference = $targetIterator->getDepth() - $currentDepth;
|
||||
$currentDepth = $targetIterator->getDepth();
|
||||
|
||||
|
||||
if ($depthDifference === 1) {
|
||||
// if we went down into a child, make note
|
||||
array_push($parentResources, $currentResource);
|
||||
@ -114,7 +114,7 @@ class Zend_Tool_Project_Provider_Module
|
||||
// get parameters for the newly created module resource
|
||||
$params = $targetSubResource->getAttributes();
|
||||
$currentChildResource = $currentResource->createResource($targetSubResource->getName(), $params);
|
||||
|
||||
|
||||
// based of the provided list (Currently up top), enable specific resources
|
||||
if (isset($targetModuleEnabledResources)) {
|
||||
$currentChildResource->setEnabled(in_array($targetSubResource->getName(), $targetModuleEnabledResources));
|
||||
@ -123,10 +123,10 @@ class Zend_Tool_Project_Provider_Module
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $moduleDirectory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* create()
|
||||
*
|
||||
@ -135,11 +135,11 @@ class Zend_Tool_Project_Provider_Module
|
||||
public function create($name) //, $moduleProfile = null)
|
||||
{
|
||||
$this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
|
||||
|
||||
|
||||
$resources = self::createResources($this->_loadedProfile, $name);
|
||||
|
||||
|
||||
$response = $this->_registry->getResponse();
|
||||
|
||||
|
||||
if ($this->_registry->getRequest()->isPretend()) {
|
||||
$response->appendContent('I would create the following module and artifacts:');
|
||||
foreach (new RecursiveIteratorIterator($resources, RecursiveIteratorIterator::SELF_FIRST) as $resource) {
|
||||
@ -154,12 +154,12 @@ class Zend_Tool_Project_Provider_Module
|
||||
$response->appendContent($resource->getContext()->getPath());
|
||||
$resource->create();
|
||||
}
|
||||
|
||||
|
||||
// store changes to the profile
|
||||
$this->_storeProfile();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -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: Profile.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Profile.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -33,7 +33,7 @@ require_once 'Zend/Tool/Project/Provider/Abstract.php';
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Profile extends Zend_Tool_Project_Provider_Abstract
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* show()
|
||||
*
|
||||
|
@ -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: Project.php 16972 2009-07-22 18:44:24Z ralph $
|
||||
* @version $Id: Project.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -35,7 +35,7 @@ class Zend_Tool_Project_Provider_Project extends Zend_Tool_Project_Provider_Abst
|
||||
{
|
||||
|
||||
protected $_specialties = array('Info');
|
||||
|
||||
|
||||
/**
|
||||
* create()
|
||||
*
|
||||
@ -65,39 +65,39 @@ class Zend_Tool_Project_Provider_Project extends Zend_Tool_Project_Provider_Abst
|
||||
}
|
||||
|
||||
$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' => $profileData
|
||||
));
|
||||
|
||||
$newProfile->loadFromData();
|
||||
|
||||
|
||||
$this->_registry->getResponse()->appendContent('Creating project at ' . $path);
|
||||
|
||||
foreach ($newProfile->getIterator() as $resource) {
|
||||
$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);
|
||||
|
@ -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: Test.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Test.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,9 +38,9 @@ require_once 'Zend/Tool/Project/Provider/Exception.php';
|
||||
*/
|
||||
class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstract
|
||||
{
|
||||
|
||||
|
||||
protected $_specialties = array('Application', 'Library');
|
||||
|
||||
|
||||
/**
|
||||
* isTestingEnabled()
|
||||
*
|
||||
@ -51,10 +51,10 @@ class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstrac
|
||||
{
|
||||
$profileSearchParams = array('testsDirectory');
|
||||
$testsDirectory = $profile->search($profileSearchParams);
|
||||
|
||||
|
||||
return $testsDirectory->isEnabled();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* createApplicationResource()
|
||||
*
|
||||
@ -69,28 +69,28 @@ class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstrac
|
||||
if (!is_string($controllerName)) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"controllerName\" is the name of a controller resource to create.');
|
||||
}
|
||||
|
||||
|
||||
if (!is_string($actionName)) {
|
||||
throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"actionName\" is the name of a controller resource to create.');
|
||||
}
|
||||
|
||||
|
||||
$testsDirectoryResource = $profile->search('testsDirectory');
|
||||
|
||||
|
||||
if (($testAppDirectoryResource = $testsDirectoryResource->search('testApplicationDirectory')) === false) {
|
||||
$testAppDirectoryResource = $testsDirectoryResource->createResource('testApplicationDirectory');
|
||||
}
|
||||
|
||||
|
||||
if ($moduleName) {
|
||||
//@todo $moduleName
|
||||
$moduleName = '';
|
||||
}
|
||||
|
||||
|
||||
if (($testAppControllerDirectoryResource = $testAppDirectoryResource->search('testApplicationControllerDirectory')) === false) {
|
||||
$testAppControllerDirectoryResource = $testAppDirectoryResource->createResource('testApplicationControllerDirectory');
|
||||
}
|
||||
|
||||
|
||||
$testAppControllerFileResource = $testAppControllerDirectoryResource->createResource('testApplicationControllerFile', array('forControllerName' => $controllerName));
|
||||
|
||||
|
||||
return $testAppControllerFileResource;
|
||||
}
|
||||
|
||||
@ -104,46 +104,46 @@ class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstrac
|
||||
public static function createLibraryResource(Zend_Tool_Project_Profile $profile, $libraryClassName)
|
||||
{
|
||||
$testLibraryDirectoryResource = $profile->search(array('TestsDirectory', 'TestLibraryDirectory'));
|
||||
|
||||
|
||||
|
||||
|
||||
$fsParts = explode('_', $libraryClassName);
|
||||
|
||||
|
||||
$currentDirectoryResource = $testLibraryDirectoryResource;
|
||||
|
||||
|
||||
while ($nameOrNamespacePart = array_shift($fsParts)) {
|
||||
|
||||
if (count($fsParts) > 0) {
|
||||
|
||||
|
||||
if (($libraryDirectoryResource = $currentDirectoryResource->search(array('TestLibraryNamespaceDirectory' => array('namespaceName' => $nameOrNamespacePart)))) === false) {
|
||||
$currentDirectoryResource = $currentDirectoryResource->createResource('TestLibraryNamespaceDirectory', array('namespaceName' => $nameOrNamespacePart));
|
||||
} else {
|
||||
$currentDirectoryResource = $libraryDirectoryResource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (($libraryFileResource = $currentDirectoryResource->search(array('TestLibraryFile' => array('forClassName' => $libraryClassName)))) === false) {
|
||||
$libraryFileResource = $currentDirectoryResource->createResource('TestLibraryFile', array('forClassName' => $libraryClassName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $libraryFileResource;
|
||||
}
|
||||
|
||||
|
||||
public function enable()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function disable()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* create()
|
||||
*
|
||||
@ -152,15 +152,15 @@ class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstrac
|
||||
public function create($libraryClassName)
|
||||
{
|
||||
$profile = $this->_loadProfile();
|
||||
|
||||
|
||||
if (!self::isTestingEnabled($profile)) {
|
||||
$this->_registry->getResponse()->appendContent('Testing is not enabled for this project.');
|
||||
}
|
||||
|
||||
|
||||
$testLibraryResource = self::createLibraryResource($profile, $libraryClassName);
|
||||
|
||||
|
||||
$response = $this->_registry->getResponse();
|
||||
|
||||
|
||||
if ($this->_registry->getRequest()->isPretend()) {
|
||||
$response->appendContent('Would create a library stub in location ' . $testLibraryResource->getContext()->getPath());
|
||||
} else {
|
||||
@ -168,7 +168,7 @@ class Zend_Tool_Project_Provider_Test extends Zend_Tool_Project_Provider_Abstrac
|
||||
$testLibraryResource->create();
|
||||
$this->_storeProfile();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user