public function run() { $arguments = $this->_config->getArguments(); $options = array_merge(array('new_version' => false, 'new_api' => false, 'new_state' => false, 'new_apistate' => false), $this->_config->getOptions()); if (!empty($options['updatexml']) || isset($arguments[0]) && $arguments[0] == 'update') { $action = !empty($options['action']) ? $options['action'] : 'update'; if (!empty($options['pretend']) && $action == 'update') { $action = 'diff'; } if (!empty($options['commit'])) { $options['commit'] = new Components_Helper_Commit($this->_output, $options); } $result = $this->_config->getComponent()->updatePackageXml($action, $options); if (!empty($options['new_version']) || !empty($options['new_api'])) { $this->_config->getComponent()->setVersion($options['new_version'], $options['new_api'], $options); } if (!empty($options['new_state']) || !empty($options['new_apistate'])) { $this->_config->getComponent()->setState($options['new_state'], $options['new_apistate'], $options); } if (!empty($options['commit'])) { $options['commit']->commit('Components updated the package.xml.'); } if ($result === true) { $this->_output->ok('Successfully updated package.xml of ' . $this->_config->getComponent()->getName() . '.'); } else { print $result; } } }
public function run() { $sequence = array(); if ($this->_doTask('unit')) { $sequence[] = 'unit'; } if ($this->_doTask('md')) { $sequence[] = 'md'; } if ($this->_doTask('cs')) { $sequence[] = 'cs'; } if ($this->_doTask('cpd')) { $sequence[] = 'cpd'; } if ($this->_doTask('lint')) { $sequence[] = 'lint'; } if ($this->_doTask('loc')) { $sequence[] = 'loc'; } if ($this->_doTask('dcd')) { $sequence[] = 'dcd'; } if (!empty($sequence)) { $this->_qc->run($sequence, $this->_config->getComponent(), $this->_config->getOptions()); } else { $this->_output->warn('Huh?! No tasks selected... All done!'); } }
public function run() { $composer = new Components_Helper_Composer(); $options = $this->_config->getOptions(); $options['logger'] = $this->_output; $composer->generateComposeJson($this->_config->getComponent()->getPackageXmlPath(), $options); }
/** * Return the path to the template directory * * @return string The path to the template directory. */ public function getTemplateDirectory() { $options = $this->_config->getOptions(); if (!isset($options['templatedir'])) { return Components_Constants::getDataDirectory(); } else { return $options['templatedir']; } }
public function run() { $options = $this->_config->getOptions(); if (!empty($options['no_tree'])) { print Horde_Yaml::dump($this->_config->getComponent()->getDependencies()); } else { $this->_dependencies->listTree($this->_config->getComponent(), $options); } }
public function run() { $options = $this->_config->getOptions(); if (!empty($options['destination'])) { $environment = realpath($options['destination']); if (!$environment) { $environment = $options['destination']; } } else { throw new Components_Exception('You MUST specify the path to the installation environment with the --destination flag!'); } if (empty($options['pearrc'])) { $options['pearrc'] = $environment . '/pear.conf'; $this->_output->info(sprintf('Undefined path to PEAR configuration file (--pearrc). Assuming %s for this installation.', $options['pearrc'])); } if (empty($options['horde_dir'])) { $options['horde_dir'] = $environment; $this->_output->info(sprintf('Undefined path to horde web root (--horde-dir). Assuming %s for this installation.', $options['horde_dir'])); } if (!empty($options['instructions'])) { if (!file_exists($options['instructions'])) { throw new Components_Exception(sprintf('Instructions file "%s" is missing!', $options['instructions'])); } $lines = explode("\n", file_get_contents($options['instructions'])); $result = array(); foreach ($lines as $line) { $trimmed = trim($line); if (empty($trimmed) || preg_match('/^#/', $trimmed)) { continue; } preg_match('/(.*):(.*)/', $trimmed, $matches); $id = $matches[1]; $c_options = $matches[2]; foreach (explode(',', $c_options) as $option) { $result[trim($id)][trim($option)] = true; } } $options['instructions'] = $result; } $target = $this->_factory->createEnvironment($environment, $options['pearrc']); $target->setResourceDirectories($options); //@todo: fix role handling $target->provideChannel('pear.horde.org', $options); $target->getPearConfig()->setChannels(array('pear.horde.org', true)); $target->getPearConfig()->set('horde_dir', $options['horde_dir'], 'user', 'pear.horde.org'); Components_Exception_Pear::catchError($target->getPearConfig()->store()); $this->_installer->installTree($target, $this->_config->getComponent(), $options); }
/** * Determine the requested component. * * @param array $arguments The arguments. * * @return array Two elements: The selected component as * Components_Component instance and optionally a string * representing the path to the specified source component. */ private function _determineComponent($arguments) { if (isset($arguments[0])) { if (in_array($arguments[0], $this->_actions['missing_argument'])) { return; } if ($this->_isPackageXml($arguments[0])) { $this->_config->shiftArgument(); return array($this->_dependencies->getComponentFactory()->createSource(dirname($arguments[0])), dirname($arguments[0])); } if (!in_array($arguments[0], $this->_actions['list'])) { if ($this->_isDirectory($arguments[0])) { $this->_config->shiftArgument(); return array($this->_dependencies->getComponentFactory()->createSource($arguments[0]), $arguments[0]); } $options = $this->_config->getOptions(); if (!empty($options['allow_remote'])) { $result = $this->_dependencies->getComponentFactory()->getResolver()->resolveName($arguments[0], 'pear.horde.org', $options); if ($result !== false) { $this->_config->shiftArgument(); return array($result, ''); } } throw new Components_Exception(sprintf(Components::ERROR_NO_ACTION_OR_COMPONENT, $arguments[0])); } } $cwd = getcwd(); if ($this->_isDirectory($cwd) && $this->_containsPackageXml($cwd)) { return array($this->_dependencies->getComponentFactory()->createSource($cwd), $cwd); } throw new Components_Exception(Components::ERROR_NO_COMPONENT); }
/** * Create the repository root helper. * * @return Components_Helper_Root The helper. */ public function createGitRoot() { if (isset($this->_first_source)) { return new Components_Helper_Root($this->_config->getOptions(), $this->_first_source); } else { return new Components_Helper_Root($this->_config->getOptions()); } }
public function run() { $options = $this->_config->getOptions(); $arguments = $this->_config->getArguments(); if (count($arguments) > 1 && $arguments[0] == 'changed') { $log = $arguments[1]; } else { throw new Components_Exception('Please provide a change log entry as additional argument!'); } if (!empty($options['commit'])) { $options['commit'] = new Components_Helper_Commit($this->_output, $options); } $this->_config->getComponent()->changed($log, $this->_helper, $options); if (!empty($options['commit'])) { $options['commit']->commit($log); } }
/** * Determine if this module should act. Run all required actions if it has * been instructed to do so. * * @param Components_Config $config The configuration. * * @return boolean True if the module performed some action. */ public function handle(Components_Config $config) { $options = $config->getOptions(); $arguments = $config->getArguments(); if (!empty($options['composer']) || isset($arguments[0]) && $arguments[0] == 'composer') { $this->_dependencies->getRunnerComposer()->run(); return true; } }
public function run() { $options = $this->_config->getOptions(); if (!empty($options['destination'])) { $archivedir = $options['destination']; } else { $archivedir = getcwd(); } $options['logger'] = $this->_output; $result = $this->_config->getComponent()->placeArchive($archivedir, $options); if (isset($result[2])) { $this->_output->pear($result[2]); } if (!empty($result[1])) { $this->_output->fail('Generating snapshot failed with:' . "\n\n" . join("\n", $result[1])); } else { $this->_output->ok('Generated snapshot ' . $result[0]); } }
public function run() { $docs_origin = $this->_config->getComponent()->getDocumentOrigin(); if ($docs_origin === null) { $this->_output->fail('The component does not offer a DOCS_ORIGIN file with instructions what should be fetched!'); return; } else { $this->_output->info(sprintf('Reading instructions from %s', $docs_origin[0])); $options = $this->_config->getOptions(); $helper = new Components_Helper_DocsOrigin($docs_origin, $this->_client); if (empty($options['pretend'])) { $helper->fetchDocuments($this->_output); } else { foreach ($helper->getDocuments() as $remote => $local) { $this->_output->info(sprintf('Would fetch remote %s into %s!', $remote, $docs_origin[1] . '/' . $local)); } } } }
/** * Determine if this module should act. Run all required actions if it has * been instructed to do so. * * @param Components_Config $config The configuration. * * @return boolean True if the module performed some action. */ public function handle(Components_Config $config) { $options = $config->getOptions(); //@todo Split into two different runners here if (!empty($options['cisetup'])) { $this->_dependencies->getRunnerCiSetup()->run(); return true; } if (!empty($options['ciprebuild'])) { $this->_dependencies->getRunnerCiPrebuild()->run(); return true; } }
public function run() { $arguments = $this->_config->getArguments(); $options = array_merge(array('new_version' => false, 'new_api' => false, 'new_state' => false, 'new_apistate' => false), $this->_config->getOptions()); if (!empty($options['updatexml']) || isset($arguments[0]) && $arguments[0] == 'update') { $action = !empty($options['action']) ? $options['action'] : 'update'; if (!empty($options['pretend']) && $action == 'update') { $action = 'diff'; } if (!empty($options['commit'])) { $options['commit'] = new Components_Helper_Commit($this->_output, $options); } $result = $this->_config->getComponent()->updatePackageXml($action, $options); if (!empty($options['new_version']) || !empty($options['new_api'])) { $this->_config->getComponent()->setVersion($options['new_version'], $options['new_api'], $options); if (!empty($options['new_version']) && !empty($options['sentinel'])) { $notes = new Components_Release_Notes($this->_output); $notes->setComponent($this->_config->getComponent()); $application_version = Components_Helper_Version::pearToHordeWithBranch($options['new_version'] . '-git', $notes->getBranch()); $sentinel_result = $this->_config->getComponent()->currentSentinel($options['new_version'] . '-git', $application_version, $options); foreach ($sentinel_result as $file) { $this->_output->ok($file); } } } if (!empty($options['new_state']) || !empty($options['new_apistate'])) { $this->_config->getComponent()->setState($options['new_state'], $options['new_apistate'], $options); } if (!empty($options['commit'])) { $options['commit']->commit('Components updated the package.xml.'); } if ($result === true) { $this->_output->ok('Successfully updated package.xml of ' . $this->_config->getComponent()->getName() . '.'); } else { print $result; } } }
/** * Return the application options. * * @return array The options. */ protected function getOptions() { return $this->_config->getOptions(); }
public function run() { $options = $this->_config->getOptions(); $templates = new Components_Helper_Templates_RecursiveDirectory($this->_config_application->getTemplateDirectory(), $options['cisetup']); $templates->write(array('config' => $this->_config)); }
public function run() { $this->_website_helper->update($this->_config->getComponent(), $this->_config->getOptions()); }
public function run() { $component = $this->_config->getComponent(); $options = $this->_config->getOptions(); $sequence = array(); $pre_commit = false; if ($this->_doTask('unittest')) { $unit = $this->_qc->getTask('unit', $component); if (!$unit->validate($options)) { $this->_output->info('Running ' . $unit->getName() . ' on ' . $component->getName() . "\n"); if ($unit->run($options)) { $this->_output->warn('Aborting due to unit test errors.'); return; } $this->_output->ok('No problems found in unit test.'); } $pre_commit = true; } if ($this->_doTask('timestamp')) { $sequence[] = 'Timestamp'; $pre_commit = true; } if ($this->_doTask('composer')) { $sequence[] = 'Composer'; $pre_commit = true; } if ($this->_doTask('sentinel')) { $sequence[] = 'CurrentSentinel'; $pre_commit = true; } if ($this->_doTask('package')) { $sequence[] = 'Package'; if ($this->_doTask('upload')) { $options['upload'] = true; } else { $this->_output->warn('Are you certain you don\'t want to upload the package? Add the "upload" option in case you want to correct your selection. Waiting 5 seconds ...'); sleep(5); } } else { if ($this->_doTask('upload')) { throw new Components_Exception('Selecting "upload" without "package" is not possible! Please add the "package" task if you want to upload the package!'); } } if ($this->_doTask('commit') && $pre_commit) { $sequence[] = 'CommitPreRelease'; } if ($this->_doTask('tag')) { $sequence[] = 'TagRelease'; } if ($this->_doTask('announce')) { $sequence[] = 'Announce'; } if ($this->_doTask('website')) { $sequence[] = 'Website'; } if ($this->_doTask('bugs')) { $sequence[] = 'Bugs'; } if ($this->_doTask('next')) { $sequence[] = 'NextVersion'; } if ($this->_doTask('nextsentinel')) { $sequence[] = 'NextSentinel'; } if (($this->_doTask('next') || $this->_doTask('nextsentinel')) && $this->_doTask('commit')) { $sequence[] = 'CommitPostRelease'; } if (in_array('CommitPreRelease', $sequence) || in_array('CommitPostRelease', $sequence)) { $options['commit'] = new Components_Helper_Commit($this->_output, $options); } $options['skip_invalid'] = $this->_doTask('release'); if (!empty($sequence)) { $this->_release->run($sequence, $component, $options); } else { $this->_output->warn('Huh?! No tasks selected... All done!'); } }