Skip to content

Commit

Permalink
Prepare for 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Jun 18, 2015
1 parent 9a21ddf commit d87a678
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 3 deletions.
36 changes: 36 additions & 0 deletions box.json
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
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"require": {
"php": ">=5.3",
"ext-json": "*",
"geoip2/geoip2": "2.2.0-alpha2",
"maxmind/web-service-common": "~0.0.1",
"geoip2/geoip2": "2.2.0-beta1",
"maxmind/web-service-common": "~0.0.2",
"respect/validation": "~0.9.1"
},
"require-dev": {
Expand Down
10 changes: 10 additions & 0 deletions dev-bin/phar-test.php
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');
115 changes: 115 additions & 0 deletions dev-bin/release.sh
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
3 changes: 3 additions & 0 deletions phar-stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require_once 'phar://minfraud.phar/vendor/autoload.php';
2 changes: 1 addition & 1 deletion src/MinFraud.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
class MinFraud
{
const VERSION = '0.0.1';
const VERSION = 'v0.1.0';

private $client;
private static $host = 'minfraud.maxmind.com';
Expand Down

0 comments on commit d87a678

Please sign in to comment.