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


PHP Config::getPhpbrewHome方法代码示例

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


在下文中一共展示了Config::getPhpbrewHome方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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";
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:26,代码来源:EnvCommand.php

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

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

示例5: 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

示例6: 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

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

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

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

示例10: execute

    public function execute()
    {
        // $currentVersion;
        $root = Config::getPhpbrewRoot();
        $home = Config::getPhpbrewHome();
        $buildDir = Config::getBuildDir();
        $buildPrefix = Config::getInstallPrefix();
        // $versionBuildPrefix = Config::getVersionInstallPrefix($version);
        // $versionBinPath     = Config::getVersionBinPath($version);
        if (!file_exists($root)) {
            mkdir($root, 0755, true);
        }
        $paths = array();
        $paths[] = $home;
        $paths[] = $root;
        $paths[] = $buildDir;
        $paths[] = $buildPrefix;
        foreach ($paths as $p) {
            $this->logger->info("Checking directory {$p}");
            if (!file_exists($p)) {
                $this->logger->info("Creating directory {$p}");
                mkdir($p, 0755, true);
            }
        }
        $this->logger->info('Creating .metadata_never_index to prevent SpotLight indexing');
        touch($root . DIRECTORY_SEPARATOR . '.metadata_never_index');
        // prevent spotlight index here
        touch($home . DIRECTORY_SEPARATOR . '.metadata_never_index');
        if ($configFile = $this->options->{'config'}) {
            if (!file_exists($configFile)) {
                return $this->logger->error("{$configFile} does not exist.");
            }
            $this->logger->debug("Using yaml config from {$configFile}");
            copy($configFile, $root . DIRECTORY_SEPARATOR . 'config.yaml');
        }
        $this->logger->writeln($this->formatter->format("Initialization successfully finished!", 'strong_green'));
        $this->logger->writeln($this->formatter->format("<=====================================================>", 'strong_white'));
        // write bashrc script to phpbrew home
        file_put_contents($home . '/bashrc', $this->getBashScript());
        // write phpbrew.fish script to phpbrew home
        file_put_contents($home . '/phpbrew.fish', $this->getFishScript());
        if (strpos(getenv("SHELL"), "fish") !== false) {
            $initConfig = <<<EOS
Paste the following line(s) to the end of your ~/.config/fish/config.fish and start a
new shell, phpbrew should be up and fully functional from there:

    source {$home}/phpbrew.fish
EOS;
        } else {
            $initConfig = <<<EOS
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
EOS;
        }
        echo <<<EOS
Phpbrew environment is initialized, required directories are created under

    {$home}

{$initConfig}

For further instructions, simply run `phpbrew` to see the help message.

Enjoy phpbrew at \$HOME!!


EOS;
        $this->logger->writeln($this->formatter->format("<=====================================================>", 'strong_white'));
    }
开发者ID:hechunwen,项目名称:phpbrew,代码行数:76,代码来源:InitCommand.php

示例11: execute


