Beispiel #1
0
 public function __construct($repository)
 {
     $this->_readline = new Hoa\Console\Readline();
     $git = new Hoa\Console\Processus('git log --pretty=\'format:\' --patch --reverse --raw -z', null, null, $repository);
     $git->on('output', xcallable($this, 'output'));
     $git->on('stop', xcallable($this, 'over'));
     $git->run();
 }
Beispiel #2
0
 /**
  * Use pager set in the environment (i.e. $_ENV['PAGER']).
  *
  * @access  public
  * @param   string  $output    Output (from the output buffer).
  * @param   int     $mode      Mode (from the output buffer).
  * @param   string  $type      Type. Please, see self::LESS or self::MORE.
  * @return  string
  */
 public static function pager($output, $mode, $type = null)
 {
     static $process = null;
     static $pipes = null;
     if ($mode & PHP_OUTPUT_HANDLER_START) {
         $pager = null !== $type ? \Hoa\Console\Processus::locate($type) : (isset($_ENV['PAGER']) ? $_ENV['PAGER'] : null);
         if (null === $pager) {
             return $output;
         }
         $process = new \Hoa\Console\Processus($pager, null, array(0 => array('pipe', 'r')));
         $process->open();
     }
     $process->writeAll($output);
     if ($mode & PHP_OUTPUT_HANDLER_FINAL) {
         $process->close();
     }
     return null;
 }
Beispiel #3
0
<?php

require '/usr/local/lib/Hoa/Core/Core.php';
from('Hoa')->import('Console.Processus')->import('Console.Window');
$windowSize = Hoa\Console\Window::getSize();
$screenSize = array('x' => 0, 'y' => 0);
if (null !== ($osascript = Hoa\Console\Processus::locate('osascript'))) {
    $handle = Hoa\Console\Processus::execute($osascript . ' -e \'tell application "Finder" to get bounds of window of desktop\'', false);
    list(, , $screenSize['x'], $screenSize['y']) = preg_split('#\\s*,\\s*#', $handle);
} elseif (null !== ($xwininfo = Hoa\Console\Processus::locate('xwininfo'))) {
    preg_match('#\\-geometry (\\d+)x(\\d+)#m', Hoa\Console\Processus::execute($xwininfo . ' -root'), $matches);
    list(, $screenSize['x'], $screenSize['y']) = $matches;
}
Hoa\Console\Window::setSize(89, 26);
Hoa\Console\Window::moveTo(212, 174);
Beispiel #4
0
                    break;
            }
            $uri .= implode('/', $tails);
        }
    }
    $http->sendStatus($http::STATUS_MOVED_PERMANENTLY);
    $http->sendHeader('Location', $uri);
    return;
})->get('s', '/State/(?<library>[\\w ]+)', function ($library, $_request) {
    $Library = ucfirst(strtolower($library));
    $http = new Hoa\Http\Response\Response();
    if (false === file_exists('hoa://Library/' . $Library)) {
        $http->sendStatus($http::STATUS_NOT_FOUND);
        return;
    }
    $status = Hoa\Console\Processus::execute('hoa devtools:state ' . $library);
    if (empty($status)) {
        $http->sendStatus($http::STATUS_INTERNAL_SERVER_ERROR);
        return;
    }
    if (isset($_request['format'])) {
        if ('raw' !== $_request['format']) {
            $http->sendStatus($http::STATUS_NOT_ACCEPTABLE);
            return;
        }
        $http->sendHeader('Content-Type', 'text/plain');
        echo $status;
        return;
    }
    $http->sendHeader('Content-Type', 'image/svg+xml');
    echo file_get_contents(__DIR__ . DS . 'Badges' . DS . 'Image' . DS . ucfirst($status) . '.svg');