From 4ae79837069cff1411f257f40edea68ccf8dcbf8 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Tue, 28 Oct 2014 14:18:33 -0700 Subject: [PATCH 1/6] Automatically download apigen/box and run box --- .gitignore | 4 ++-- {bin => dev-bin}/release.sh | 48 +++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) rename {bin => dev-bin}/release.sh (54%) diff --git a/.gitignore b/.gitignore index bba1a27..678ddeb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,13 +2,13 @@ _site .gh-pages .idea GeoLite2-City.mmdb +apigen.phar +box.phar build composer.lock composer.phar phpunit.xml -geoip2.phar geoip2-php.sublime-* vendor/ *.sw? -t.php *.old diff --git a/bin/release.sh b/dev-bin/release.sh similarity index 54% rename from bin/release.sh rename to dev-bin/release.sh index 33c033f..09e2fb6 100755 --- a/bin/release.sh +++ b/dev-bin/release.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + TAG=$1 if [ -z $TAG ]; then @@ -7,18 +9,37 @@ if [ -z $TAG ]; then exit 1 fi +rm geoip2.phar + if [ -n "$(git status --porcelain)" ]; then echo ". is not clean." >&2 exit 1 fi +if [ -d vendor ]; then + rm -fr vendor +fi + +php composer.phar self-update +php composer.phar update --no-dev + +if [ ! -f box.phar ]; then + wget -O box.phar "https://github.com/kherge-archive/Box/releases/download/2.4.4/box-2.4.4.phar" +fi + +php box.phar build + +php composer.phar update + +./vendor/bin/phpunit + if [ ! -d .gh-pages ]; then echo "Checking out gh-pages in .gh-pages" git clone -b gh-pages git@git.maxmind.com:GeoIP2-php .gh-pages - cd .gh-pages + pushd .gh-pages else echo "Updating .gh-pages" - cd .gh-pages + pushd .gh-pages git pull fi @@ -27,7 +48,25 @@ if [ -n "$(git status --porcelain)" ]; then exit 1 fi -../vendor/bin/apigen --quiet --download --title "GeoIP2 PHP API $TAG" --source ../src --destination doc/$TAG +# We no longer have apigen as a dependency in Composer as releases are +# sporadically deleted upstream and compatibility is often broken on patch +# releases. +if [ ! -f apigen.phar ]; then + wget -O apigen.phar "https://github.com/apigen/apigen/releases/download/v4.0.0-RC3/apigen-4.0.0-RC3.phar" +fi + + +cat < apigen.neon +destination doc/$TAG + +source: + ../src + +title: "GeoIP2 PHP API $TAG" +EOF + +php apigen.phar + PAGE=index.md cat < $PAGE @@ -57,7 +96,8 @@ fi git push git@github.com:maxmind/GeoIP2-php.git git push -cd .. +popd + git tag -a $TAG git push git push --tags From 09cf864045431776103ffa2b4d0852846b4e61aa Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Tue, 28 Oct 2014 14:52:18 -0700 Subject: [PATCH 2/6] Be sure to include all LICENSE files in phar --- box.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/box.json b/box.json index 9d61955..459a60d 100644 --- a/box.json +++ b/box.json @@ -13,6 +13,8 @@ "finder": [ { "name": [ + "LICENSE", + "LICENSE.*", "*.php", "*.pem", "*.pem.md5" From 2d6d43b62cfb16983e16f2fab84c71c01d2ef6c7 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Tue, 28 Oct 2014 15:44:49 -0700 Subject: [PATCH 3/6] Bump next release to 2.1.0 as it adds new features --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d605870..782cc34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ========= -2.0.1 (2014-09-XX) +2.1.0 (2014-09-XX) ------------------ * Update ApiGen dependency to version that isn't broken on case sensitive From f1fe6587b4d21d534c9a608c38f496f4300a9c9c Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 29 Oct 2014 08:46:57 -0700 Subject: [PATCH 4/6] Fix outdated docs and use ` instead of --- src/GeoIp2/Database/Reader.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/GeoIp2/Database/Reader.php b/src/GeoIp2/Database/Reader.php index fcc04a9..ffad303 100644 --- a/src/GeoIp2/Database/Reader.php +++ b/src/GeoIp2/Database/Reader.php @@ -8,13 +8,9 @@ use MaxMind\Db\Reader as DbReader; /** * Instances of this class provide a reader for the GeoIP2 database format. - * IP addresses can be looked up using the country - * and city methods. We also provide cityIspOrg - * and omni methods to ease compatibility with the web service - * client, although we may offer the ability to specify additional databases - * to replicate these web services in the future (e.g., the ISP/Org database). + * IP addresses can be looked up using the database specific methods. * - * **Usage** + * ## Usage ## * * The basic API for this class is the same for every database. First, you * create a reader object, specifying a file name. You then call the method @@ -25,7 +21,7 @@ use MaxMind\Db\Reader as DbReader; * the method you called. This model in turn contains multiple record classes, * each of which represents part of the data returned by the database. If * the database does not contain the requested information, the attributes - * on the record class will have a null value. + * on the record class will have a `null` value. * * If the address is not in the database, an * {@link \GeoIp2\Exception\AddressNotFoundException} exception will be From 1546532b39e618043c287dfa4c014647247e36c4 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 29 Oct 2014 08:48:07 -0700 Subject: [PATCH 5/6] Prepare for 2.1.0 --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 782cc34..4bf29fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ CHANGELOG ========= -2.1.0 (2014-09-XX) +2.1.0 (2014-10-29) ------------------ * Update ApiGen dependency to version that isn't broken on case sensitive @@ -10,7 +10,7 @@ CHANGELOG `GeoIP2\Database\Reader` class now has an `anonymousIp` method which returns a `GeoIP2\Model\AnonymousIp` object. * Boolean attributes like those in the `GeoIP2\Record\Traits` class now return - `false` insteadof `null` when they were not true. + `false` instead of `null` when they were not true. 2.0.0 (2014-09-22) ------------------ From 076213aedb0240dcced07004e249f34041e971a6 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 29 Oct 2014 09:03:25 -0700 Subject: [PATCH 6/6] Switch another usage --- src/GeoIp2/WebService/Client.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/GeoIp2/WebService/Client.php b/src/GeoIp2/WebService/Client.php index dfccc3b..45db4ae 100644 --- a/src/GeoIp2/WebService/Client.php +++ b/src/GeoIp2/WebService/Client.php @@ -30,13 +30,12 @@ use Guzzle\Http\Exception\ServerErrorResponseException; * The web service may not return any information for an entire record, in * which case all of the attributes for that record class will be empty. * - * **Usage** + * ## Usage ## * * The basic API for this class is the same for all of the web service end - * points. First you create a web service object with your MaxMind - * $userId and $licenseKey, then you call the method - * corresponding to a specific end point, passing it the IP address you want - * to look up. + * points. First you create a web service object with your MaxMind `$userId` + * and `$licenseKey`, then you call the method corresponding to a specific end + * point, passing it the IP address you want to look up. * * If the request succeeds, the method call will return a model class for * the end point you called. This model in turn contains multiple record