Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
updated build scripts to the new architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
everzet committed Dec 21, 2011
1 parent 9cee3e2 commit 4283550
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 33 deletions.
3 changes: 3 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ require_once __DIR__ . '/../vendor/.composer/autoload.php';

use Behat\Mink\Compiler;

system('rm *.phar *.tgz');

if (!isset($argv[1])) {
throw new RuntimeException('You must provide version.');
}
Expand All @@ -41,6 +43,7 @@ echo "PEAR package compiled: mink-$version.tgz\n";

$phar = new Compiler\PharCompiler();
$phar->compile($version);
system("cp mink-$version.phar mink.phar");
echo "PHAR package compiled: mink-$version.phar\n";

unlink($autoloaderFilename);
Expand Down
10 changes: 5 additions & 5 deletions src/Behat/Mink/Compiler/MapFileCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public function compile($autoloaderFilename = 'autoload.php', $mapFilename = 'au
$mappings .= "\nif (!defined('BEHAT_AUTOLOAD_SF2') || true === BEHAT_AUTOLOAD_SF2) {\n";
foreach ($this->findPhpFile()->in($this->libPath . '/vendor/symfony') as $file) {
$path = str_replace(array(
$this->libPath . '/vendor/symfony/browser-kit',
$this->libPath . '/vendor/symfony/css-selector',
$this->libPath . '/vendor/symfony/dom-crawler',
$this->libPath . '/vendor/symfony/process',
$this->libPath . '/vendor/symfony/browser-kit/',
$this->libPath . '/vendor/symfony/css-selector/',
$this->libPath . '/vendor/symfony/dom-crawler/',
$this->libPath . '/vendor/symfony/process/',
), '', $file->getRealPath());
$class = str_replace(array('/', '.php'), array('\\', ''), $path);
$mappings .= " \$mappings['$class'] = \$symfonyDir . '$path';\n";
$mappings .= " \$mappings['$class'] = '$path';\n";
}
$mappings .= "}\n";

Expand Down
58 changes: 46 additions & 12 deletions src/Behat/Mink/Compiler/PearCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,56 @@ public function compile($version, $stability)
->name('*.php')
->name('*.xliff')
->name('*.xml')
->name('*.js')
->name('*.feature')
->name('LICENSE')
->in($this->libPath . '/src')
->in($this->libPath . '/vendor')
->name('LICENSE.txt')
->notName('test')
->notName('tests')
->exclude(array(
$this->libPath.'/src/Behat/Mink/Compiler',
$this->libPath.'/vendor/symfony',
$this->libPath.'/vendor/zend-http/php/PEAR2',
$this->libPath.'/vendor/zend-loader/php/PEAR2',
$this->libPath.'/vendor/zend-registry/php/PEAR2',
$this->libPath.'/vendor/zend-stdlib/php/PEAR2',
$this->libPath.'/vendor/zend-uri/php/PEAR2',
$this->libPath.'/vendor/zend-validator/php/PEAR2',
));
'Compiler',
'finder',
'test',
'tests',
'vendor',
))
->in($this->libPath . '/src')
->in($this->libPath . '/vendor/.composer')
->in($this->libPath . '/vendor/alexandresalome')
->in($this->libPath . '/vendor/behat')
->in($this->libPath . '/vendor/fabpot')
->in($this->libPath . '/vendor/facebook')
->in($this->libPath . '/vendor/kriswallsmith')
->in($this->libPath . '/vendor/zendframework/zend-uri')
->in($this->libPath . '/vendor/zendframework/zend-http')
;

$files = array(
$this->libPath . '/vendor/zendframework/zend-registry/php/Zend/Registry.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Validator.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/AbstractValidator.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Ip.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Com.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Jp.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Dispatchable.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Message.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/MessageDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/RequestDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Parameters.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/ParametersDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/ResponseDescription.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/PluginClassLoader.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/PluginClassLocator.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/ShortNameLocator.php',
);

