This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,7 @@ nbproject | |
tmp/ | ||
.DS_Store | ||
composer.lock | ||
composer.phar | ||
.*.sw* | ||
.*.un~ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* Create zf.phar | ||
* | ||
* @link http://github.com/zendframework/ZFTool for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
$srcRoot = dirname(__DIR__); | ||
$buildRoot = __DIR__ ; | ||
$filename = 'zftool.phar'; | ||
|
||
if (file_exists($buildRoot . "/$filename")) { | ||
unlink($buildRoot . "/$filename"); | ||
} | ||
|
||
$pharPath = $buildRoot . "/$filename"; | ||
$phar = new \Phar($pharPath, 0, $filename); | ||
$phar->startBuffering(); | ||
|
||
addFile($phar, "$srcRoot/zf.php", $srcRoot); | ||
addDir($phar, "$srcRoot/vendor", $srcRoot); | ||
addDir($phar, "$srcRoot/config", $srcRoot); | ||
addDir($phar, "$srcRoot/src", $srcRoot); | ||
|
||
$stub = <<<EOF | ||
#!/usr/bin/env php | ||
<?php | ||
/* | ||
* This file is part of ZFTool command line tool | ||
* | ||
* @link http://github.com/zendframework/ZFTool for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
Phar::mapPhar('$filename'); | ||
require 'phar://$filename/zf.php'; | ||
__HALT_COMPILER(); | ||
EOF; | ||
|
||
$phar->setStub($stub); | ||
$phar->stopBuffering(); | ||
chmod($pharPath, 0755); | ||
|
||
/** | ||
* Add a directory in phar removing whitespaces from PHP source code | ||
* | ||
* @param Phar $phar | ||
* @param string $sDir | ||
*/ | ||
function addDir($phar, $sDir, $baseDir = null) { | ||
$oDir = new RecursiveIteratorIterator ( | ||
new RecursiveDirectoryIterator ($sDir), | ||
RecursiveIteratorIterator::SELF_FIRST | ||
); | ||
|
||
foreach ($oDir as $sFile) { | ||
if (preg_match ('/\\.php$/i', $sFile)) { | ||
addFile($phar, $sFile, $baseDir); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Add a file in phar removing whitespaces from the file | ||
* | ||
* @param Phar $phar | ||
* @param string $sFile | ||
*/ | ||
function addFile($phar, $sFile, $baseDir = null) { | ||
if (null !== $baseDir) { | ||
$phar->addFromString(substr($sFile, strlen($baseDir) + 1), php_strip_whitespace($sFile)); | ||
} else { | ||
$phar->addFromString($sFile, php_strip_whitespace($sFile)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* ZF2 command line tool | ||
* | ||
* @link http://github.com/zendframework/ZFTool for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
require_once 'vendor/autoload.php'; | ||
|
||
$appConfig = array( | ||
'modules' => array( | ||
'ZFTool', | ||
), | ||
'module_listener_options' => array( | ||
'config_glob_paths' => array( | ||
'config/autoload/{,*.}{global,local}.php', | ||
), | ||
'module_paths' => array( | ||
'.', | ||
'./vendor', | ||
), | ||
), | ||
); | ||
Zend\Mvc\Application::init($appConfig)->run(); |