_loadProfile(self::NO_PROFILE_RETURN_FALSE, $path); if ($profile !== false) { require_once 'Zend/Tool/Framework/Client/Exception.php'; 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' => $profileData )); $newProfile->loadFromData(); $response = $this->_registry->getResponse(); $response->appendContent('Creating project at ' . $path); $response->appendContent('Note: ', array('separator' => false, 'color' => 'yellow')); $response->appendContent( 'This command created a web project, ' . 'for more information setting up your VHOST, please see docs/README'); if (!Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { $response->appendContent('Testing Note: ', array('separator' => false, 'color' => 'yellow')); $response->appendContent('PHPUnit was not found in your include_path, therefore no testing actions will be created.'); } 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); 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() { $testAction = ''; if (Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { $testAction = ' '; } $version = Zend_Version::VERSION; $data = << $testAction EOS; return $data; } public static function getDefaultReadmeContents($caller = null) { $projectDirResource = $caller->getResource()->getProfile()->search('projectDirectory'); if ($projectDirResource) { $name = ltrim(strrchr($projectDirResource->getPath(), DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR); $path = $projectDirResource->getPath() . '/public'; } else { $path = '/path/to/public'; } return <<< EOS README ====== This directory should be used to place project specfic documentation including but not limited to project notes, generated API/phpdoc documentation, or manual files generated or hand written. Ideally, this directory would remain in your development environment only and should not be deployed with your application to it's final production location. Setting Up Your VHOST ===================== The following is a sample VHOST you might want to consider for your project. DocumentRoot "$path" ServerName $name.local # This should be omitted in the production environment SetEnv APPLICATION_ENV development Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all EOS; } }