Author: Fabien Potencier (fabien@symfony.com)
Author: Johannes M. Schmitt (schmittjoh@gmail.com)
 /**
  * @return string
  */
 public function find()
 {
     if (null === ($executable = $this->executableFinder->find('docker-compose'))) {
         throw new \RuntimeException('Unable to find docker-compose binary. ' . 'You should run `docker:install` to set up your Docker environment');
     }
     return $executable;
 }
 public function testCustomizedDrivers()
 {
     $object = new DriversContainer();
     $executableFinder = new ExecutableFinder();
     $php = $executableFinder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to find mandatory PHP executable');
     }
     $object['configuration'] = array('ffmpeg.threads' => 42, 'ffmpeg.ffmpeg.timeout' => 42, 'ffmpeg.ffprobe.timeout' => 42, 'ffmpeg.ffmpeg.binaries' => $php, 'ffmpeg.ffprobe.binaries' => $php, 'imagine.driver' => 'gd', 'gs.timeout' => 42, 'gs.binaries' => $php, 'mp4box.timeout' => 42, 'mp4box.binaries' => $php, 'swftools.timeout' => 42, 'swftools.pdf2swf.binaries' => $php, 'swftools.swfrender.binaries' => $php, 'swftools.swfextract.binaries' => $php, 'unoconv.binaries' => $php, 'unoconv.timeout' => 42);
     $this->assertEquals($php, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['ghostscript.transcoder']->getProcessBuilderFactory()->getBinary());
     $this->assertInstanceOf('Imagine\\Gd\\Imagine', $object['imagine']);
     $this->assertEquals($php, $object['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['unoconv']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $object['mp4box']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals(42, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads'));
     $this->assertEquals(42, $object['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['ghostscript.transcoder']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['unoconv']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $object['mp4box']->getProcessBuilderFactory()->getTimeout());
 }
示例#3
0
 function render($context = null, $vars = array())
 {
     $options = $this->options;
     $compress = @$options["compress"] ?: false;
     $outputFile = tempnam(sys_get_temp_dir(), 'metatemplate_template_less_output');
     $finder = new ExecutableFinder();
     $bin = @$this->options["less_bin"] ?: self::DEFAULT_LESSC;
     $cmd = $finder->find($bin);
     if ($cmd === null) {
         throw new \UnexpectedValueException("'{$bin}' executable was not found. Make sure it's installed.");
     }
     if ($compress) {
         $cmd .= ' -x';
     }
     if (array_key_exists('include_path', $this->options)) {
         $cmd .= sprintf('--include-path %s', escapeshellarg(join(PATH_SEPARATOR, (array) $this->options['include_path'])));
     }
     $cmd .= " --no-color - {$outputFile}";
     $process = new Process($cmd);
     $process->setStdin($this->getData());
     if ($this->isFile()) {
         $process->setWorkingDirectory(dirname($this->source));
     }
     $process->setEnv(array('PATH' => getenv("PATH")));
     $process->run();
     $content = @file_get_contents($outputFile);
     @unlink($outputFile);
     if (!$process->isSuccessful()) {
         throw new \RuntimeException("{$cmd} returned an error: " . $process->getErrorOutput());
     }
     return $content;
 }
示例#4
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $outputDir = $this->outputDirHandler->handleOutputDir($input, $output);
     $guiBin = null;
     if ($input->getOption('gui')) {
         $finder = new ExecutableFinder();
         $guiBin = $finder->find($input->getOption('gui-bin'));
         if (null === $guiBin) {
             throw new \InvalidArgumentException(sprintf('Could not locate GUI bin "%s"', $input->getOption('gui-bin')));
         }
     }
     $generatedFiles = [];
     $this->runnerHandler->runFromInput($input, $output, ['executor' => ['executor' => 'xdebug_profile', 'output_dir' => $outputDir, 'callback' => function ($iteration) use($outputDir, $guiBin, &$generatedFiles) {
         $generatedFiles[] = $generatedFile = $outputDir . DIRECTORY_SEPARATOR . XDebugUtil::filenameFromIteration($iteration, '.cachegrind');
         if ($guiBin) {
             $process = new Process(sprintf($guiBin . ' ' . $generatedFile));
             $process->run();
         }
     }], 'iterations' => [1]]);
     $output->write(PHP_EOL);
     $output->writeln(sprintf('<info>%s profile(s) generated:</info>', count($generatedFiles)));
     $output->write(PHP_EOL);
     foreach ($generatedFiles as $generatedFile) {
         if (!file_exists($generatedFile)) {
             throw new \InvalidArgumentException(sprintf('Profile "%s" was not generated. Maybe you do not have XDebug installed?', $generatedFile));
         }
         $output->writeln(sprintf('    %s', $generatedFile));
     }
 }
