getComponent() public method

Return the selected component.
public getComponent ( ) : Components_Component
return Components_Component The selected component.
コード例 #1
0
ファイル: Qc.php プロジェクト: jubinpatel/horde
 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!');
     }
 }
コード例 #2
0
ファイル: Update.php プロジェクト: raz0rsdge/horde
 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;
         }
     }
 }
コード例 #3
0
ファイル: Composer.php プロジェクト: jubinpatel/horde
 public function run()
 {
     $composer = new Components_Helper_Composer();
     $options = $this->_config->getOptions();
     $options['logger'] = $this->_output;
     $composer->generateComposeJson($this->_config->getComponent()->getPackageXmlPath(), $options);
 }
コード例 #4
0
ファイル: Dependencies.php プロジェクト: horde/horde
 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);
     }
 }
コード例 #5
0
ファイル: Change.php プロジェクト: raz0rsdge/horde
 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);
     }
 }
コード例 #6
0
ファイル: Snapshot.php プロジェクト: jubinpatel/horde
 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]);
     }
 }
コード例 #7
0
ファイル: Fetchdocs.php プロジェクト: horde/horde
 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));
             }
         }
     }
 }
コード例 #8
0
ファイル: Installer.php プロジェクト: raz0rsdge/horde
 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);
 }
コード例 #9
0
ファイル: Update.php プロジェクト: horde/horde
 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;
         }
     }
 }
コード例 #10
0
ファイル: Webdocs.php プロジェクト: horde/horde
 public function run()
 {
     $this->_website_helper->update($this->_config->getComponent(), $this->_config->getOptions());
 }
コード例 #11
0
ファイル: Release.php プロジェクト: raz0rsdge/horde
 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!');
     }
 }