//.........这里部分代码省略.........
        if (!$this->options->{'no-configure'}) {
            $configureTask = new ConfigureTask($this->logger, $this->options);
            $configureTask->run($build, $variants);
            unset($configureTask);
            // trigger __destruct
        }
        $buildTask = new BuildTask($this->logger, $this->options);
        $buildTask->run($build);
        unset($buildTask);
        // trigger __destruct
        if ($this->options->{'test'}) {
            $testTask = new TestTask($this->logger, $this->options);
            $testTask->run($build);
            unset($testTask);
            // trigger __destruct
        }
        if (!$this->options->{'no-install'}) {
            $installTask = new InstallTask($this->logger, $this->options);
            $installTask->install($build);
            unset($installTask);
            // trigger __destruct
        }
        if ($this->options->{'post-clean'}) {
            $clean->clean($build);
        }
        $dsym = new DSymTask($this->logger, $this->options);
        $dsym->patch($build, $this->options);
        // copy php-fpm config
        $this->logger->info("---> Creating php-fpm.conf");
        $phpFpmConfigPath = "sapi/fpm/php-fpm.conf";
        $phpFpmTargetConfigPath = $build->getEtcDirectory() . DIRECTORY_SEPARATOR . 'php-fpm.conf';
        if (file_exists($phpFpmConfigPath)) {
            if (!file_exists($phpFpmTargetConfigPath)) {
                copy($phpFpmConfigPath, $phpFpmTargetConfigPath);
            } else {
                $this->logger->notice("Found existing {$phpFpmTargetConfigPath}.");
            }
        }
        $this->logger->info("---> Creating php.ini");
        $phpConfigPath = $build->getSourceDirectory() . DIRECTORY_SEPARATOR . ($this->options->production ? 'php.ini-production' : 'php.ini-development');
        $this->logger->info("---> Copying {$phpConfigPath} ");
        if (file_exists($phpConfigPath) && !$this->options->dryrun) {
            $targetConfigPath = $build->getEtcDirectory() . DIRECTORY_SEPARATOR . 'php.ini';
            if (file_exists($targetConfigPath)) {
                $this->logger->notice("Found existing {$targetConfigPath}.");
            } else {
                // TODO: Move this to PhpConfigPatchTask
                // move config file to target location
                copy($phpConfigPath, $targetConfigPath);
            }
            if (!$this->options->{'no-patch'}) {
                $config = parse_ini_file($targetConfigPath, true);
                $configContent = file_get_contents($targetConfigPath);
                $patched = false;
                if (!isset($config['date']['timezone'])) {
                    $this->logger->info('---> Found date.timezone is not set, patching...');
                    // Replace current timezone
                    if ($timezone = ini_get('date.timezone')) {
                        $this->logger->info("---> Found date.timezone, patching config timezone with {$timezone}");
                        $configContent = preg_replace('/^;?date.timezone\\s*=\\s*.*/im', "date.timezone = {$timezone}", $configContent);
                    }
                    $patched = true;
                }
                if (!isset($config['phar']['readonly'])) {
                    $pharReadonly = ini_get('phar.readonly');
                    // 0 or "" means readonly is disabled manually
                    if (!$pharReadonly) {
                        $this->logger->info("---> Disabling phar.readonly option.");
                        $configContent = preg_replace('/^;?phar.readonly\\s*=\\s*.*/im', "phar.readonly = 0", $configContent);
                    }
                }
                file_put_contents($targetConfigPath, $configContent);
            }
        }
        $this->logger->info("Initializing pear config...");
        $home = Config::getPhpbrewHome();
        @mkdir("{$home}/tmp/pear/temp", 0755, true);
        @mkdir("{$home}/tmp/pear/cache_dir", 0755, true);
        @mkdir("{$home}/tmp/pear/download_dir", 0755, true);
        system("pear config-set temp_dir {$home}/tmp/pear/temp");
        system("pear config-set cache_dir {$home}/tmp/pear/cache_dir");
        system("pear config-set download_dir {$home}/tmp/pear/download_dir");
        $this->logger->info("Enabling pear auto-discover...");
        system("pear config-set auto_discover 1");
        $this->logger->debug("Source directory: " . $targetDir);
        $buildName = $build->getName();
        $this->logger->info("Congratulations! Now you have PHP with {$version} as {$buildName}");
        echo <<<EOT
To use the newly built PHP, try the line(s) below:

    \$ phpbrew use {$buildName}

Or you can use switch command to switch your default php to {$buildName}:

    \$ phpbrew switch {$buildName}

Enjoy!

EOT;
    }
开发者ID:nanasess,项目名称:phpbrew,代码行数:101,代码来源:InstallCommand.php

示例12: execute


