[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/httpful/ -> build (source)

   1  #!/usr/bin/php
   2  <?php
   3  
   4  /**
   5   * Build the whole library into a single file
   6   * as an easy drop in solution as opposed to
   7   * relying on autoloader.  Sometimes we just
   8   * want to hack with an API as a one off thing.
   9   * Httpful should make this easy.
  10   */
  11  
  12  function exit_unless($condition, $msg = null) {
  13      if ($condition)
  14          return;
  15      echo "[FAIL]\n$msg\n";
  16      exit(1);
  17  }
  18  
  19  // Create the Httpful Phar
  20  echo "Building Phar... ";
  21  $base_dir = dirname(__FILE__);
  22  $source_dir = $base_dir . '/src/Httpful/';
  23  $phar_path = $base_dir . '/downloads/httpful.phar';
  24  $phar = new Phar($phar_path, 0, 'httpful.phar');
  25  $stub = <<<HEREDOC
  26  <?php
  27      // Phar Stub File
  28      Phar::mapPhar('httpful.phar');
  29      include('phar://httpful.phar/Httpful/Bootstrap.php');
  30      \Httpful\Bootstrap::pharInit();
  31  
  32      __HALT_COMPILER();
  33  HEREDOC;
  34  try {
  35      $phar->setStub($stub);
  36  } catch(Exception $e) {
  37      $phar = false;
  38  }
  39  exit_unless($phar, "Unable to create a phar.  Make certain you have phar.readonly=0 set in your ini file.");
  40  $phar->buildFromDirectory(dirname($source_dir));
  41  echo "[ OK ]\n";
  42  
  43  
  44  
  45  // Add it to git!
  46  echo "Adding httpful.phar to the repo... ";
  47  $return_code = 0;
  48  passthru("git add $phar_path", $return_code);
  49  exit_unless($return_code === 0, "Unable to add download files to git.");
  50  echo "[ OK ]\n";
  51  echo "\nBuild completed sucessfully.\n\n";


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1