mirror of
https://github.com/Respect/Validation.git
synced 2024-06-04 14:52:17 +02:00
New makefile, phar packager from Foundation
This commit is contained in:
parent
410ccfac1c
commit
30a1056600
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,6 +5,8 @@ library/Symfony/
|
|||
.settings/
|
||||
nbproject
|
||||
tests/reports
|
||||
phar
|
||||
*.phar
|
||||
pirum
|
||||
/library/.fr-6ayG1u/
|
||||
/library/.fr-n9BajN/
|
||||
|
|
32
Makefile
32
Makefile
|
@ -13,7 +13,9 @@ help:
|
|||
@echo "minor\t\t Updates the package.xml and increments the minor revision number (1.x.0)"
|
||||
@echo "major\t\t Updates the package.xml and increments the major revision number (x.0.0)"
|
||||
@echo "pear\t\t Creates a PEAR package from the current package.xml"
|
||||
@echo "pirum-push\t PKG=FooPackage.tgz REPO=GitHubFooUser/GitHubFooRepo Send all tgz pear packages to Pirum repository (requires git write access)"
|
||||
@echo "phar\t\t Creates a Phar package from the current package.xml"
|
||||
@echo "pirum-push\t PKG=FooPackage.tgz REPO=GitHubFooUser/GitHubFooRepo Send a tgz pear package to Pirum repository (requires git write access)"
|
||||
@echo "phar-push\t PKG=FooPackage.phar REPO=GitHubFooUser/GitHubFooRepo Send a phar packages to phar repository (requires git write access)"
|
||||
|
||||
test:
|
||||
@cd tests;phpunit .
|
||||
|
@ -47,6 +49,10 @@ pear:
|
|||
@echo "Generating package tgz"
|
||||
pear package package.xml
|
||||
|
||||
phar:
|
||||
@echo "Generating package phar"
|
||||
php -dphar.readonly=0 bin/phar-package.php
|
||||
|
||||
pirum-push:
|
||||
@echo "Cloning channel from git ${REPO}"
|
||||
-rm -Rf pirum
|
||||
|
@ -55,6 +61,14 @@ pirum-push:
|
|||
cd pirum;git add .;git commit -m "Added ${PKG}";git push
|
||||
@echo "Success! Pushed ${PKG}"
|
||||
|
||||
phar-push:
|
||||
@echo "Cloning channel from git ${REPO}"
|
||||
-rm -Rf phar
|
||||
git clone git@github.com:${REPO}.git phar
|
||||
cp ${PKG} phar
|
||||
cd phar;git add .;git commit -m "Added ${PKG}";git push
|
||||
@echo "Success! Pushed ${PKG}"
|
||||
|
||||
foundation:
|
||||
@echo "Cloning Foundation from GitHub"
|
||||
-rm -Rf .foundation-tmp
|
||||
|
@ -63,9 +77,19 @@ foundation:
|
|||
rm .foundation-tmp/README.md
|
||||
rm .foundation-tmp/LICENSE
|
||||
mv .foundation-tmp/README.md.dist .foundation-tmp/README.md
|
||||
mv .foundation-tmp/package.xml.dist package.xml
|
||||
@echo "Copying files without overwrite"
|
||||
cp -an .foundation-tmp/* .
|
||||
mv .foundation-tmp/LICENSE.dist .foundation-tmp/LICENSE
|
||||
mv .foundation-tmp/package.xml.dist .foundation-tmp/package.xml
|
||||
-mkdir bin
|
||||
-mkdir tests
|
||||
-mkdir library
|
||||
-cp -f .foundation-tmp/bin/pear-package.php bin
|
||||
-cp -f .foundation-tmp/bin/phar-package.php bin
|
||||
-cp -f .foundation-tmp/tests/bootstrap.php tests
|
||||
-cp -f .foundation-tmp/tests/phpunit.xml tests
|
||||
-cp -f .foundation-tmp/.travis.yml .
|
||||
-cp -n .foundation-tmp/LICENSE .
|
||||
-cp -n .foundation-tmp/README.md .
|
||||
-cp -n .foundation-tmp/package.xml .
|
||||
echo "Removing temp files"
|
||||
rm -Rf .foundation-tmp
|
||||
@echo "Done!"
|
||||
|
|
38
bin/phar-package.php
Normal file
38
bin/phar-package.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
chdir(__DIR__);
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$package_xml_file = '../package.xml';
|
||||
|
||||
if (!file_exists($package_xml_file))
|
||||
die("package.xml does not exists");
|
||||
|
||||
$package_data = simplexml_load_file($package_xml_file);
|
||||
$project_name = $package_data->name;
|
||||
$phar_name = "$project_name.phar";
|
||||
|
||||
$phar = new Phar("../$phar_name", 0, $phar_name);
|
||||
|
||||
foreach ($package_data->contents->dir->file as $file)
|
||||
$phar->addFile(realpath("../{$file['name']}"));
|
||||
|
||||
$phar->addFromString("autoload.php", <<<'LOADER'
|
||||
<?php
|
||||
spl_autoload_register(function($className)
|
||||
{
|
||||
$fileParts = explode('\\', ltrim($className, '\\'));
|
||||
|
||||
if (false !== strpos(end($fileParts), '_'))
|
||||
array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
|
||||
|
||||
$fileName = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
|
||||
|
||||
if (stream_resolve_include_path($fileName))
|
||||
require $fileName;
|
||||
});
|
||||
|
||||
LOADER
|
||||
);
|
||||
|
||||
$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
|
Loading…
Reference in a new issue