getMatches() публичный Метод

public getMatches ( ) : null | array
Результат null | array
Пример #1
0
 /**
  * Tag a new ZF2 LTS release.
  *
  * @param Route $route
  * @param Console $console
  * @return int
  */
 public function __invoke(Route $route, Console $console)
 {
     $opts = $route->getMatches();
     $minor = $opts['version'];
     $patchfiles = $opts['patchfile'];
     $this->verbose = $opts['verbose'] || $opts['v'];
     $currentVersion = $this->detectVersion($minor, $console);
     // checkout release-$minor branch based on release-$currentVersion
     if (0 !== $this->exec(sprintf('%s checkout -b release-%s release-%s', $this->git, $minor, $currentVersion), $console)) {
         $console->writeLine(sprintf('[ERROR] Could not create new branch release-%s based on tag release-%s!', $minor, $currentVersion), Color::WHITE, Color::RED);
         return 1;
     }
     // apply patchfile
     foreach ($patchfiles as $patchfile) {
         if (0 !== $this->exec(sprintf('%s am < %s', $this->git, $patchfile), $console)) {
             $console->writeLine(sprintf('[ERROR] Could not cleanly apply patchfile "%s"!', $patchfile), Color::WHITE, Color::RED);
             return 1;
         }
     }
     // Create message for release
     $message = $this->getCommitMessages($currentVersion);
     if (false === $message) {
         $console->writeLine('[ERROR] Could not retrieve patch messages!', Color::WHITE, Color::RED);
         return 1;
     }
     $nextVersion = $this->incrementVersion($currentVersion);
     $message = sprintf("Zend Framework %s\n\n%s", $nextVersion, $message);
     $console->writeLine('[DONE] Please verify the patch, and then execute:', Color::GREEN);
     $console->writeLine(sprintf('    git tag -s -m "%s" release-%s', $message, $nextVersion));
 }
Пример #2
0
 /**
  * Release components.
  *
  * Uses the version, exclude, basePath, and verbose (or "v") flags provided
  * with the route to tag the next maintenance release of all components
  * (with the exception of those in the exclude list).
  *
  * Changes directory to the basePath prior to tagging each component.
  *
  * @param Route $route
  * @param Console $console
  * @return int
  */
 public function __invoke(Route $route, Console $console)
 {
     $opts = $route->getMatches();
     $minor = $opts['version'];
     $version = $minor;
     $exclude = $opts['exclude'];
     $path = $opts['basePath'];
     $this->verbose = $opts['verbose'] || $opts['v'];
     $this->emit(sprintf("Using git: %s\n", $this->git), $console, Color::BLUE);
     chdir($path);
     foreach ($this->components as $component) {
         if (in_array($component, $exclude, true)) {
             $this->emit(sprintf("[SKIP] %s\n", $component), $console, Color::GREEN);
             continue;
         }
         $this->emit(sprintf("[START] %s\n", $component), $console, Color::GREEN);
         if (!is_dir($component)) {
             $console->writeLine(sprintf('[ERROR] Component directory for "%s" does not exist!', $component), Color::WHITE, Color::RED);
             continue;
         }
         chdir($component);
         $version = $this->tagComponent($component, $minor, $version, $console);
         chdir($path);
         $this->emit(sprintf('[DONE] %s tagged at version %s', $component, $version), $console, Color::GREEN);
     }
     $console->writeLine('');
     $console->writeLine('[DONE] Please verify tags and push the following tag:', Color::GREEN);
     $console->writeLine('       release-' . $version);
     return 0;
 }
Пример #3
0
 public function testMatchesArePopulatedOnSuccessfulMatch()
 {
     $route = new Route('foo', 'foo bar');
     $matches = $route->match(['foo', 'bar']);
     $this->assertInternalType('array', $matches);
     $this->assertSame($matches, $route->getMatches());
 }
