コード例 #1
0
ファイル: pusher.php プロジェクト: andrewolobo/mpTracker
 protected function setArgumentHandlers()
 {
     parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $remote) {
         if (sizeof($remote) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $remote, $script->getName()));
         }
         $script->setRemote(reset($remote));
     }, array('-tr', '--to-remote'), '<string>', $this->locale->_('<string> will be used as remote'))->addArgumentHandler(function ($script, $argument, $branch) {
         if (sizeof($branch) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setBranch(reset($branch));
     }, array('-ib', '--in-branch'), '<string>', $this->locale->_('<string> will be used as remote branch'))->addArgumentHandler(function ($script, $argument, $tagFile) {
         if (sizeof($tagFile) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setTagFile(reset($tagFile));
     }, array('-ib', '--in-branch'), '<path>', $this->locale->_('File <path> will be used to store last tag'));
     return $this;
 }
コード例 #2
0
ファイル: builder.php プロジェクト: GuillaumeDievart/atoum
 protected function setArgumentHandlers()
 {
     $builder = $this;
     return parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $files) use($builder) {
         if (sizeof($files) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         foreach ($files as $file) {
             if (file_exists($file) === false) {
                 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Runner configuration file path \'%s\' is invalid'), $file));
             }
             if (is_readable($file) === false) {
                 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Unable to read runner configuration file \'%s\''), $file));
             }
             $script->addRunnerConfigurationFile($file);
         }
     }, array('-rc', '--runner-configuration-files'), '<file>', $this->locale->_('Use <file> as configuration file for runner'))->addArgumentHandler(function ($script, $argument, $path) {
         if (sizeof($path) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setPhpPath(current($path));
     }, array('-p', '--php'), '<path>', $this->locale->_('Path to PHP binary'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setWorkingDirectory(current($directory));
     }, array('-w', '--working-directory'), '<directory>', $this->locale->_('Checkout file from repository in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setDestinationDirectory(current($directory));
     }, array('-d', '--destination-directory'), '<directory>', $this->locale->_('Save phar in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setScoreDirectory(current($directory));
     }, array('-sd', '--score-directory'), '<directory>', $this->locale->_('Save score in <directory>'))->addArgumentHandler(function ($script, $argument, $directory) {
         if (sizeof($directory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setErrorsDirectory(current($directory));
     }, array('-ed', '--errors-directory'), '<directory>', $this->locale->_('Save errors in <directory>'))->addArgumentHandler(function ($script, $argument, $url) {
         if (sizeof($url) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->getVcs()->setRepositoryUrl(current($url));
     }, array('-r', '--repository-url'), '<url>', $this->locale->_('Url of repository'))->addArgumentHandler(function ($script, $argument, $file) {
         if (sizeof($file) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setRevisionFile(current($file));
     }, array('-rf', '--revision-file'), '<file>', $this->locale->_('Save last revision in <file>'))->addArgumentHandler(function ($script, $argument, $version) {
         if (sizeof($version) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setVersion(current($version));
     }, array('-v', '--version'), '<string>', $this->locale->_('Version <string> will be used as version name'))->addArgumentHandler(function ($script, $argument, $unitTestRunnerScript) {
         if (sizeof($unitTestRunnerScript) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setUnitTestRunnerScript(current($unitTestRunnerScript));
     }, array('-utrs', '--unit-test-runner-script'))->addArgumentHandler(function ($script, $argument, $pharGeneratorScript) {
         if (sizeof($pharGeneratorScript) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setPharGeneratorScript(current($pharGeneratorScript));
     }, array('-pgs', '--phar-generator-script'))->addArgumentHandler(function ($script, $argument, $reportTitle) {
         if (sizeof($reportTitle) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setReportTitle(current($reportTitle));
     }, array('-rt', '--report-title'));
 }
コード例 #3
0
ファイル: pusher.php プロジェクト: xihewang/atoum
 protected function setArgumentHandlers()
 {
     parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $remote) {
         if (sizeof($remote) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $remote, $script->getName()));
         }
         $script->setRemote(reset($remote));
     }, array('-tr', '--to-remote'), '<string>', $this->locale->_('<string> will be used as remote'))->addArgumentHandler(function ($script, $argument, $tagFile) {
         if (sizeof($tagFile) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setTagFile(reset($tagFile));
     }, array('-tf', '--tag-file'), '<path>', $this->locale->_('File <path> will be used to store last tag'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagMajorVersion();
     }, array('-MR', '--major-release'), null, $this->locale->_('Tag a new major version'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagMinorVersion();
     }, array('-mr', '--minor-release'), null, $this->locale->_('Tag a new minor version'))->addArgumentHandler(function ($script, $argument, $value) {
         $script->tagPatchVersion();
     }, array('-pr', '--patch-release'), null, $this->locale->_('Tag a new patch version'));
     return $this;
 }
コード例 #4
0
ファイル: runner.php プロジェクト: eroluysal/atoum
 protected function parseArguments(array $arguments)
 {
     $configTestPaths = $this->runner->getTestPaths();
     $this->runner->resetTestPaths();
     parent::parseArguments($arguments);
     $this->runner->setTestPaths($this->runner->getTestPaths() ?: $configTestPaths);
     return $this;
 }
コード例 #5
0
ファイル: treemap.php プロジェクト: xihewang/atoum
 protected function setArgumentHandlers()
 {
     return parent::setArgumentHandlers()->addArgumentHandler(function ($script, $argument, $projectName) {
         if (sizeof($projectName) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setProjectName(current($projectName));
     }, array('-pn', '--project-name'), '<string>', $this->locale->_('Set project name <string>'))->addArgumentHandler(function ($script, $argument, $projectUrl) {
         if (sizeof($projectUrl) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getUrl()));
         }
         $script->setProjectUrl(current($projectUrl));
     }, array('-pu', '--project-url'), '<string>', $this->locale->_('Set project url <string>'))->addArgumentHandler(function ($script, $argument, $codeUrl) {
         if (sizeof($codeUrl) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getUrl()));
         }
         $script->setCodeUrl(current($codeUrl));
     }, array('-cu', '--code-url'), '<string>', $this->locale->_('Set code url <string>'))->addArgumentHandler(function ($script, $argument, $directories) {
         if (sizeof($directories) <= 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         foreach ($directories as $directory) {
             $script->addDirectory($directory);
         }
     }, array('-d', '--directories'), '<directory>...', $this->locale->_('Scan all directories <directory>'))->addArgumentHandler(function ($script, $argument, $outputDirectory) {
         if (sizeof($outputDirectory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setOutputDirectory(current($outputDirectory));
     }, array('-od', '--output-directory'), '<directory>', $this->locale->_('Generate treemap in directory <directory>'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->getOnlyJsonFile(true);
     }, array('-ojf', '--only-json-file'), null, $this->locale->_('Generate only JSON file'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\sloc());
     }, array('--sloc'), null, $this->locale->_('Count source line of code (SLOC)'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\token());
     }, array('--php-token'), null, $this->locale->_('Count PHP tokens'))->addArgumentHandler(function ($script, $argument, $value) {
         if (sizeof($value) != 0) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->addAnalyzer(new analyzers\size());
     }, array('--file-size'), null, $this->locale->_('Get file size'))->addArgumentHandler(function ($script, $argument, $htmlDirectory) {
         if (sizeof($htmlDirectory) != 1) {
             throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));
         }
         $script->setHtmlDirectory(current($htmlDirectory));
     }, array('-hd', '--html-directory'), '<directory>', $this->locale->_('Use html files in <directory> to generate treemap'));
 }