示例#5
0
 function render($context = null, $vars = array())
 {
     $finder = new ExecutableFinder();
     $bin = @$this->options["tsc_bin"] ?: self::DEFAULT_TSC;
     $cmd = $finder->find($bin);
     if ($cmd === null) {
         throw new \UnexpectedValueException("'{$bin}' executable was not found. Make sure it's installed.");
     }
     $inputFile = sys_get_temp_dir() . '/pipe_typescript_input_' . uniqid() . '.ts';
     file_put_contents($inputFile, $this->getData());
     $outputFile = tempnam(sys_get_temp_dir(), 'pipe_typescript_output_') . '.js';
     $cmd .= " --out " . escapeshellarg($outputFile) . ' ' . escapeshellarg($inputFile);
     $process = new Process($cmd);
     $process->setEnv(array('PATH' => @$_SERVER['PATH'] ?: join(PATH_SEPARATOR, array("/bin", "/sbin", "/usr/bin", "/usr/local/bin", "/usr/local/share/npm/bin"))));
     if ($this->isFile()) {
         $process->setWorkingDirectory(dirname($this->source));
     }
     $process->run();
     unlink($inputFile);
     if ($process->getErrorOutput()) {
         throw new \RuntimeException("tsc({$this->source}) returned an error:\n {$process->getErrorOutput()}");
     }
     $data = file_get_contents($outputFile);
     unlink($outputFile);
     return $data;
 }
示例#6
0
 /**
  * Generates the configuration tree builder.
  *
  * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  */
 public function getConfigTreeBuilder()
 {
     $builder = new TreeBuilder();
     $finder = new ExecutableFinder();
     $builder->root('assetic')->children()->booleanNode('debug')->defaultValue($this->debug)->end()->booleanNode('use_controller')->defaultValue($this->debug)->end()->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end()->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end()->scalarNode('java')->defaultValue($finder->find('java', '/usr/bin/java'))->end()->scalarNode('node')->defaultValue($finder->find('node', '/usr/bin/node'))->end()->scalarNode('sass')->defaultValue($finder->find('sass', '/usr/bin/sass'))->end()->end()->fixXmlConfig('bundle')->children()->arrayNode('bundles')->defaultValue($this->bundles)->requiresAtLeastOneElement()->prototype('scalar')->validate()->ifNotInArray($this->bundles)->thenInvalid('%s is not a valid bundle.')->end()->end()->end()->end()->fixXmlConfig('asset')->children()->arrayNode('assets')->addDefaultsIfNotSet()->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('array')->beforeNormalization()->ifTrue(function ($v) {
         return !is_array($v);
     })->then(function ($v) {
         return array('inputs' => array($v));
     })->end()->beforeNormalization()->always()->then(function ($v) {
         // cast scalars as array
         foreach (array('input', 'inputs', 'filter', 'filters') as $key) {
             if (isset($v[$key]) && !is_array($v[$key])) {
                 $v[$key] = array($v[$key]);
             }
         }
         // organize arbitrary options
         foreach ($v as $key => $value) {
             if (!in_array($key, array('input', 'inputs', 'filter', 'filters', 'option', 'options'))) {
                 $v['options'][$key] = $value;
                 unset($v[$key]);
             }
         }
         return $v;
     })->end()->fixXmlConfig('input')->fixXmlConfig('filter')->children()->arrayNode('inputs')->prototype('scalar')->end()->end()->arrayNode('filters')->prototype('scalar')->end()->end()->arrayNode('options')->useAttributeAsKey('name')->prototype('variable')->end()->end()->end()->end()->end()->end()->fixXmlConfig('filter')->children()->arrayNode('filters')->addDefaultsIfNotSet()->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('variable')->treatNullLike(array())->validate()->ifTrue(function ($v) {
         return !is_array($v);
     })->thenInvalid('The assetic.filters config %s must be either null or an array.')->end()->end()->end()->end()->children()->arrayNode('twig')->addDefaultsIfNotSet()->defaultValue(array())->fixXmlConfig('function')->children()->arrayNode('functions')->addDefaultsIfNotSet()->defaultValue(array())->useAttributeAsKey('name')->prototype('variable')->treatNullLike(array())->validate()->ifTrue(function ($v) {
         return !is_array($v);
     })->thenInvalid('The assetic.twig.functions config %s must be either null or an array.')->end()->end()->end()->end()->end()->end();
     return $builder;
 }
