forked from heroku/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_init
More file actions
executable file
·118 lines (100 loc) · 2.12 KB
/
_init
File metadata and controls
executable file
·118 lines (100 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
# shellcheck disable=SC2034
# fail wait when any children fails
set -m
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
# Set magic variables for current file & dir
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "$(dirname "${dir}")" && pwd)"
scripts="$root/scripts"
tmp="$root/tmp"
dist="$root/dist"
dist_deb="$root/dist/apt"
CHANNEL=$(./scripts/_vars/_channel)
VERSION=$(./scripts/_vars/_version)
SHORT_VERSION=$(node -p "require('./package.json').version")
DEB_VERSION="${SHORT_VERSION}-1"
PLATFORMS=(
windows_x86
windows_x64
darwin_x64
linux_x86
linux_x64
linux_arm
)
DEB_ARCHS=(
x64
x86
arm
)
function split_platform () {
IFS='_' read -ra _platform <<< "$1"
export OS=${_platform[0]}
export ARCH=${_platform[1]}
}
if [[ "${CIRCLE_JOB-}" == build_* ]]; then
IFS='_' read -ra _platform <<< "$CIRCLE_JOB"
export OS=${_platform[1]}
export ARCH=${_platform[2]}
fi
function versioned_base () {
echo "heroku-cli-v${VERSION}-${OS}-${ARCH}"
}
function unversioned_base () {
echo "heroku-cli-${OS}-${ARCH}"
}
function workspace_dir () {
echo "$tmp/${OS}_${ARCH}"
}
function tgz_path () {
echo "$dist/$(unversioned_base).tar.gz"
}
function txz_path () {
echo "$dist/$(unversioned_base).tar.xz"
}
function go_home () {
cd "${root}"
}
go_home
function bg () {
"$@" &
pids="${pids:-} $!"
}
function wait_all () {
for pid in $pids; do
wait "${pid}" || exit 1
done
}
function s3upload () {
aws s3 cp "$@"
}
function s3uploadLongCache () {
s3upload --cache-control max-age=86400 "$@"
}
function s3uploadShortCache () {
s3upload --cache-control max-age=3600 "$@"
}
function deb_arch () {
if [[ "$ARCH" = "x64" ]]; then
echo "amd64"
elif [[ "$ARCH" = "x86" ]]; then
echo "i386"
elif [[ "$ARCH" = "arm" ]]; then
echo "armel"
fi
}
function unversioned_deb_base () {
echo "heroku_$(deb_arch)"
}
function unversioned_deb_path () {
echo "$dist_deb/$(unversioned_deb_base).deb"
}
function versioned_deb_base () {
echo "heroku_${DEB_VERSION}_$(deb_arch)"
}
function versioned_deb_path () {
echo "$dist_deb/$(versioned_deb_base).deb"
}