From c61404bba9e446429740a134deb5cf8f29f1e0f3 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 15 May 2015 10:18:01 +0200 Subject: [PATCH] use a Metadata class --- Makefile | 4 ++-- bin/pharext | Bin 71043 -> 71607 bytes build/Metadata.php.in | 26 ++++++++++++++++++++++++++ build/Version.php.in | 5 ----- build/create-phar.php | 5 +---- src/pharext/Metadata.php | 26 ++++++++++++++++++++++++++ src/pharext/Packager.php | 11 ++++++++--- src/pharext/Version.php | 5 ----- 8 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 build/Metadata.php.in delete mode 100644 build/Version.php.in create mode 100644 src/pharext/Metadata.php delete mode 100644 src/pharext/Version.php diff --git a/Makefile b/Makefile index 4c78e66..41b8041 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,11 @@ release: @echo "Previous Version: $$(git tag --list | tail -n1)"; \ read -p "Release Version: v" VERSION; \ echo "Preparing release ... "; \ - sed -e "s/@PHAREXT_VERSION@/$$VERSION/" build/Version.php.in > src/pharext/Version.php && \ + sed -e "s/@dev-master/$$VERSION/" build/Metadata.php.in > src/pharext/Metadata.php && \ $(MAKE) -B SIGN=1 && \ git ci -am "release v$$VERSION" && \ git tag v$$VERSION && \ - cp build/Version.php.in src/pharext/Version.php && \ + cp build/Metadata.php.in src/pharext/Metadata.php && \ git ci -am "back to dev" .PHONY: all clean test release diff --git a/bin/pharext b/bin/pharext index 1d9f2b0f94a8618855746a559250b7241dac11ed..bd2b67f161c939c4a1e80babffb8537677b4650d 100755 GIT binary patch delta 1070 zcmZ`&OKTHR6rPl{I?+;_7Bp!aZf+)-NoW#cUoxeowpI-_5iG4Ot;m?UNd_mAbY@zW zT8g+4Tojo_eIvM%E?Qb8KR|FNxOAmhXhE>(QeAoPoy4Ysi{WF=`OZ1tdEC2e&hol* zBk9e|H8KpxFibQ49Qb3HNCU%2Vz0PphqfgywCL#c+1hUzd4#L7NpFK4G(R2AG9kxbutY4Wj?k(gj(GrsuDk~=M2*14-aj! zD?}4#Ls2TI8Pj)7d6o*=3{gSvLXl&Spgl5z{ZlK)slSD%ex9cznc`{N_xRXq(e0>D zRwwRSbg_mhnMwv^=e3N9*9_E%^+0$0x7$sfN%&f3~ z0YL*Vo?Gq&22!)4_&0O7e?LQQX?z6eVBK7S+Te7w5S8Ko;v`i)7&e2Iv(>{LhhSjv zUkRO*QMufGzikl0wwu(h3AW`C*A;6+gj;X;^Isa3ED!`Prxve)0kB$T9dS1u9LsX5 zl0lk*i2WJs@HS9Z*qZBVS?0{VVnhdTNV+D#k>b261FdL+tfI+40vD1aqv`R{SOgnX z~(NxClGx>`Vb4hhvwiy|FTC!nKQJK p4_C95cUi}sBke04pDxY#oZque%yn;f@ME&v1nTf}J2#vf{sURWL#hA( delta 560 zcmdnKo~3y;%LY#=4_{se24w~Y20L@P6^>S7?Fl#!a4l3Ju>4dfVF zDHUWS7Nu5{D3mz_csK^RMufzNxdsJ$`ujOdUL&QhY;L7gmReMtnV$#JU}DS6TGq)s6{MNgESY>w!2(1HDC&YJdqq7Em9MA|q82Ec@T^%98p0#UXQs!-Vk#9OWmw(N$oIfy5yVhp0(RKRjIDuy85dKEJe^<2diM9HZdfvuHe zVPH7v+2AyJqN?QNQdI$vT)Qe*`yL4OQ59^8x*FIm;c8&Ry41j4-Khq)_LZ8JfQk|W z1IV8s`ohCWu9G(^i%hmq7X%sTtqxXJqYgG=jk@0EQcd@V(Yo`EWXedSM=IW*>Y3fYh!Oa-O=rEm&n^9`|NiIhH o?NU69jodO`Q>0tfYN`U}evS5Az`e=nYsiLcOu+Qu?&RwP06t8*LI3~& diff --git a/build/Metadata.php.in b/build/Metadata.php.in new file mode 100644 index 0000000..db3ab81 --- /dev/null +++ b/build/Metadata.php.in @@ -0,0 +1,26 @@ +", self::version()); + } + + static function date() { + return gmdate("Y-m-d"); + } + + static function all() { + return [ + "version" => self::version(), + "header" => self::header(), + "date" => self::date(), + ]; + } +} diff --git a/build/Version.php.in b/build/Version.php.in deleted file mode 100644 index 50a2875..0000000 --- a/build/Version.php.in +++ /dev/null @@ -1,5 +0,0 @@ - sprintf("pharext v%s (c) Michael Wallner ", pharext\VERSION), - "version" => pharext\VERSION, +$file = (new pharext\Task\PharBuild(null, pharext\Metadata::all() + [ "name" => "pharext", - "date" => date("Y-m-d"), "stub" => "pharext_packager.php", "license" => file_get_contents(__DIR__."/../LICENSE") ], false))->run(); diff --git a/src/pharext/Metadata.php b/src/pharext/Metadata.php new file mode 100644 index 0000000..db3ab81 --- /dev/null +++ b/src/pharext/Metadata.php @@ -0,0 +1,26 @@ +", self::version()); + } + + static function date() { + return gmdate("Y-m-d"); + } + + static function all() { + return [ + "version" => self::version(), + "header" => self::header(), + "date" => self::date(), + ]; + } +} diff --git a/src/pharext/Packager.php b/src/pharext/Packager.php index c08fce0..cd3b4d6 100644 --- a/src/pharext/Packager.php +++ b/src/pharext/Packager.php @@ -243,11 +243,16 @@ class Packager implements Command */ private function createPackage() { try { - $meta = array_merge($this->metadata(), [ - "date" => date("Y-m-d"), + if (($glob = glob($this->source->getBaseDir()."/LICENSE*"))) { + $license = file_get_contents(current($glob)); + } else { + $this->warn("Could not find any LICENSE.* files!\n"); + $license = "UNKNOWN\n"; + } + $meta = array_merge(Metadata::all(), [ "name" => $this->args->name, "release" => $this->args->release, - "license" => @file_get_contents(current(glob($this->source->getBaseDir()."/LICENSE*"))), + "license" => $license, "stub" => "pharext_installer.php", "type" => $this->args->zend ? "zend_extension" : "extension", ]); diff --git a/src/pharext/Version.php b/src/pharext/Version.php deleted file mode 100644 index 50a2875..0000000 --- a/src/pharext/Version.php +++ /dev/null @@ -1,5 +0,0 @@ -