当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::getBuildDir方法代码示例

本文整理汇总了PHP中PhpBrew\Config::getBuildDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getBuildDir方法的具体用法?PHP Config::getBuildDir怎么用?PHP Config::getBuildDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpBrew\Config的用法示例。


在下文中一共展示了Config::getBuildDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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");
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:26,代码来源:CtagsCommand.php

示例2: arguments

 public function arguments($args)
 {
     $args->add('extensions')->suggestions(function () {
         $extdir = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
         return array_filter(scandir($extdir), function ($d) use($extdir) {
             return $d != '.' && $d != '..' && is_dir($extdir . DIRECTORY_SEPARATOR . $d);
         });
     });
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:9,代码来源:CleanCommand.php

示例3: purgeExtension

 public function purgeExtension(Extension $ext)
 {
     if ($sourceDir = $ext->getSourceDirectory()) {
         $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
         $extName = $ext->getExtensionName();
         $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName;
         if (file_exists($extensionDir)) {
             Utils::system("rm -rvf {$extensionDir}");
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:11,代码来源:ExtensionManager.php

示例4: 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;
    }
开发者ID:bensb,项目名称:phpbrew,代码行数:52,代码来源:InitCommand.php

示例5: execute

 public function execute()
 {
     if ($this->options->{'php'} !== null) {
         $php = Utils::findLatestPhpVersion($this->options->{'php'});
     } else {
         $php = Config::getCurrentPhpName();
     }
     $buildDir = Config::getBuildDir();
     $extDir = $buildDir . DIRECTORY_SEPARATOR . $php . DIRECTORY_SEPARATOR . 'ext';
     // listing all local extensions
     if (version_compare('php-' . phpversion(), $php, '==')) {
         $loaded = array_map('strtolower', get_loaded_extensions());
     } else {
         $this->logger->info('PHP version is different from current active version.');
         $this->logger->info('Only available extensions are listed.');
         $this->logger->info('You will not see which of them are loaded.');
         $loaded = array();
     }
     // list for extensions which are not enabled
     $extensions = array();
     if (is_dir($extDir)) {
         $fp = opendir($extDir);
         if ($fp !== false) {
             while ($file = readdir($fp)) {
                 if ($file === '.' || $file === '..') {
                     continue;
                 }
                 if (is_file($extDir . '/' . $file)) {
                     continue;
                 }
                 $n = strtolower(preg_replace('#-[\\d\\.]+$#', '', $file));
                 if (in_array($n, $loaded)) {
                     continue;
                 }
                 $extensions[] = $n;
             }
             sort($loaded);
             sort($extensions);
             closedir($fp);
         }
     }
     $this->logger->info('Loaded extensions:');
     foreach ($loaded as $ext) {
         $this->logger->info("  [*] {$ext}");
     }
     $this->logger->info('Available extensions:');
     foreach ($extensions as $ext) {
         $this->logger->info("  [ ] {$ext}");
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:50,代码来源:ExtCommand.php

示例6: 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);
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:16,代码来源:PrepareDirectoryTask.php

示例7: 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);
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:18,代码来源:PrepareDirectoryTask.php

示例8: execute

 public function execute($version)
 {
     if ($this->options->all) {
         $buildDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . $version;
         if (!file_exists($buildDir)) {
             $this->logger->info("Source directory " . $buildDir . " does not exist.");
         } else {
             $this->logger->info("Source directory " . $buildDir . " found, deleting...");
             Utils::recursive_unlink($buildDir, $this->logger);
         }
     } else {
         $make = new MakeTask($this->logger);
         $make->setQuiet();
         $build = new Build($version);
         if ($make->clean($build)) {
             $this->logger->info("Distribution is cleaned up. Woof! ");
         }
     }
 }
开发者ID:nanasess,项目名称:phpbrew,代码行数:19,代码来源:CleanCommand.php

示例9: renameSourceDirectory

 public function renameSourceDirectory(Extension $ext)
 {
     $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
     $extName = $ext->getExtensionName();
     $name = $ext->getName();
     $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName;
     $extensionExtractDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $name;
     if ($name != $extName) {
         $this->logger->info("===> Rename source directory to {$extensionDir}...");
         $cmds = array("rm -rf {$extensionDir}", "mv {$extensionExtractDir} {$extensionDir}");
         foreach ($cmds as $cmd) {
             $this->logger->debug($cmd);
             Utils::system($cmd);
         }
         // replace source directory to new source directory
         $sourceDir = str_replace($extensionExtractDir, $extensionDir, $ext->getSourceDirectory());
         $ext->setSourceDirectory($sourceDir);
         $ext->setName($extName);
     }
 }
开发者ID:nanasess,项目名称:phpbrew,代码行数:20,代码来源:ExtensionDownloader.php

示例10: 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;
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:20,代码来源:PathCommand.php

示例11: execute

 public function execute($version)
 {
     if (!preg_match('/^php-/', $version)) {
         $version = 'php-' . $version;
     }
     $info = PhpSource::getVersionInfo($version, $this->options->old);
     if (!$info) {
         throw new Exception("Version {$version} not found.");
     }
     $prepare = new PrepareDirectoryTask($this->logger);
     $prepare->prepareForVersion($version);
     $buildDir = Config::getBuildDir();
     $dw = new DirectorySwitch();
     $dw->cd($buildDir);
     $download = new DownloadTask($this->logger);
     $targetDir = $download->downloadByVersionString($version, $this->options->old, $this->options->force);
     if (!file_exists($targetDir)) {
         throw new Exception("Download failed.");
     }
     $this->logger->info("Done, please look at: {$buildDir}/{$targetDir}");
     $dw->back();
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:22,代码来源:DownloadCommand.php

示例12: execute

 public function execute($versionName = null)
 {
     $args = func_get_args();
     array_shift($args);
     // $currentVersion;
     $root = Config::getRoot();
     $home = Config::getHome();
     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('-R');
     $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');
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:38,代码来源:CtagsCommand.php

示例13: testFindLatestPhpVersion

 public function testFindLatestPhpVersion()
 {
     $this->markTestSkipped("We should use a virtual file system here (vsfStream)");
     $buildDir = Config::getBuildDir();
     $paths = array();
     $paths[] = $buildDir . DIRECTORY_SEPARATOR . 'php-12.3.4';
     $paths[] = $buildDir . DIRECTORY_SEPARATOR . 'php-12.3.6';
     // Create paths
     foreach ($paths as $path) {
         if (!is_dir($path)) {
             mkdir($path);
         }
     }
     is('12.3.6', Utils::findLatestPhpVersion('12'));
     is('12.3.6', Utils::findLatestPhpVersion('12.3'));
     is('12.3.4', Utils::findLatestPhpVersion('12.3.4'));
     is(false, Utils::findLatestPhpVersion('11'));
     // Cleanup paths
     foreach ($paths as $path) {
         if (is_dir($path)) {
             rmdir($path);
         }
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:24,代码来源:UtilsTest.php

示例14: buildMetaFromName

 public function buildMetaFromName($name)
 {
     $path = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext/' . $name;
     $xml = $path . '/package.xml';
     $m4 = $path . '/config.m4';
     if (file_exists($xml)) {
         $this->logger->warning("===> Using xml extension meta");
         $meta = new ExtensionMetaXml($xml);
     } elseif (file_exists($m4)) {
         $this->logger->warning("===> Using m4 extension meta");
         $meta = new ExtensionMetaM4($m4);
     } else {
         $this->logger->warning("===> Using polyfill extension meta");
         $meta = new ExtensionMetaPolyfill($name);
     }
     return $meta;
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:17,代码来源:Extension.php

示例15: lookup

 public static function lookup($packageName, array $lookupDirectories = array(), $fallback = true)
 {
     if ($fallback) {
         // Always push the PHP source directory to the end of the list for the fallback.
         $lookupDirectories[] = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
     }
     foreach ($lookupDirectories as $lookupDir) {
         if (!file_exists($lookupDir)) {
             continue;
         }
         $extensionDir = $lookupDir . DIRECTORY_SEPARATOR . $packageName;
         if ($ext = self::createFromDirectory($packageName, $extensionDir)) {
             return $ext;
         }
     }
     return new Extension($packageName);
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:17,代码来源:ExtensionFactory.php


注:本文中的PhpBrew\Config::getBuildDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。