示例#7
0
 public static function setUpBeforeClass()
 {
     $oldCwd = getcwd();
     self::$gitRepo = sys_get_temp_dir() . '/composer-git-' . rand() . '/';
     $locator = new ExecutableFinder();
     if (!$locator->find('git')) {
         self::$skipped = 'This test needs a git binary in the PATH to be able to run';
         return;
     }
     if (!mkdir(self::$gitRepo) || !chdir(self::$gitRepo)) {
         self::$skipped = 'Could not create and move into the temp git repo ' . self::$gitRepo;
         return;
     }
     // init
     $process = new ProcessExecutor();
     $process->execute('git init', $null);
     touch('foo');
     $process->execute('git add foo', $null);
     $process->execute('git commit -m init', $null);
     // non-composed tag & branch
     $process->execute('git tag 0.5.0', $null);
     $process->execute('git branch oldbranch', $null);
     // add composed tag & master branch
     $composer = array('name' => 'a/b');
     file_put_contents('composer.json', json_encode($composer));
     $process->execute('git add composer.json', $null);
     $process->execute('git commit -m addcomposer', $null);
     $process->execute('git tag 0.6.0', $null);
     // add feature-a branch
     $process->execute('git checkout -b feature-a', $null);
     file_put_contents('foo', 'bar feature');
     $process->execute('git add foo', $null);
     $process->execute('git commit -m change-a', $null);
     // add version to composer.json
     $process->execute('git checkout master', $null);
     $composer['version'] = '1.0.0';
     file_put_contents('composer.json', json_encode($composer));
     $process->execute('git add composer.json', $null);
     $process->execute('git commit -m addversion', $null);
     // create tag with wrong version in it
     $process->execute('git tag 0.9.0', $null);
     // create tag with correct version in it
     $process->execute('git tag 1.0.0', $null);
     // add feature-b branch
     $process->execute('git checkout -b feature-b', $null);
     file_put_contents('foo', 'baz feature');
     $process->execute('git add foo', $null);
     $process->execute('git commit -m change-b', $null);
     // add 1.0 branch
     $process->execute('git checkout master', $null);
     $process->execute('git branch 1.0', $null);
     // add 1.0.x branch
     $process->execute('git branch 1.1.x', $null);
     // update master to 2.0
     $composer['version'] = '2.0.0';
     file_put_contents('composer.json', json_encode($composer));
     $process->execute('git add composer.json', $null);
     $process->execute('git commit -m bump-version', $null);
     chdir($oldCwd);
 }
 public function testConfiguredUsage()
 {
     $executableFinder = new ExecutableFinder();
     $php = $executableFinder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to find mandatory PHP executable');
     }
     $app = new Application();
     $app->register(new MediaAlchemystServiceProvider(), array('media-alchemyst.configuration' => array('ffmpeg.threads' => 42, 'ffmpeg.ffmpeg.timeout' => 42, 'ffmpeg.ffprobe.timeout' => 42, 'ffmpeg.ffmpeg.binaries' => $php, 'ffmpeg.ffprobe.binaries' => $php, 'imagine.driver' => 'gd', 'gs.timeout' => 42, 'gs.binaries' => $php, 'mp4box.timeout' => 42, 'mp4box.binaries' => $php, 'swftools.timeout' => 42, 'swftools.pdf2swf.binaries' => $php, 'swftools.swfrender.binaries' => $php, 'swftools.swfextract.binaries' => $php, 'unoconv.binaries' => $php, 'unoconv.timeout' => 42)));
     $drivers = $app['media-alchemyst']->getDrivers();
     $this->assertEquals($php, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['ghostscript.transcoder']->getProcessBuilderFactory()->getBinary());
     $this->assertInstanceOf('Imagine\\Gd\\Imagine', $drivers['imagine']);
     $this->assertEquals($php, $drivers['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['unoconv']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals($php, $drivers['mp4box']->getProcessBuilderFactory()->getBinary());
     $this->assertEquals(42, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getConfiguration()->get('ffmpeg.threads'));
     $this->assertEquals(42, $drivers['ffmpeg.ffmpeg']->getFFMpegDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['ffmpeg.ffprobe']->getFFProbeDriver()->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['ghostscript.transcoder']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['pdf2swf']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['swfextract']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['swftools.driver-container']['swfrender']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['unoconv']->getProcessBuilderFactory()->getTimeout());
     $this->assertEquals(42, $drivers['mp4box']->getProcessBuilderFactory()->getTimeout());
 }
示例#9
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $outputDir = $input->getOption('outdir');
     $guiBin = null;
     if ($input->getOption('gui')) {
         $finder = new ExecutableFinder();
         $guiBin = $finder->find($input->getOption('gui-bin'));
         if (null === $guiBin) {
             throw new \InvalidArgumentException(sprintf('Could not locate GUI bin "%s"', $input->getOption('gui-bin')));
         }
     }
     if (!$this->filesystem->exists($outputDir)) {
         $output->writeln(sprintf('<comment>// creating non-existing directory %s</comment>', $outputDir));
         $this->filesystem->mkdir($outputDir);
     }
     $generatedFiles = array();
     $this->runnerHandler->runFromInput($input, $output, array('executor' => array('executor' => 'xdebug', 'output_dir' => $outputDir, 'callback' => function ($iteration) use($outputDir, $guiBin, &$generatedFiles) {
         $generatedFiles[] = $generatedFile = $outputDir . DIRECTORY_SEPARATOR . XDebugUtil::filenameFromIteration($iteration);
         if ($guiBin) {
             $process = new Process(sprintf($guiBin . ' ' . $generatedFile));
             $process->run();
         }
     }), 'iterations' => 1));
     $output->write(PHP_EOL);
     $output->writeln(sprintf('<info>%s profile(s) generated:</info>', count($generatedFiles)));
     $output->write(PHP_EOL);
     foreach ($generatedFiles as $generatedFile) {
         if (!file_exists($generatedFile)) {
             throw new \InvalidArgumentException(sprintf('Profile "%s" was not generated. Maybe you do not have XDebug installed?', $generatedFile));
         }
         $this->output->writeln(sprintf('    %s', $generatedFile));
     }
 }