Пример #4
0
 /**
  * Perform all operations
  *
  * Facade method that accepts incoming CLI arguments, parses them, and
  * determines what workflows to execute.
  *
  * @param  Route   $route
  * @param  Console $console
  * @return int     Exit status
  */
 public function __invoke(Route $route, Console $console)
 {
     $this->resetStateForExecution($console);
     $opts = (object) $route->getMatches();
     if (!$this->validatePackage($opts->package, $opts)) {
         return $this->exitCode;
     }
     if (!$this->validateApplicationPath($opts->target, $opts)) {
         return $this->exitCode;
     }
     if (!$this->validateModules($opts->modules, $opts->target)) {
         return $this->exitCode;
     }
     $console->writeLine(sprintf('Creating package "%s"...', $opts->package), Color::BLUE);
     $tmpDir = $this->createTmpDir();
     if (false === $tmpDir) {
         return $this->exitCode;
     }
     $tmpDir = $this->prepareZpk($tmpDir, basename($opts->package, '.' . $opts->format), $opts->version, $opts->format, $opts->deploymentxml, $opts->zpkdata, $opts->appConfigPath);
     if (false === $tmpDir) {
         return $this->exitCode;
     }
     $this->cloneApplication($opts->target, $tmpDir, $opts->gitignore, $opts->vendor, $opts->modules, $opts->configs);
     $this->copyModules($opts->modules, $opts->target, $tmpDir);
     if (false === $this->executeComposer($opts->vendor, $opts->composer, $tmpDir)) {
         return $this->exitCode;
     }
     $this->removeTestDir($tmpDir . '/vendor');
     if (false === $this->createPackage($opts->package, $tmpDir, $opts->format)) {
         return $this->exitCode;
     }
     self::recursiveDelete($opts->format === 'zpk' ? dirname($tmpDir) : $tmpDir);
     $this->console->writeLine(sprintf('[DONE] Package %s successfully created (%d bytes)', $opts->package, filesize($opts->package)), Color::GREEN);
     return self::INFO_NO_ERROR;
 }
Пример #5
0
 public function __invoke(Route $route, AdapterInterface $console)
 {
     $params = $this->request->getContent();
     $type = $params[1] ?? null;
     $path = $params[2] ?? null;
     $zeusUrl = $params[3] ?? null;
     $opts = $route->getMatches();
     $verbose = $opts['verbose'] || $opts['v'];
     //$quiet = $opts['quiet'] || $opts['q'];
     if (!file_exists($path)) {
         $console->writeLine("Path {$path} not found.", ColorInterface::RED);
         return;
     }
     $this->apiClient->getZendClient()->setUri($zeusUrl);
     foreach (glob($path . '/*.kharon') as $filename) {
         if ($verbose) {
             $console->writeLine("Sending {$filename} ...", ColorInterface::BLUE);
         }
         $data = file_get_contents($filename);
         $this->send($data, sprintf('/v1/%s/collect', $type));
         unlink($filename);
     }
     if ($verbose) {
         $console->writeLine('Done.', ColorInterface::GREEN);
     }
 }
Пример #6
0
 /**
  * Rewrite the patchfile.
  *
  * - --patchfile - original patch
  * - --target - filename to save new patch to
  * - --component - component for which the patch was written
  *
  * @param Route $route
  * @param Console $console
  * @return int
  */
 public function __invoke(Route $route, Console $console)
 {
     $opts = $route->getMatches();
     $patchfile = $opts['patchfile'];
     $target = $opts['target'];
     $component = $opts['component'];
     if ($component === 'zend-i18n-resources') {
         return $this->rewriteResources($patchfile, $target, $console);
     }
     return $this->rewrite($component, $patchfile, $target, $console);
 }
Пример #7
0
 /**
  * Create a new local branch and bump the changelog version entry.
  *
  * @param Route $route
  * @param Console $console
  * @return int
  */
 public function __invoke(Route $route, Console $console)
 {
     $opts = $route->getMatches();
     $version = $opts['version'];
     $base = $opts['base'];
     $this->verbose = $opts['verbose'] || $opts['v'];
     // checkout version/bump branch based on $base
     if (0 !== $this->exec(sprintf('%s checkout -b version/bump %s', $this->git, $base), $console)) {
         $console->writeLine(sprintf('[ERROR] Could not create new version/bump branch based on branch %s!', $base), Color::WHITE, Color::RED);
         return 1;
     }
     // Update CHANGELOG.md file
     $this->updateChangelog($version);
     // Commit version bump
     $this->commitVersionBump($version, $console);
     $message = sprintf('[DONE] Please verify and merge the branch back to %s', $base);
     if ($base === 'master') {
         $message .= ' as well as develop';
     }
     $console->writeLine($message, Color::GREEN);
     $console->writeLine('Once done merging, remove this branch using:');
     $console->writeLine('    git branch -d version/bump');
     return 0;
 }