Merge remote branch 'kriswallsmith/process/default-executable'
* kriswallsmith/process/default-executable: [Process] added optional argument for default executable
This commit is contained in:
commit
94bbdff8c0
@ -57,9 +57,9 @@ class Configuration implements ConfigurationInterface
|
||||
->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(function() use ($finder) { $java = $finder->find('java'); return $java ? $java : '/usr/bin/java'; })->end()
|
||||
->scalarNode('node')->defaultValue(function() use ($finder) { $node = $finder->find('node'); return $node ? $node : '/usr/bin/node'; })->end()
|
||||
->scalarNode('sass')->defaultValue(function() use ($finder) { $saas = $finder->find('saas'); return $saas ? $saas : '/usr/bin/saas'; })->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()
|
||||
|
||||
// bundles
|
||||
|
@ -35,10 +35,11 @@ class ExecutableFinder
|
||||
* Finds an executable by name.
|
||||
*
|
||||
* @param string $name The executable name (without the extension)
|
||||
* @param string $default The default to return if no executable is found
|
||||
*
|
||||
* @return string|false The executable path or false if it cannot be found
|
||||
* @return string The executable path or default value
|
||||
*/
|
||||
public function find($name)
|
||||
public function find($name, $default = null)
|
||||
{
|
||||
$dirs = explode(PATH_SEPARATOR, getenv('PATH') ? getenv('PATH') : getenv('Path'));
|
||||
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array('');
|
||||
@ -50,6 +51,6 @@ class ExecutableFinder
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user