示例#10
0
 /**
  * Creates a new runner.
  *
  * @param string|null $binDir The path to Composer's "bin-dir".
  */
 public function __construct($binDir = null)
 {
     $phpFinder = new PhpExecutableFinder();
     if (!($php = $phpFinder->find())) {
         throw new RuntimeException('The "php" command could not be found.');
     }
     $puliFinder = new ExecutableFinder();
     // Search:
     // 1. in the current working directory
     // 2. in Composer's "bin-dir"
     // 3. in the system path
     $searchPath = array_merge(array(getcwd()), (array) $binDir);
     // Search "puli.phar" in the PATH and the current directory
     if (!($puli = $puliFinder->find('puli.phar', null, $searchPath))) {
         // Search "puli" in the PATH and Composer's "bin-dir"
         if (!($puli = $puliFinder->find('puli', null, $searchPath))) {
             throw new RuntimeException('The "puli"/"puli.phar" command could not be found.');
         }
     }
     if (Path::hasExtension($puli, '.bat', true)) {
         $this->puli = $puli;
     } else {
         $this->puli = $php . ' ' . $puli;
     }
 }
 public function testLoadDefaultBin()
 {
     $this->extension->load(array(), $this->container);
     $finder = new ExecutableFinder();
     $bowerLocation = $finder->find('bower', '/usr/bin/bower');
     $this->assertParameter($bowerLocation, 'sp_bower.bower.bin');
 }