//.........这里部分代码省略.........
        foreach ($variantInfo['enabled_variants'] as $name => $value) {
            $build->enableVariant($name, $value);
        }
        foreach ($variantInfo['disabled_variants'] as $name => $value) {
            $build->disableVariant($name);
            if ($build->hasVariant($name)) {
                $this->logger->warn("Removing variant {$name} since we've disabled it from command.");
                $build->removeVariant($name);
            }
        }
        $build->setExtraOptions($variantInfo['extra_options']);
        if ($options->clean) {
            $clean = new CleanTask($this->logger);
            $clean->cleanByVersion($version);
        }
        $buildLogFile = Config::getVersionBuildLogPath($version);
        $configure = new \PhpBrew\Tasks\ConfigureTask($this->logger);
        $configure->configure($build, $this->options);
        $buildTask = new BuildTask($this->logger);
        $buildTask->setLogPath($buildLogFile);
        $buildTask->build($build, $this->options);
        if ($options->{'test'}) {
            $test = new TestTask($this->logger);
            $test->setLogPath($buildLogFile);
            $test->test($build, $this->options);
        }
        $install = new InstallTask($this->logger);
        $install->setLogPath($buildLogFile);
        $install->install($build, $this->options);
        if ($options->{'post-clean'}) {
            $clean = new CleanTask($this->logger);
            $clean->cleanByVersion($version);
        }
        /** POST INSTALLATION **/
        $dsym = new DSymTask($this->logger);
        $dsym->patch($build, $this->options);
        // copy php-fpm config
        $this->logger->info("---> Creating php-fpm.conf");
        $phpFpmConfigPath = "sapi/fpm/php-fpm.conf";
        $phpFpmTargetConfigPath = Config::getVersionEtcPath($version) . DIRECTORY_SEPARATOR . 'php-fpm.conf';
        if (file_exists($phpFpmConfigPath)) {
            if (!file_exists($phpFpmTargetConfigPath)) {
                copy($phpFpmConfigPath, $phpFpmTargetConfigPath);
            } else {
                $this->logger->notice("Found existing {$phpFpmTargetConfigPath}.");
            }
        }
        $phpConfigPath = $options->production ? 'php.ini-production' : 'php.ini-development';
        $this->logger->info("---> Copying {$phpConfigPath} ");
        if (file_exists($phpConfigPath)) {
            $targetConfigPath = Config::getVersionEtcPath($version) . DIRECTORY_SEPARATOR . 'php.ini';
            if (file_exists($targetConfigPath)) {
                $this->logger->notice("Found existing {$targetConfigPath}.");
            } else {
                // TODO: Move this to PhpConfigPatchTask
                // move config file to target location
                copy($phpConfigPath, $targetConfigPath);
                // replace current timezone
                $timezone = ini_get('date.timezone');
                $pharReadonly = ini_get('phar.readonly');
                if ($timezone || $pharReadonly) {
                    // patch default config
                    $content = file_get_contents($targetConfigPath);
                    if ($timezone) {
                        $this->logger->info("---> Found date.timezone, patch config timezone with {$timezone}");
                        $content = preg_replace('/^date.timezone\\s*=\\s*.*/im', "date.timezone = {$timezone}", $content);
                    }
                    if (!$pharReadonly) {
                        $this->logger->info("---> Disable phar.readonly option.");
                        $content = preg_replace('/^phar.readonly\\s*=\\s*.*/im', "phar.readonly = 0", $content);
                    }
                    file_put_contents($targetConfigPath, $content);
                }
            }
        }
        $this->logger->info("Initializing pear config...");
        $home = Config::getPhpbrewHome();
        @mkdir("{$home}/tmp/pear/temp", 0755, true);
        @mkdir("{$home}/tmp/pear/cache_dir", 0755, true);
        @mkdir("{$home}/tmp/pear/download_dir", 0755, true);
        system("pear config-set temp_dir {$home}/tmp/pear/temp");
        system("pear config-set cache_dir {$home}/tmp/pear/cache_dir");
        system("pear config-set download_dir {$home}/tmp/pear/download_dir");
        $this->logger->info("Enabling pear auto-discover...");
        system("pear config-set auto_discover 1");
        $this->logger->debug("Source directory: " . $targetDir);
        $this->logger->info("Congratulations! Now you have PHP with {$version}.");
        echo <<<EOT
To use the newly built PHP, try the line(s) below:

    \$ phpbrew use {$version}

Or you can use switch command to switch your default php version to {$version}:

    \$ phpbrew switch {$version}

Enjoy!

EOT;
    }
开发者ID:bensb,项目名称:phpbrew,代码行数:101,代码来源:InstallCommand.php


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