Skip to content

Commit 382d219

Browse files
committed
Add README/build script to prep for 0.1.0 release
1 parent b04bc50 commit 382d219

File tree

2 files changed

+86
-7
lines changed

2 files changed

+86
-7
lines changed

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
1-
# Akamai CLI - API Gateway
1+
# Akamai CLI for API Gateway
22

3-
## Installation
3+
Akamai CLI for API Gateway allows you manage the Akamai API Gateway.
4+
5+
## Install
6+
7+
To install, use [Akamai CLI](https://github.com/akamai/cli):
8+
9+
```
10+
akamai install api-gateway
411
```
5-
git clone git@github.com:akamai/cli-api-gateway.git
6-
cd cli-api-gateway
7-
dep ensure
8-
go install ./...
9-
```
12+
13+
You may also use this as a stand-alone command by downloading the
14+
[latest release binary](https://github.com/akamai/cli-api-gateway/releases)
15+
for your system, or by cloning this repository and compiling it yourself.
16+
17+
### Compiling from Source
18+
19+
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:
20+
21+
1. Fetch the package:
22+
`go get github.com/akamai/cli-api-gateway`
23+
2. Change to the package directory:
24+
`cd $GOPATH/src/github.com/akamai/cli-api-gateway`
25+
3. Install dependencies using `dep`:
26+
`dep ensure`
27+
4. Compile the binaries:
28+
- Linux/macOS/*nix:
29+
- `go build -o akamai-api-gateway ./api-gateway`
30+
- `go build -o akamai-api-keys ./api-keys`
31+
- `go build -o akamai-api-security ./api-security`
32+
- Windows:
33+
- `go build -o akamai-api-gateway.exe ./api-gateway`
34+
- `go build -o akamai-api-keys.exe ./api-keys`
35+
- `go build -o akamai-api-security.exe ./api-security`
36+
5. Move the binaries in to your `PATH`

build.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
function check_version {
3+
grep "VERSION" ./main.go | grep \"$1\"
4+
if [[ $? -eq 1 ]]
5+
then
6+
echo "VERSION hasn't been updated"
7+
exit 1
8+
fi
9+
}
10+
11+
function build_binary {
12+
CURRENT_BIN=$(basename "$PWD")
13+
OUTPUT="../build/akamai-${CURRENT_BIN}-$1"
14+
mkdir -p ../build
15+
16+
GOOS=darwin GOARCH=amd64 go build -o ${OUTPUT}-macamd64 .
17+
shasum -a 256 ${OUTPUT}-macamd64 | awk '{print $1}' > ${OUTPUT}-macamd64.sig
18+
GOOS=linux GOARCH=amd64 go build -o ${OUTPUT}-linuxamd64 .
19+
shasum -a 256 ${OUTPUT}-linuxamd64 | awk '{print $1}' > ${OUTPUT}-linuxamd64.sig
20+
GOOS=linux GOARCH=386 go build -o ${OUTPUT}-linux386 .
21+
shasum -a 256 ${OUTPUT}-linux386 | awk '{print $1}' > ${OUTPUT}-linux386.sig
22+
GOOS=windows GOARCH=386 go build -o ${OUTPUT}-windows386.exe .
23+
shasum -a 256 ${OUTPUT}-windows386.exe | awk '{print $1}' > ${OUTPUT}-windows386.exe.sig
24+
GOOS=windows GOARCH=amd64 go build -o ${OUTPUT}-windowsamd64.exe .
25+
shasum -a 256 ${OUTPUT}-windowsamd64.exe | awk '{print $1}' > ${OUTPUT}-windowsamd64.exe.sig
26+
}
27+
28+
if [[ -z "$1" ]]
29+
then
30+
echo "Version not supplied."
31+
echo "Usage: build.sh <version>"
32+
exit 1
33+
fi
34+
35+
CURRENT_BIN=$(basename "$PWD")
36+
if [[ $CURRENT_BIN == "cli-api-gateway" ]]
37+
then
38+
for CURRENT_BIN in api-gateway api-keys api-security
39+
do
40+
echo "Building ${CURRENT_BIN}"
41+
cd $CURRENT_BIN
42+
check_version $1
43+
build_binary $1
44+
cd ..
45+
done
46+
echo "Done."
47+
else
48+
echo "Building ${CURRENT_BIN}"
49+
check_version $1
50+
build_binary $1
51+
echo "Done."
52+
fi

0 commit comments

Comments
 (0)