Esempio n. 1
0
 function testIncrementVersion()
 {
     // keyword increments
     $this->assertEquals(Utils\increment_version('1.2.3-pre', 'same'), '1.2.3-pre');
     $this->assertEquals(Utils\increment_version('1.2.3-pre', 'patch'), '1.2.4');
     $this->assertEquals(Utils\increment_version('1.2.3-pre', 'minor'), '1.3.0');
     $this->assertEquals(Utils\increment_version('1.2.3-pre', 'major'), '2.0.0');
     // custom version string
     $this->assertEquals(Utils\increment_version('1.2.3-pre', '4.5.6-alpha1'), '4.5.6-alpha1');
 }
Esempio n. 2
0
require WP_CLI_ROOT . '/php/utils.php';
use Symfony\Component\Finder\Finder;
use WP_CLI\Utils;
use WP_CLI\Configurator;
$configurator = new Configurator(WP_CLI_ROOT . '/utils/make-phar-spec.php');
list($args, $assoc_args, $runtime_config) = $configurator->parse_args(array_slice($GLOBALS['argv'], 1));
if (!isset($args[0]) || empty($args[0])) {
    echo "usage: php -dphar.readonly=0 {$argv['0']} <path> [--quiet] [--version=same|patch|minor|major|x.y.z] [--store-version]\n";
    exit(1);
}
define('DEST_PATH', $args[0]);
define('BE_QUIET', isset($runtime_config['quiet']) && $runtime_config['quiet']);
$current_version = trim(file_get_contents(WP_CLI_ROOT . '/VERSION'));
if (isset($runtime_config['version'])) {
    $new_version = $runtime_config['version'];
    $new_version = Utils\increment_version($current_version, $new_version);
    if (isset($runtime_config['store-version']) && $runtime_config['store-version']) {
        file_put_contents(WP_CLI_ROOT . '/VERSION', $new_version);
    }
    $current_version = $new_version;
}
function add_file($phar, $path)
{
    $key = str_replace(WP_CLI_ROOT, '', $path);
    if (!BE_QUIET) {
        echo "{$key} - {$path}\n";
    }
    $phar[$key] = file_get_contents($path);
}
function set_file_contents($phar, $path, $content)
{