-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
167 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"alias": "minfraud.phar", | ||
"main": "phar-stub.php", | ||
"output": "minfraud.phar", | ||
"compactors": [ | ||
"Herrera\\Box\\Compactor\\Composer", | ||
"Herrera\\Box\\Compactor\\Json", | ||
"Herrera\\Box\\Compactor\\Php" | ||
], | ||
"files": [ | ||
"LICENSE" | ||
], | ||
"finder": [ | ||
{ | ||
"name": [ | ||
"LICENSE", | ||
"LICENSE.*", | ||
"*.php", | ||
"*.pem", | ||
"*.pem.md5" | ||
], | ||
"exclude": [ | ||
"phpunit", | ||
"satooshi", | ||
"Tests", | ||
"tests", | ||
"yaml" | ||
], | ||
"in": "vendor" | ||
} | ||
], | ||
"directories": ["src/"], | ||
"git-version": "git-version", | ||
"shebang": false, | ||
"stub": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
// This just tests that it can load the MinFraud class and its dependencies | ||
// from the phar. | ||
require_once 'minfraud.phar'; | ||
|
||
use MaxMind\MinFraud; | ||
|
||
$reader = new MinFraud(1, 'ABCD567890'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
VERSION=$(perl -MFile::Slurp::Tiny=read_file -MDateTime <<EOF | ||
use v5.16; | ||
my \$log = read_file(q{CHANGELOG.md}); | ||
\$log =~ /\n(\d+\.\d+\.\d+) \((\d{4}-\d{2}-\d{2})\)\n/; | ||
die 'Release time is not today!' unless DateTime->now->ymd eq \$2; | ||
say \$1; | ||
EOF | ||
) | ||
|
||
TAG="v$VERSION" | ||
|
||
if [ -f minfraud.phar ]; then | ||
rm minfraud.phar | ||
fi | ||
|
||
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 | ||
|
||
perl -pi -e "s/(?<=const VERSION = ').+?(?=';)/$TAG/g" src/MinFraud.php | ||
|
||
if [ ! -f box.phar ]; then | ||
wget -O box.phar "https://github.com/box-project/box2/releases/download/2.5.0/box-2.5.0.phar" | ||
fi | ||
|
||
php box.phar build | ||
|
||
PHAR_TEST=$(./dev-bin/phar-test.php) | ||
if [[ -n $PHAR_TEST ]]; then | ||
echo "Phar test outputed non-empty string: $PHAR_TEST" | ||
exit 1 | ||
fi | ||
|
||
# Download test deps | ||
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@github.maxmind.com:maxmind/minfraud-api-php.git .gh-pages | ||
pushd .gh-pages | ||
else | ||
echo "Updating .gh-pages" | ||
pushd .gh-pages | ||
git pull | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo ".gh-pages is not clean" >&2 | ||
exit 1 | ||
fi | ||
|
||
# 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 <<EOF > apigen.neon | ||
destination: doc/$TAG | ||
source: | ||
- ../src | ||
title: "minFraud Score and Insights PHP API $TAG" | ||
EOF | ||
|
||
php apigen.phar generate | ||
|
||
|
||
PAGE=index.md | ||
cat <<EOF > $PAGE | ||
--- | ||
layout: default | ||
title: minFraud Score and Insights PHP API | ||
language: php | ||
version: $TAG | ||
--- | ||
EOF | ||
|
||
cat ../README.md >> $PAGE | ||
|
||
git add doc/ | ||
git commit -m "Updated for $TAG" -a | ||
|
||
read -e -p "Push to origin? " SHOULD_PUSH | ||
|
||
if [ "$SHOULD_PUSH" != "y" ]; then | ||
echo "Aborting" | ||
exit 1 | ||
fi | ||
|
||
git push | ||
|
||
popd | ||
|
||
git tag -a $TAG | ||
git push | ||
git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
require_once 'phar://minfraud.phar/vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters