#!/usr/bin/php -d memory_limit=1024M <?php /** * Vagrant Boxer application * * Usage: * php -d memory_limit=1024M boxer.php [--no-bump-version] [--keep-package] [--config-file /path/to/boxer.json] * * @copyright 2014 Vubeology LLC * @author Ross Perkins <*****@*****.**> */ use Vube\VagrantBoxer\Boxer; // Require composer autoloader require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; try { $boxer = new Boxer(); $boxer->init($_SERVER['argv']); $boxer->exec(); } catch (Exception $e) { echo "\nFatal error: " . $e->__toString() . "\n"; }
public function testCommandLineReader() { $values = array('test' => null, 'verbose' => null, 'vagrant' => '/path/to/vagrant', 'vagrant-output-file' => 'output.file', 'vagrant-output-dir' => '/output/dir', 'no-upload' => null, 'upload-method' => 'upload', 'no-bump-version' => null, 'keep-package' => null, 'config-file' => '/path/to/config', 'metadata-file' => '/path/to/metadata', 'force-write-metadata' => null, 'base' => '/base/dir', 'boxer-id' => 'test-boxer-id', 'url-prefix' => 'before-url', 'url-suffix' => 'after-url', 'upload-base-uri' => 'localhost:/tmp', 'major-version' => '0.1.2.3.4.5'); $allArgs = array(self::app); // $0 == /path/to/app foreach ($values as $n => $v) { $allArgs[] = "--{$n}"; if ($v !== null) { $allArgs[] = $v; } } $box = new Boxer(); $box->silenceStderr(); $box->readCommandLine($allArgs); $this->assertTrue($box->isTestMode(), "Expected test mode to be enabled"); $this->assertSame($values['boxer-id'], $box->getBoxerId()); }