本文整理汇总了PHP中sfFilesystem::sh方法的典型用法代码示例。如果您正苦于以下问题:PHP sfFilesystem::sh方法的具体用法?PHP sfFilesystem::sh怎么用?PHP sfFilesystem::sh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfFilesystem
的用法示例。
在下文中一共展示了sfFilesystem::sh方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
*/
require_once dirname(__FILE__) . '/../../lib/exception/sfException.class.php';
require_once dirname(__FILE__) . '/../../lib/task/sfFilesystem.class.php';
require_once dirname(__FILE__) . '/../../lib/util/sfFinder.class.php';
require_once dirname(__FILE__) . '/../../lib/vendor/lime/lime.php';
if (!isset($argv[1])) {
throw new Exception('You must provide version prefix.');
}
if (!isset($argv[2])) {
throw new Exception('You must provide stability status (alpha/beta/stable).');
}
$stability = $argv[2];
$filesystem = new sfFilesystem();
if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2) {
$version_prefix = $argv[1];
$result = $filesystem->sh('svn status -u ' . getcwd());
if (preg_match('/Status against revision\\:\\s+(\\d+)\\s*$/im', $result, $match)) {
$version = $match[1];
}
if (!isset($version)) {
throw new Exception('Unable to find last SVN revision.');
}
// make a PEAR compatible version
$version = $version_prefix . '.' . $version;
} else {
$version = $argv[1];
}
print sprintf("Releasing symfony version \"%s\".\n", $version);
// tests
$result = $filesystem->sh('php data/bin/symfony symfony:test');
if (0 != $result) {
示例2: _cleanupAdminGenModules
protected function _cleanupAdminGenModules()
{
$fs = new sfFilesystem($this->getContext()->getEventDispatcher(), new sfFormatter());
foreach ($this->_modules as $module) {
$this->info('Removing admin gen module "' . $module . '"');
$fs->sh('rm -rf ' . sfConfig::get('sf_app_module_dir') . '/' . $module);
}
$fs->sh('rm -rf ' . sfConfig::get('sf_test_dir') . '/functional/backend');
$fs->sh('rm -rf ' . sfConfig::get('sf_data_dir') . '/*.sqlite');
}
示例3: callLesscCompiler
/**
* Calls lessc compiler for LESS file
*
* @param string $lessFile a LESS file
* @param string $cssFile a CSS file
*
* @return string output
*/
public function callLesscCompiler($lessFile, $cssFile)
{
// Setting current file. We will output this var if compiler throws error
$this->currentFile = $lessFile;
// Compile with lessc
$fs = new sfFilesystem();
$command = sprintf('lessc "%s" "%s"', $lessFile, $cssFile);
if ('1.3.0' <= SYMFONY_VERSION) {
try {
$fs->execute($command, null, array($this, 'throwCompilerError'));
} catch (RuntimeException $e) {
return false;
}
} else {
$fs->sh($command);
}
// Setting current file to null
$this->currentFile = null;
return file_get_contents($cssFile);
}
示例4: callLesscCompiler
/**
* Calls lessc compiler for LESS file
*
* @param string $lessFile a LESS file
* @param string $cssFile a CSS file
* @return string output
*/
public function callLesscCompiler($lessFile, $cssFile)
{
// Compile with lessc
$fs = new sfFilesystem();
$command = sprintf('lessc%s "%s" "%s"', $this->isUseGrowl() ? ' -g' : '', $lessFile, $cssFile);
if ('1.3.0' <= SYMFONY_VERSION) {
try {
$fs->execute($command, null, array($this, 'throwCompilerError'));
} catch (RuntimeException $e) {
return false;
}
} else {
$fs->sh($command);
}
return file_get_contents($cssFile);
}
示例5: callLesscCompiler
/**
* Calls lessc compiler for LESS file
*
* @param string $lessFile a LESS file
* @param string $cssFile a CSS file
*
* @return string output
*/
public function callLesscCompiler($lessFile, $cssFile)
{
// Setting current file. We will output this var if compiler throws error
$this->currentFile = $lessFile;
if (self::getConfig()->isUseLessphp()) {
require_once sfConfig::get('sf_lib_dir') . '/vendor/lessphp/lessc.inc.php';
$less = new lessc($lessFile);
file_put_contents($cssFile, $less->parse());
} else {
// Compile with lessc
$fs = new sfFilesystem();
$command = sprintf('lessc "%s" "%s"', $lessFile, $cssFile);
if ('1.3.0' <= SYMFONY_VERSION) {
try {
$fs->execute($command, null, array($this, 'throwCompilerError'));
} catch (RuntimeException $e) {
return false;
}
} else {
$fs->sh($command);
}
}
// Setting current file to null
$this->currentFile = null;
return file_get_contents($cssFile);
}