Skip to content

Commit

Permalink
Add bootstrap for req_mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
moznion committed Nov 21, 2016
1 parent b81294c commit b26583e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.phar
/docs/
*.iml
vendor/
devtool/req_mirror
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
COMPOSER_BIN = ./vendor/bin

.PHONY: default test doc phpcs phpmd check
.PHONY: default test doc phpcs phpmd check install-devtool

default: check

Expand All @@ -26,3 +26,6 @@ copyright:

check: test copyright phpcs phpmd

install-devtool:
bash ./devtool/download_req_mirror.sh

26 changes: 26 additions & 0 deletions devtool/download_req_mirror.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -eu

function die() {
echo 'Unsupported machine environment, please try go build your self: https://github.com/moznion/req_mirror'
exit 1
}

VER='0.0.1'
OS="$(tr '[A-Z]' '[a-z]' <<<$(uname))"
ARCH="$(tr '[A-Z]' '[a-z]' <<<$(arch))"

if [ ${ARCH} = 'i386' ] ; then
ARCH='386'
elif [ ${ARCH} = 'x86_64' ] ; then
ARCH='amd64'
fi

BIN_URL="https://github.com/moznion/req_mirror/releases/download/${VER}/req_mirror_${OS}_${ARCH}_${VER}"
BIN="$(pwd)/$(git rev-parse --show-cdup)/devtool/req_mirror"

curl --fail --location --output ${BIN} ${BIN_URL}

chmod 755 ${BIN}

0 comments on commit b26583e

Please sign in to comment.