/** * DoIt * * @throws Exception * @return void */ public function doExecute() { require JPATH_BASE . '/helpers/loader.php'; require JPATH_BASE . '/includes/defines.php'; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); var_dump(getcwd()); var_dump($this->input->args); // Known project types $types = EcrProjectHelper::getProjectTypes(); // Known project "Tags" - short forms $tags = EcrProjectHelper::getProjectTypesTags(); // Predefined actions $actions = $this->getActions(); var_dump($actions); var_dump($tags); // @todo What do you want to do today ? =;) return; $this->input->set('ecr_project', 'wap_fuuuschubidu'); $builder = new EcrProjectBuilder(); $type = 'webapp'; //getCmd('tpl_type'); $name = 'mvc_1'; //getCmd('tpl_name'); $comName = 'wap_gugugugu'; //getCmd('com_name'); if (in_array($type, array('cliapp', 'webapp'))) { define('JPATH_SITE', __DIR__); } $newProject = $builder->build($type, $name, $comName); if (!$newProject) { //-- Error $this->out('An error happened while creating your project'); // JFactory::getApplication()->enqueueMessage(jgettext('An error happened while creating your project'), 'error'); // $builder->printErrors(); $errors = $builder->getErrors(); var_dump($errors); //EcrHtml::formEnd(); return; } if ('test' == JFactory::getApplication()->input->get('ecr_test_mode')) { //-- Exiting in test mode echo '<h2>Exiting in test mode...</h2>'; echo $builder->printLog(); $builder->printErrors(); EcrHtml::formEnd(); return; } $ecr_project = JFile::stripExt($newProject->getEcrXmlFileName()); // $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project='.$ecr_project; $this->out('Your project has been created'); echo ECRPATH_DATA; $project = EcrProjectHelper::getProject(); var_dump($project); }
/** * Creates the frame. * * @param string $type Project type (component, plugin...) * @param string $template Name of the extension template * @param string $name Baby's name * * @return EcrProjectBase on success | false on error. */ public function build($type, $template, $name) { $input = JFactory::getApplication()->input; //-- Get component parameters $comParams = JComponentHelper::getParams('com_easycreator'); //-- Setup logging $buildOpts = JFactory::getApplication()->input->get('buildopts', array(), 'array'); $buildOpts['fileName'] = date('ymd_Hi') . '_building.log'; $this->logger = EcrLogger::getInstance('ecr', $buildOpts); $this->buildBase = JPath::clean(ECRPATH_EXTENSIONTEMPLATES . DS . $type . DS . $template); $this->logger->log('buildBase set to: ' . $this->buildBase); $projectTypes = EcrProjectHelper::getProjectTypesTags(); if (!in_array($type, $projectTypes)) { $this->logger->log(sprintf('Unknown project type [%s]', $type)); $this->logger->writeLog(); $this->setError(sprintf('Unknown project type [%s]', $type)); return false; } $this->project = EcrProjectHelper::newProject($type); $this->project->name = $name; $this->project->type = $type; $this->project->fromTpl = $template; $this->project->dbTypes = $input->get('dbtypes', array(), 'array'); $this->project->headerType = $input->get('headerType'); //-- Set custom build names from component defaults for ($i = 1; $i < 5; $i++) { $this->project->buildOpts['custom_name_' . $i] = $comParams->get('custom_name_' . $i); } //-- Set packing formats from component defaults foreach (EcrEasycreator::$packFormats as $name => $ext) { if ($comParams->get($name)) { $this->project->buildOpts[$name] = '1'; } } if (false == $this->customOptions('process')) { $this->logger->log('Custom options failed'); $this->logger->writeLog(); $this->setError('Custom options failed'); return false; } try { $this->setUp()->setUpProject()->readHeader()->createBuildDir()->addComplements()->copyFiles()->processMoreOptions()->createJoomlaManifest()->install()->createEasyCreatorManifest(); } catch (EcrExceptionBuilder $e) { $this->logger->log('ERROR', $e->getMessage()); $this->logger->writeLog(); $this->setError('ERROR: ' . $e->getMessage()); return false; } $this->logger->log('FINISHED'); $this->logger->writeLog(); return $this->project; }