+++ /dev/null
-<?php
-
-define( 'WP_CLI_ROOT', 'phar://wp-cli.phar/php/' );
-
-include WP_CLI_ROOT . 'wp-cli.php';
-
$man_path = "$dest_dir/" . $man_file;
if ( is_readable( $man_path ) ) {
- self::show_manpage( $man_path );
+ \WP_CLI::launch( "man $man_path" );
return true;
}
}
return false;
}
- private static function show_manpage( $path ) {
- // man can't read phar://, so need to copy to a temporary file
- $tmp_path = tempnam( sys_get_temp_dir(), 'wp-cli-man-' );
-
- copy( $path, $tmp_path );
-
- \WP_CLI::launch( "man $tmp_path" );
-
- unlink( $tmp_path );
- }
-
private static function _generate( $src_dir, $dest_dir, $command ) {
$cmd_path = Dispatcher\get_path( $command );
array_shift( $cmd_path ); // discard 'wp'
+++ /dev/null
-<?php
-
-if ( !isset( $argv[1] ) ) {
- echo "usage: php -dphar.readonly=0 $argv[0] <path> [--quiet]\n";
- exit(1);
-}
-
-define( 'DEST_PATH', $argv[1] );
-
-define( 'BE_QUIET', in_array( '--quiet', $argv ) );
-
-function get_iterator( $dir ) {
- return new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator( $dir, FilesystemIterator::SKIP_DOTS )
- );
-}
-
-function add_file( $phar, $path ) {
- $key = str_replace( './', '', $path );
-
- if ( !BE_QUIET )
- echo "$key - $path\n";
-
- $phar[ $key ] = file_get_contents( $path );
-}
-
-$phar = new Phar( DEST_PATH, 0, 'wp-cli.phar' );
-
-$phar->startBuffering();
-
-// php files
-foreach ( get_iterator( './php' ) as $path ) {
- if ( !preg_match( '/\.php$/', $path ) )
- continue;
-
- add_file( $phar, $path );
-}
-
-// non-php files
-$additional_dirs = array(
- './templates',
- './man'
-);
-
-foreach ( $additional_dirs as $dir ) {
- foreach ( get_iterator( $dir ) as $path ) {
- add_file( $phar, $path );
- }
-}
-
-// dependencies
-$ignored_paths = array(
- '/.git',
-);
-
-$vendor_dirs = array(
- './vendor/mustache',
- './vendor/wp-cli',
- './vendor/composer',
-);
-
-foreach ( $vendor_dirs as $vendor_dir ) {
- foreach ( get_iterator( $vendor_dir ) as $path ) {
- foreach ( $ignored_paths as $ignore ) {
- if ( strpos( $path, $ignore ) )
- continue 2;
- }
-
- add_file( $phar, $path );
- }
-}
-
-add_file( $phar, './vendor/autoload.php' );
-
-$phar->setStub( <<<EOB
-#!/usr/bin/env php
-<?php
-Phar::mapPhar();
-include 'phar://wp-cli.phar/php/boot-phar.php';
-__HALT_COMPILER();
-?>
-EOB
-);
-
-$phar->stopBuffering();
-
-echo "Generated " . DEST_PATH . "\n";
-
+++ /dev/null
-#!/usr/bin/env bash
-
-actual_checksum=$(curl http://wp-cli.org/packages/phar/wp-cli.phar | md5sum | cut -d ' ' -f 1)
-
-echo "expected:" $(curl -s http://wp-cli.org/packages/phar/wp-cli.phar.md5)
-echo "actual: " $actual_checksum
+++ /dev/null
-#!/usr/bin/env bash
-
-set -ex
-
-current_rev=$(git rev-parse HEAD)
-current_rev=${current_rev:0:10}
-
-packages_repo=../wp-cli-packages
-
-fname="phar/wp-cli.phar"
-
-# generate archive
-php -dphar.readonly=0 ./utils/make-phar.php $packages_repo/$fname --quiet
-
-cd $packages_repo
-
-# smoke test
-php $fname --version
-
-# check which wp-cli commit the previous Phar archive was based on
-# can't use the md5 hash, since it will be different each time the
-# archive is generated
-new_commit_subj="update wp-cli.phar to wp-cli/wp-cli@$current_rev"
-
-current_commit_subj=$(git show -s --pretty=format:%s HEAD)
-
-if [ "$new_commit_subj" = "$current_commit_subj" ]; then
- echo "already at latest revision"
- exit 1
-fi
-
-# generate md5 checksum
-if [ command -v md5sum > /dev/null ]
-then
- md5hash=$(md5sum $fname)
-else
- md5hash=$(md5 -r $fname)
-fi
-
-echo $md5hash | cut -d ' ' -f 1 > $fname.md5
-
-git add $fname $fname.md5
-
-git commit -m "$new_commit_subj"
-
-git push