$xmlSourceFiles = '';
foreach ($finder as $file) {
foreach (array_merge($files, iterator_to_array($finder)) as $file) {
if (!$file instanceof \SplFileInfo) {
$file = new \SplFileInfo($file);
}

$path = str_replace($this->libPath . '/', '', $file->getRealPath());
$xmlSourceFiles .=
'<file role="php" baseinstalldir="mink" install-as="'.$path.'" name="'.$path.'" />'."\n";
Expand Down Expand Up @@ -149,6 +182,7 @@ protected function getPackageTemplate()
##SOURCE_FILES##
<file role="php" baseinstalldir="mink" name="autoload.php" />
<file role="php" baseinstalldir="mink" name="autoload_map.php" />
<file role="php" baseinstalldir="mink" name="CHANGES.md" />
<file role="php" baseinstalldir="mink" name="LICENSE" />
<file role="php" baseinstalldir="mink" name="README.md" />
Expand Down
63 changes: 47 additions & 16 deletions src/Behat/Mink/Compiler/PharCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,57 @@ public function compile($version)
->name('*.php')
->name('*.xliff')
->name('*.xml')
->name('*.js')
->name('*.feature')
->name('LICENSE')
->name('LICENSE.txt')
->in($this->libPath . '/src')
->in($this->libPath . '/vendor')
->notName('test')
->notName('tests')
->exclude(array(
$this->libPath.'/src/Behat/Mink/Compiler',
$this->libPath.'/vendor/symfony/finder',
$this->libPath.'/vendor/zend-http/php/PEAR2',
$this->libPath.'/vendor/zend-loader/php/PEAR2',
$this->libPath.'/vendor/zend-registry/php/PEAR2',
$this->libPath.'/vendor/zend-stdlib/php/PEAR2',
$this->libPath.'/vendor/zend-uri/php/PEAR2',
$this->libPath.'/vendor/zend-validator/php/PEAR2',
));

foreach ($finder as $file) {
// don't compile test suites
if (!preg_match('/\/tests\/|\/test\//', $file->getRealPath())) {
$this->addFileToPhar($file, $phar);
'Compiler',
'finder',
'test',
'tests',
'vendor',
))
->in($this->libPath . '/src')
->in($this->libPath . '/vendor/.composer')
->in($this->libPath . '/vendor/symfony')
->in($this->libPath . '/vendor/alexandresalome')
->in($this->libPath . '/vendor/behat')
->in($this->libPath . '/vendor/fabpot')
->in($this->libPath . '/vendor/facebook')
->in($this->libPath . '/vendor/kriswallsmith')
->in($this->libPath . '/vendor/zendframework/zend-uri')
->in($this->libPath . '/vendor/zendframework/zend-http')
;

$files = array(
$this->libPath . '/vendor/zendframework/zend-registry/php/Zend/Registry.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Validator.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/AbstractValidator.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Ip.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Com.php',
$this->libPath . '/vendor/zendframework/zend-validator/php/Zend/Validator/Hostname/Jp.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Dispatchable.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Message.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/MessageDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/RequestDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/Parameters.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/ParametersDescription.php',
$this->libPath . '/vendor/zendframework/zend-stdlib/php/Zend/Stdlib/ResponseDescription.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/PluginClassLoader.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/PluginClassLocator.php',
$this->libPath . '/vendor/zendframework/zend-loader/php/Zend/Loader/ShortNameLocator.php',
);

foreach (array_merge($files, iterator_to_array($finder)) as $file) {
if (!$file instanceof \SplFileInfo) {
$file = new \SplFileInfo($file);
}

$this->addFileToPhar($file, $phar);
}

// stub
Expand Down Expand Up @@ -119,6 +149,7 @@ protected function getStub($version)
*/
Phar::mapPhar('mink.phar');
require_once 'phar://mink.phar/vendor/facebook/php-webdriver/__init__.php';
require_once 'phar://mink.phar/vendor/.composer/autoload.php';
__HALT_COMPILER();
Expand Down

0 comments on commit 4283550

Please sign in to comment.