Skip to content

Commit

Permalink
Add README/build script to prep for 0.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dshafik committed Jan 12, 2019
1 parent b04bc50 commit 382d219
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 7 deletions.
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
# Akamai CLI - API Gateway
# Akamai CLI for API Gateway

## Installation
Akamai CLI for API Gateway allows you manage the Akamai API Gateway.

## Install

To install, use [Akamai CLI](https://github.com/akamai/cli):

```
akamai install api-gateway
```
git clone git@github.com:akamai/cli-api-gateway.git
cd cli-api-gateway
dep ensure
go install ./...
```

You may also use this as a stand-alone command by downloading the
[latest release binary](https://github.com/akamai/cli-api-gateway/releases)
for your system, or by cloning this repository and compiling it yourself.

### Compiling from Source

If you want to compile it from source, you will need Go 1.7 or later, and the [Dep](https://golang.github.io/dep/) package manager installed:

1. Fetch the package:
`go get github.com/akamai/cli-api-gateway`
2. Change to the package directory:
`cd $GOPATH/src/github.com/akamai/cli-api-gateway`
3. Install dependencies using `dep`:
`dep ensure`
4. Compile the binaries:
- Linux/macOS/*nix:
- `go build -o akamai-api-gateway ./api-gateway`
- `go build -o akamai-api-keys ./api-keys`
- `go build -o akamai-api-security ./api-security`
- Windows:
- `go build -o akamai-api-gateway.exe ./api-gateway`
- `go build -o akamai-api-keys.exe ./api-keys`
- `go build -o akamai-api-security.exe ./api-security`
5. Move the binaries in to your `PATH`
52 changes: 52 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
function check_version {
grep "VERSION" ./main.go | grep \"$1\"
if [[ $? -eq 1 ]]
then
echo "VERSION hasn't been updated"
exit 1
fi
}

function build_binary {
CURRENT_BIN=$(basename "$PWD")
OUTPUT="../build/akamai-${CURRENT_BIN}-$1"
mkdir -p ../build

GOOS=darwin GOARCH=amd64 go build -o ${OUTPUT}-macamd64 .
shasum -a 256 ${OUTPUT}-macamd64 | awk '{print $1}' > ${OUTPUT}-macamd64.sig
GOOS=linux GOARCH=amd64 go build -o ${OUTPUT}-linuxamd64 .
shasum -a 256 ${OUTPUT}-linuxamd64 | awk '{print $1}' > ${OUTPUT}-linuxamd64.sig
GOOS=linux GOARCH=386 go build -o ${OUTPUT}-linux386 .
shasum -a 256 ${OUTPUT}-linux386 | awk '{print $1}' > ${OUTPUT}-linux386.sig
GOOS=windows GOARCH=386 go build -o ${OUTPUT}-windows386.exe .
shasum -a 256 ${OUTPUT}-windows386.exe | awk '{print $1}' > ${OUTPUT}-windows386.exe.sig
GOOS=windows GOARCH=amd64 go build -o ${OUTPUT}-windowsamd64.exe .
shasum -a 256 ${OUTPUT}-windowsamd64.exe | awk '{print $1}' > ${OUTPUT}-windowsamd64.exe.sig
}

if [[ -z "$1" ]]
then
echo "Version not supplied."
echo "Usage: build.sh <version>"
exit 1
fi

CURRENT_BIN=$(basename "$PWD")
if [[ $CURRENT_BIN == "cli-api-gateway" ]]
then
for CURRENT_BIN in api-gateway api-keys api-security
do
echo "Building ${CURRENT_BIN}"
cd $CURRENT_BIN
check_version $1
build_binary $1
cd ..
done
echo "Done."
else
echo "Building ${CURRENT_BIN}"
check_version $1
build_binary $1
echo "Done."
fi

0 comments on commit 382d219

Please sign in to comment.