示例#12
0
 public function findExecutable($name, $default = null, array $extraDirs = array())
 {
     $finder = new ExecutableFinder();
     $extraDirs = array_merge($this->getDefaultDirs(), $extraDirs);
     $executable = $finder->find($name, $default, $extraDirs);
     return is_executable($executable) ? $executable : false;
 }
示例#13
0
 public function setUp()
 {
     $finder = new ExecutableFinder();
     $unoconv = $finder->find('unoconv');
     if (null === $unoconv) {
         $this->markTestSkipped('Unable to detect unoconv, mandatory for this test');
     }
 }
 protected function findExecutable($name, $serverKey = null)
 {
     if ($serverKey && isset($_SERVER[$serverKey])) {
         return $_SERVER[$serverKey];
     }
     $finder = new ExecutableFinder();
     return $finder->find($name);
 }
示例#15
0
 protected function findExecutable($name, $server = null)
 {
     if (!is_null($server) and getenv($server) !== false) {
         return $_SERVER[$server];
     }
     $finder = new ExecutableFinder();
     return $finder->find($name);
 }
示例#16
0
 protected function findExecutable($name, $server = null)
 {
     if (!is_null($server) and isset($_SERVER[$server])) {
         return $_SERVER[$server];
     }
     $finder = new ExecutableFinder();
     return $finder->find($name);
 }
示例#17
0
文件: Client.php 项目: phecho/Gitlib
 public function __construct($path = null)
 {
     if (!$path) {
         $finder = new ExecutableFinder();
         $path = $finder->find('git', '/usr/bin/git');
     }
     $this->setPath($path);
 }
 protected function getPhpBinary()
 {
     $finder = new ExecutableFinder();
     $php = $finder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to find a php binary');
     }
     return $php;
 }
