本文整理汇总了PHP中PhpBrew\Config::getPhpbrewRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getPhpbrewRoot方法的具体用法?PHP Config::getPhpbrewRoot怎么用?PHP Config::getPhpbrewRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getPhpbrewRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$root = Config::getPhpbrewRoot();
$php = Config::getCurrentPhpName();
$file = "{$root}/php/{$php}/etc/php.ini";
Utils::editor($file);
}
示例2: execute
public function execute()
{
$args = func_get_args();
// $currentVersion;
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
$buildDir = Config::getBuildDir();
$version = getenv('PHPBREW_PHP');
// XXX: get source dir from current build information
$sourceDir = $buildDir . DIRECTORY_SEPARATOR . $version;
$this->logger->info($sourceDir);
$cmd = new CommandBuilder('ctags');
$cmd->arg('--recurse');
$cmd->arg('-a');
$cmd->arg('-h');
$cmd->arg('.c.h.cpp');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'main');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'ext');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'Zend');
foreach ($args as $a) {
$cmd->arg($a);
}
$this->logger->info($cmd->__toString());
$cmd->execute();
$this->logger->info("Done");
}
示例3: execute
public function execute($version = null)
{
// get current version
if (!$version) {
$version = getenv('PHPBREW_PHP');
}
// $currentVersion;
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
$lookup = getenv('PHPBREW_LOOKUP_PREFIX');
// $versionBuildPrefix = Config::getVersionBuildPrefix($version);
// $versionBinPath = Config::getVersionBinPath($version);
echo "export PHPBREW_ROOT={$root}\n";
echo "export PHPBREW_HOME={$home}\n";
echo "export PHPBREW_LOOKUP_PREFIX={$lookup}\n";
if ($version !== false) {
// checking php version exists
$version = Utils::findLatestPhpVersion($version);
$targetPhpBinPath = Config::getVersionBinPath($version);
if (!is_dir($targetPhpBinPath)) {
throw new Exception("# php version: " . $version . " not exists.");
}
echo 'export PHPBREW_PHP=' . $version . "\n";
echo 'export PHPBREW_PATH=' . ($version ? Config::getVersionBinPath($version) : '') . "\n";
}
}
示例4: __construct
public function __construct()
{
$this->root = Config::getPhpbrewRoot();
$this->baseDir = $this->root . DIRECTORY_SEPARATOR . 'register';
if (!file_exists($this->baseDir)) {
mkdir($this->baseDir, 0755, true);
}
}
示例5: runUse
public static function runUse($version)
{
putenv("PHPBREW_BIN=" . Config::getPhpbrewHome() . '/bin');
putenv("PHPBREW_HOME=" . Config::getPhpbrewHome());
putenv("PHPBREW_LOOKUP_PREFIX=/usr/local/Cellar:/usr/local");
putenv("PHPBREW_PATH=" . Config::getPhpbrewHome() . "/php/php-{$version}/bin");
putenv("PHPBREW_PHP=php-{$version}");
putenv("PHPBREW_ROOT=" . Config::getPhpbrewRoot());
putenv('PATH=' . getenv('PHPBREW_PATH') . ':' . self::getCleanPath());
}
示例6: execute
public function execute($buildName)
{
// this block is important for tests only
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
putenv("PHPBREW_ROOT={$root}");
putenv("PHPBREW_HOME={$home}");
putenv("PHPBREW_PHP={$buildName}");
putenv("PHPBREW_PATH={$root}/{$buildName}/bin");
putenv("PHPBREW_BIN={$home}/bin");
$this->logger->warning("You should not see this, if you see this, it means you didn't load the ~/.phpbrew/bashrc script, please check if bashrc is sourced in your shell.");
}
示例7: execute
public function execute()
{
// $currentVersion;
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
$buildDir = Config::getBuildDir();
$buildPrefix = Config::getBuildPrefix();
// $versionBuildPrefix = Config::getVersionBuildPrefix($version);
// $versionBinPath = Config::getVersionBinPath($version);
if (!file_exists($root)) {
mkdir($root, 0755, true);
}
touch($root . DIRECTORY_SEPARATOR . '.metadata_never_index');
// prevent spotlight index here
if ($root != $home) {
touch($home . DIRECTORY_SEPARATOR . '.metadata_never_index');
}
if ($this->options->{'config'} !== null) {
copy($this->options->{'config'}, $root . DIRECTORY_SEPARATOR . 'config.yaml');
}
if (!file_exists($home)) {
mkdir($home, 0755, true);
}
if (!file_exists($buildPrefix)) {
mkdir($buildPrefix, 0755, true);
}
if (!file_exists($buildDir)) {
mkdir($buildDir, 0755, true);
}
// write bashrc script to phpbrew home
file_put_contents($home . '/bashrc', $this->getBashScript());
echo <<<EOS
Phpbrew environment is initialized, required directories are created under
{$home}
Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, phpbrew should be up and fully functional from there:
source {$home}/bashrc
To enable PHP version info in your shell prompt, please set PHPBREW_SET_PROMPT=1
in your `~/.bashrc` before you source `~/.phpbrew/bashrc`
export PHPBREW_SET_PROMPT=1
For further instructions, simply run `phpbrew` to see the help message.
Enjoy phpbrew at \$HOME!!
EOS;
}
示例8: prepareForVersion
public function prepareForVersion($version)
{
$home = Config::getPhpbrewRoot();
$buildDir = Config::getBuildDir();
$variantsDir = Config::getVariantsDir();
$buildPrefix = Config::getVersionBuildPrefix($version);
if (!file_exists($variantsDir)) {
mkdir($variantsDir, 0755, true);
}
if (!file_exists($buildDir)) {
mkdir($buildDir, 0755, true);
}
if (!file_exists($buildPrefix)) {
mkdir($buildPrefix, 0755, true);
}
}
示例9: run
public function run(Build $build = NULL)
{
$dirs = array();
$dirs[] = Config::getPhpbrewRoot();
$dirs[] = Config::getPhpbrewHome();
$dirs[] = Config::getBuildDir();
$dirs[] = Config::getDistFileDir();
$dirs[] = Config::getVariantsDir();
if ($build) {
$dirs[] = Config::getInstallPrefix() . DIRECTORY_SEPARATOR . $build->getName();
}
foreach ($dirs as $dir) {
if (!file_exists($dir)) {
$this->logger->debug("Creating directory {$dir}");
mkdir($dir, 0755, true);
}
}
}
示例10: execute
public function execute($appName)
{
$apps = AppStore::all();
if (!isset($apps[$appName])) {
throw new Exception("App {$appName} not found.");
}
$app = $apps[$appName];
$targetDir = Config::getPhpbrewRoot() . DIRECTORY_SEPARATOR . 'bin';
$target = $targetDir . DIRECTORY_SEPARATOR . $app['as'];
$downloader = new UrlDownloader($this->logger, $this->options);
$downloader->download($app['url'], $target);
$this->logger->info("Changing permissions to 0755");
if ($mod = $this->options->chmod) {
chmod($target, octdec($mod));
} else {
chmod($target, 0755);
}
$this->logger->info("Downloaded at {$target}");
}
示例11: execute
public function execute($name)
{
switch ($name) {
case 'home':
echo Config::getPhpbrewRoot();
break;
case 'build':
echo Config::getBuildDir();
break;
case 'bin':
echo Config::getCurrentPhpBin();
break;
case 'include':
echo Config::getVersionBuildPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'include';
break;
case 'etc':
echo Config::getVersionBuildPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'etc';
break;
}
}
示例12: execute
public function execute($buildName = NULL)
{
// get current version
if (!$buildName) {
$buildName = getenv('PHPBREW_PHP');
}
// $currentVersion;
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
$lookup = getenv('PHPBREW_LOOKUP_PREFIX');
$this->logger->writeln("export PHPBREW_ROOT={$root}");
$this->logger->writeln("export PHPBREW_HOME={$home}");
$this->logger->writeln("export PHPBREW_LOOKUP_PREFIX={$lookup}");
if ($buildName !== false) {
// checking php version existence
$targetPhpBinPath = Config::getVersionBinPath($buildName);
if (is_dir($targetPhpBinPath)) {
echo 'export PHPBREW_PHP=' . $buildName . "\n";
echo 'export PHPBREW_PATH=' . ($buildName ? Config::getVersionBinPath($buildName) : '') . "\n";
}
}
}
示例13: execute
public function execute($name)
{
switch ($name) {
case 'root':
echo Config::getPhpbrewRoot();
break;
case 'home':
echo Config::getPhpbrewHome();
break;
case 'config-scan':
echo Config::getCurrentPhpConfigScanPath();
break;
case 'dist':
echo Config::getDistFileDir();
break;
case 'build':
echo Config::getCurrentBuildDir();
break;
case 'bin':
echo Config::getCurrentPhpBin();
break;
case 'include':
echo Config::getVersionInstallPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'include';
break;
case 'extension-src':
case 'ext-src':
echo Config::getCurrentBuildDir() . DIRECTORY_SEPARATOR . 'ext';
break;
case 'extension-dir':
case 'ext-dir':
case 'ext':
echo ini_get('extension_dir');
break;
case 'etc':
echo Config::getVersionInstallPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'etc';
break;
}
}
示例14: execute
public function execute($versionName = NULL)
{
$args = func_get_args();
array_shift($args);
// $currentVersion;
$root = Config::getPhpbrewRoot();
$home = Config::getPhpbrewHome();
if ($versionName) {
$sourceDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . $versionName;
} else {
if (!getenv('PHPBREW_PHP')) {
$this->logger->error("Error: PHPBREW_PHP environment variable is not defined.");
$this->logger->error(" This command requires you specify a PHP version from your build list.");
$this->logger->error(" And it looks like you haven't switched to a version from the builds that were built with PHPBrew.");
$this->logger->error("Suggestion: Please install at least one PHP with your prefered version and switch to it.");
return false;
}
$sourceDir = Config::getCurrentBuildDir();
}
if (!file_exists($sourceDir)) {
return $this->logger->error("{$sourceDir} does not exist.");
}
$this->logger->info("Scanning " . $sourceDir);
$cmd = new CommandBuilder('ctags');
$cmd->arg('--recurse');
$cmd->arg('-a');
$cmd->arg('-h');
$cmd->arg('.c.h.cpp');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'main');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'ext');
$cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'Zend');
foreach ($args as $a) {
$cmd->arg($a);
}
$this->logger->debug($cmd->__toString());
$cmd->execute();
$this->logger->info("Done");
}
示例15: putPathEnvFor
public static function putPathEnvFor($buildName)
{
$root = Config::getPhpbrewRoot();
$buildDir = $root . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR . $buildName;
// re-build path
$paths = explode(':', getenv('PATH'));
$paths = array_filter($paths, function ($p) use($root) {
return strpos($p, $root) === False;
});
array_unshift($paths, $buildDir . DIRECTORY_SEPARATOR . 'bin');
putenv('PATH=' . join(':', $paths));
}