updated build script to be sourcecode-agnostic
This commit is contained in:
46
build.php
46
build.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Behat\MinkExtension
|
* This file is part of the Behat
|
||||||
*
|
*
|
||||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -9,35 +9,27 @@
|
|||||||
* with this source code in the file LICENSE.
|
* with this source code in the file LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (file_exists('mink_extension.phar')) {
|
$filename = 'mink_extension.phar';
|
||||||
unlink('mink_extension.phar');
|
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phar = new \Phar('mink_extension.phar', 0, 'extension.phar');
|
$phar = new \Phar($filename, 0, 'extension.phar');
|
||||||
$phar->setSignatureAlgorithm(\Phar::SHA1);
|
$phar->setSignatureAlgorithm(\Phar::SHA1);
|
||||||
$phar->startBuffering();
|
$phar->startBuffering();
|
||||||
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Compiler/SelectorsPass.php');
|
foreach (findFiles('src') as $path) {
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Compiler/SessionsPass.php');
|
$phar->addFromString($path, file_get_contents(__DIR__.'/'.$path));
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkAwareContextInterface.php');
|
}
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkAwareContextInitializer.php');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Context/RawMinkContext.php');
|
$phar->addFromString('init.php', file_get_contents(__DIR__.'/init.php'));
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Context/MinkContext.php');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Configuration.php');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/Extension.php');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/mink.xml');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/sessions/goutte.xml');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/sessions/sahi.xml');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/sessions/zombie.xml');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/sessions/selenium.xml');
|
|
||||||
addFileToPhar($phar, 'src/Behat/MinkExtension/services/sessions/selenium2.xml');
|
|
||||||
addFileToPhar($phar, 'init.php');
|
|
||||||
|
|
||||||
$phar->setStub(<<<STUB
|
$phar->setStub(<<<STUB
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Behat\MinkExtension
|
* This file is part of the Behat
|
||||||
*
|
*
|
||||||
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -54,6 +46,16 @@ STUB
|
|||||||
);
|
);
|
||||||
$phar->stopBuffering();
|
$phar->stopBuffering();
|
||||||
|
|
||||||
function addFileToPhar($phar, $path) {
|
function findFiles($dir) {
|
||||||
$phar->addFromString($path, file_get_contents(__DIR__.'/'.$path));
|
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
|
||||||
|
RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
foreach ($iterator as $path) {
|
||||||
|
if ($path->isFile()) {
|
||||||
|
$files[] = $path->getPath().DIRECTORY_SEPARATOR.$path->getFilename();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user