Permalink
Browse files

Refactoring CI depends script.

  • Loading branch information...
1 parent d324c63 commit 8315029223cfa1fc626d1e1dbc91139a8d8059d7 @davidpersson davidpersson committed with nateabele Apr 16, 2012
Showing with 23 additions and 22 deletions.
  1. +23 −22 tests/ci_depends.php
View
@@ -77,36 +77,37 @@ class PhpExtensions {
* @return void
*/
public static function install($name) {
- if (array_key_exists($name, static::$_extensions)) {
- $extension = static::$_extensions[$name];
- echo $name;
+ if (!isset(static::$_extensions[$name])) {
+ return;
+ }
+ $extension = static::$_extensions[$name];
+ echo $name;
- if (isset($extension['require']['php'])) {
- $version = $extension['require']['php'];
+ if (isset($extension['require']['php'])) {
+ $version = $extension['require']['php'];
- if (!version_compare(PHP_VERSION, $version[1], $version[0])) {
- $message = " => not installed, requires a PHP version %s %s (%s installed)\n";
- printf($message, $version[0], $version[1], PHP_VERSION);
- return;
- }
+ if (!version_compare(PHP_VERSION, $version[1], $version[0])) {
+ $message = " => not installed, requires a PHP version %s %s (%s installed)\n";
+ printf($message, $version[0], $version[1], PHP_VERSION);
+ return;
}
+ }
- static::_system(sprintf('wget %s > /dev/null 2>&1', $extension['url']));
- $file = basename($extension['url']);
+ static::_system(sprintf('wget %s > /dev/null 2>&1', $extension['url']));
+ $file = basename($extension['url']);
- static::_system(sprintf('tar -xzf %s > /dev/null 2>&1', $file));
- $folder = basename($file, '.tgz');
- $folder = basename($folder, '.tar.gz');
+ static::_system(sprintf('tar -xzf %s > /dev/null 2>&1', $file));
+ $folder = basename($file, '.tgz');
+ $folder = basename($folder, '.tar.gz');
- $message = 'sh -c "cd %s && phpize && ./configure %s ';
- $message .= '&& make && sudo make install" > /dev/null 2>&1';
- static::_system(sprintf($message, $folder, implode(' ', $extension['configure'])));
+ $message = 'sh -c "cd %s && phpize && ./configure %s ';
+ $message .= '&& make && sudo make install" > /dev/null 2>&1';
+ static::_system(sprintf($message, $folder, implode(' ', $extension['configure'])));
- foreach ($extension['ini'] as $ini) {
- static::_system(sprintf("echo %s >> %s", $ini, php_ini_loaded_file()));
- }
- printf("=> installed (%s)\n", $folder);
+ foreach ($extension['ini'] as $ini) {
+ static::_system(sprintf("echo %s >> %s", $ini, php_ini_loaded_file()));
}
+ printf("=> installed (%s)\n", $folder);
}
/**

0 comments on commit 8315029

Please sign in to comment.