public static function project_new() { $postVars = array(); foreach ($_POST['newProjectContainer'] as $name => $value) { if (isset($value['value'])) { $postVars[$name] = $value['value']; } } // // Check for mandatory attributes // if (!isset($postVars['title']) || empty($postVars['title']) || !isset($postVars['scmConnectorType']) || empty($postVars['scmConnectorType']) || !isset($postVars['scmRemoteRepository']) || empty($postVars['scmRemoteRepository'])) { // // TODO: Error notification!!! // SystemEvent::raise(SystemEvent::DEBUG, "Project creation failed, required attributes were empty.", __METHOD__); echo json_encode(array('success' => false, 'error' => 'Missing required attributes. Make sure all attributes not marked as optional are filled.')); exit; } else { $GLOBALS['project'] = null; $project = new Project(); $project->setTitle($postVars['title']); $project->setReleaseLabel($postVars['releaseLabel']); $project->setScmConnectorType($postVars['scmConnectorType']); $project->setScmRemoteRepository($postVars['scmRemoteRepository']); $project->setScmUsername($postVars['scmUsername']); $project->setScmPassword($postVars['scmPassword']); $project->addToUsers($GLOBALS['user'], Access::OWNER); if (!$project->init()) { SystemEvent::raise(SystemEvent::ERROR, "Could not initialize project. Try again later.", __METHOD__); echo json_encode(array('success' => false, 'error' => 'The project was created but could not be initialized. Please check the logs and/or try the first build manually.')); exit; } $GLOBALS['project'] = $project; $GLOBALS['project']->log("Project created.", $GLOBALS['user']->getUsername()); echo json_encode(array('success' => true, 'error' => 'Project successfully created, taking you back to your dashboard. Stand by...')); exit; } }
} $GLOBALS['LOGGER'] = Phing::import($GLOBALS['LOGGER']); $logger = new AgaviProxyBuildLogger(new $GLOBALS['LOGGER']()); $logger->setMessageOutputLevel($GLOBALS['VERBOSE'] ? Project::MSG_VERBOSE : Project::MSG_INFO); $logger->setOutputStream($GLOBALS['OUTPUT']); $logger->setErrorStream($GLOBALS['ERROR']); $project->addBuildListener($logger); $project->setInputHandler(new DefaultInputHandler()); $project->setUserProperty('phing.file', $GLOBALS['BUILD']->getAbsolutePath()); $project->setUserProperty('phing.version', Phing::getPhingVersion()); /* Phing f***s with the cwd. Really, brilliant. */ $project->setUserProperty('application.startdir', START_DIRECTORY); foreach ($GLOBALS['PROPERTIES'] as $name => $value) { $project->setUserProperty($name, $value); } $project->init(); ProjectConfigurator::configureProject($project, $GLOBALS['BUILD']); Phing::setCurrentProject($project); if ($GLOBALS['SHOW_LIST'] === true) { input_help_display(); $GLOBALS['OUTPUT']->write(PHP_EOL); $GLOBALS['OUTPUT']->write('Targets:' . PHP_EOL); $size = 0; $targets = array(); foreach ($project->getTargets() as $target) { $name = $target->getName(); $nameSize = strlen($name); $description = $target->getDescription(); if ($description !== null) { $size = $nameSize > $size ? $nameSize : $size; $targets[$name] = $description;
/** * Create a report about all available task in phing. * * @param PrintStream $out the stream to print the tasks report to * <tt>null</tt> for a missing stream (ie mapping). */ private static function doReportTasksAvailability(PrintStream $out) { $project = new Project(); $project->init(); $tasks = $project->getTaskDefinitions(); ksort($tasks); foreach ($tasks as $shortName => $task) { $out->println($shortName); } }
/** * init core project path */ public function init(Cache $cache) { parent::init($cache); $this->path = dirname(dirname(dirname(__DIR__))); $this->prefix = 'Cti\\Core\\'; }