示例#1
0
function create_composer_json_stub($filename)
{
    $composer = array();
    $matches = array();
    preg_match('/^(?P<package_name>[^-]+)-(?P<package_release>\\d+\\.\\d+\\.\\d+-?(?:alpha|a|beta|b|rc|pl|p|dev|d)(?:\\d+)?)$/s', pathinfo($filename)['filename'], $matches);
    $package_name = isset($matches['package_name']) ? $matches['package_name'] : false;
    $package_release = isset($matches['package_release']) ? $matches['package_release'] : false;
    if (!$package_name || !$package_release) {
        script_exit('Unable to determine either package name or package release from filename "' . $filename . '"');
    }
    $composer['name'] = strtolower(str_replace('_', '-', $package_name));
    $composer['name'] = 'zendframework/' . $composer['name'];
    $composer['license'] = 'BSD-3-Clause';
    $composer['keywords'] = array('zf2', strtolower(str_replace('Zend_', '', $package_name)));
    $composer['autoload']['psr-0'][str_replace('_', '\\', $package_name)] = '';
    $composer['require']['php'] = ">=5.3.3";
    $composer['version'] = $package_release;
    $composer['dist']['url'] = "http://packages.zendframework.com/composer/{$package_name}.zip";
    $composer['dist']['type'] = "zip";
    return $composer;
}
#!/usr/bin/env php -dphar.readonly=0
<?php 
define('ROOT', realpath(__DIR__ . '/../../'));
require_once 'functions.php';
// get information from CLI
$package_name_full = $_SERVER['argv'][1];
$package_source = $_SERVER['argv'][2];
$package_filter = isset($_SERVER['argv'][3]) ? trim($_SERVER['argv'][3], '/') : null;
list($package_name, $package_release) = preg_split('#-#', $package_name_full);
$pyrus_path = $_SERVER['_'] . ' -dphar.readonly=0 ' . __DIR__ . '/pyrus.phar';
$channel = 'packages.zendframework.com';
if (strpos(shell_exec($pyrus_path . ' list-channels'), $channel) === false) {
    script_exit('The channel ' . $channel . ' is not in your channel list');
}
if (ini_get('phar.readonly') == 'On') {
    script_exit('To build with phar, PHP must have phar.readonly=0');
}
if (file_exists(ROOT . '/packages/component-pyrus/' . $package_name)) {
    script_run_command('rm -Rf ' . ROOT . '/packages/component-pyrus/' . $package_name);
}
chdir(ROOT . '/packages/component-pyrus/');
$command = $pyrus_path . ' generate-pear2 ' . $package_name . ' ' . $channel;
script_run_command($command);
chdir(ROOT . '/packages/component-pyrus/' . $package_name);
script_run_command('rm -Rf ./src/');
chdir($package_source);
script_run_command('tar -cf - ' . $package_filter . ' | tar -C ' . ROOT . '/packages/component-pyrus/' . $package_name . ' -xf -');
chdir(ROOT . '/packages/component-pyrus/' . $package_name);
if (file_exists('./library')) {
    rename('./library', './src');
}
示例#3
0
#!/usr/bin/env php -dphar.readonly=0
<?php 
include 'functions.php';
define('ROOT', realpath(__DIR__ . '/../../'));
$release = isset($argv[1]) ? $argv[1] : false;
if (!$release) {
    script_exit('No release specified');
}
$package_glob = ROOT . '/packages/plain/ZendFramework-*' . $release . '.*';
$release_dir = ROOT . '/public/releases/ZendFramework-' . $release . '';
if (!is_dir($release_dir)) {
    mkdir($release_dir, 0777, true);
}
script_run_command('cp -a ' . $package_glob . ' ' . $release_dir);
#!/usr/bin/env php -dphar.readonly=0
<?php 
// did you copy config.ini.orig to the proper place?
if (!file_exists(__DIR__ . '/config.ini')) {
    script_exit('config.ini is required');
}
// load the ini
$ini = parse_ini_file(__DIR__ . '/config.ini');
$package_list = $ini['package_list'];
$packages = explode(',', $package_list);
foreach ($packages as $package) {
    $return_val = 0;
    $php = '/usr/bin/env php';
    $command = $php . ' -dphar.readonly=0 ./zf2-make-package.php ' . $package;
    echo 'Running: ' . $command . PHP_EOL;
    passthru($command, &$return_val);
    if ($return_val === -1) {
        echo 'Something went terribly wrong' . "\n\n";
        exit - 1;
    }
}
    script_exit('The proper channel is required.');
}
$channel = $ini['channel'];
if (!isset($ini['release'])) {
    script_exit('The proper release is required.');
}
$release = $ini['release'];
if (strpos(shell_exec($pyrus_path . ' list-channels'), $channel) === false) {
    script_exit('The channel ' . $channel . ' is not in your channel list');
}
if (isset($ini['with_phar']) && $ini['with_phar'] == true && ini_get('phar.readonly') == 'On') {
    script_exit('To build with phar, PHP must have phar.readonly=0');
}
$library_component_path = str_replace('_', DS, $package_name);
if (!file_exists($zf2_library_path . DS . $library_component_path)) {
    script_exit($package_name . ' is not a valid package name, or cannot be found in the ZF2 library');
}
// set cwd, just in case it was called from elsewhere
chdir(__DIR__ . DS . 'working');
$command = $pyrus_path . ' generate-pear2 ' . $package_name . ' ' . $channel;
$output = script_run_command($command);
$command = 'rm ' . $package_name . DS . 'src' . DS . $library_component_path . DS . 'Main.php';
$output = script_run_command($command);
$command = 'cp -R ' . $zf2_library_path . DS . $library_component_path . DS . '* ' . $package_name . DS . 'src' . DS . $library_component_path . DS;
$output = script_run_command($command);
chdir($package_name);
$command = 'mv RELEASE-0.1.0 RELEASE-' . $release;
$output = script_run_command($command);
$command = 'mv API-0.1.0 API-' . $release;
$output = script_run_command($command);
$command = 'rm package_compatible.xml';