示例#19
0
 public function __construct($pathToVagrant = null)
 {
     if ($pathToVagrant) {
         $this->command = $pathToVagrant;
     } else {
         $finder = new ExecutableFinder();
         $this->command = $finder->find('vagrant');
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getConfigTreeBuilder()
 {
     $treeBuilder = new TreeBuilder();
     $finder = new ExecutableFinder();
     $treeBuilder->root('html_compressor')->children()->booleanNode('enabled')->defaultTrue()->end()->scalarNode('java')->defaultValue(function () use($finder) {
         return $finder->find('java', '/usr/bin/java');
     })->end()->scalarNode('jar')->isRequired()->cannotBeEmpty()->end()->arrayNode('options')->normalizeKeys(false)->prototype('scalar')->end()->end();
     return $treeBuilder;
 }
示例#21
0
 public function isScriptingSupported()
 {
     $executableFinder = new ExecutableFinder();
     foreach (['composer', 'composer.phar'] as $candidateName) {
         if ($composerPath = $executableFinder->find($candidateName, null, array(getcwd()))) {
             return true;
         }
     }
     return false;
 }
示例#22
0
 /**
  * {@inheritDoc}
  */
 public function download(PackageInterface $package, $path)
 {
     if (null === self::$hasSystemUnzip) {
         $finder = new ExecutableFinder();
         self::$hasSystemUnzip = (bool) $finder->find('unzip');
     }
     if (!class_exists('ZipArchive') && !self::$hasSystemUnzip) {
         throw new \RuntimeException('The zip extension and unzip command are both missing, skipping');
     }
     return parent::download($package, $path);
 }
 protected function setUp()
 {
     $executableFinder = new ExecutableFinder();
     if (!$executableFinder->find('unoconv')) {
         $this->markTestSkipped('Unoconv is not installed');
     }
     $this->object = new Document2Image(new DriversContainer(), $this->getFsManager());
     $this->specs = new Image();
     $this->source = $this->getMediaVorus()->guess(__DIR__ . '/../../../files/Hello.odt');
     $this->dest = __DIR__ . '/../../../files/output.jpg';
 }
示例#24
0
 public function testCreateWithConfiguration()
 {
     $finder = new ExecutableFinder();
     $unoconv = $finder->find('unoconv');
     if (null === $unoconv) {
         $this->markTestSkipped('Unable to detect unoconv, mandatory for this test');
     }
     $conf = $this->createConfigurationMock();
     $unoconv = Unoconv::create($conf);
     $this->assertEquals($conf, $unoconv->getConfiguration());
 }
 public function testRegisterWithCustomBinary()
 {
     $finder = new ExecutableFinder();
     $MP4Box = $finder->find('MP4Box');
     if (null === $MP4Box) {
         $this->markTestSkipped('Unable to detect MP4Box, required for this test');
     }
     $app = new Application();
     $app->register(new GhostscriptServiceProvider(), array('ghostscript.configuration' => array('gs.binaries' => $MP4Box)));
     $this->assertEquals($MP4Box, $app['ghostscript.transcoder']->getProcessBuilderfactory()->getBinary());
 }
 public function testGetSetBinary()
 {
     $finder = new ExecutableFinder();
     $phpUnit = $finder->find('phpunit');
     if (null === $phpUnit) {
         $this->markTestSkipped('Unable to detect phpunit binary, skipping');
     }
     $factory = $this->getProcessBuilderFactory(static::$phpBinary);
     $factory->useBinary($phpUnit);
     $this->assertEquals($phpUnit, $factory->getBinary());
 }
 public function testInstallerUsesPhpConf()
 {
     $finder = new ExecutableFinder();
     $php = $finder->find('php');
     if (null === $php) {
         $this->markTestSkipped('Unable to detect PHP binary');
     }
     $app = self::$DI['cli'];
     $app['conf']->set(['binaries', 'php_binary'], null);
     $app->register(new PluginServiceProvider());
     $this->assertInstanceOf('Alchemy\\Phrasea\\Plugin\\Management\\ComposerInstaller', $app['plugins.composer-installer']);
 }
示例#28
0
 protected static function buildFixtures()
 {
     $finder = Finder::create();
     Filesystem::create()->copyDir(__DIR__ . '/fixtures', static::$tmpDir, $finder);
     chdir(static::$tmpDir);
     $exFinder = new ExecutableFinder();
     if (!is_executable($executable = $exFinder->find('composer.phar'))) {
         $executable = $exFinder->find('composer');
     }
     $process = new Process($executable . ' dumpautoload');
     $process->run();
     //static::$composerOutput = $process->getOutput();
 }
示例#29
0
 /**
  * Constructs a GitWrapper object.
  *
  * @param string|null $gitBinary
  *   The path to the Git binary. Defaults to null, which uses Symfony's
  *   ExecutableFinder to resolve it automatically.
  *
  * @throws \GitWrapper\GitException
  *   Throws an exception if the path to the Git binary couldn't be resolved
  *   by the ExecutableFinder class.
  */
 public function __construct($gitBinary = null)
 {
     if (null === $gitBinary) {
         // @codeCoverageIgnoreStart
         $finder = new ExecutableFinder();
         $gitBinary = $finder->find('git');
         if (!$gitBinary) {
             throw new GitException('Unable to find the Git executable.');
         }
         // @codeCoverageIgnoreEnd
     }
     $this->setGitBinary($gitBinary);
 }
示例#30
0
 /**
  * {@inheritdoc}
  */
 public function handle()
 {
     if (!$this->processLauncher->isSupported()) {
         throw new RuntimeException('The ProcessLauncher must be supported for the man help to run.');
     }
     if (!$this->manBinary) {
         $this->manBinary = $this->executableFinder->find('man');
     }
     if (!$this->manBinary) {
         throw new RuntimeException('The "man" binary was not found.');
     }
     return $this->processLauncher->launchProcess(escapeshellcmd($this->manBinary) . ' -l %path%', array('path' => $this->path), false);
 }