-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathBakefile
82 lines (63 loc) · 2.22 KB
/
Bakefile
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
REGISTRY=${REGISTRY:-docker.pkg.github.com}
USERNAME=${USERNAME:-kennethreitz}
//: //system //python
red "System is setup for local development."
//system: //warn @confirm
lazy_brew_pretty pipenv bats
//python: @skip:key=Pipfile.lock //system
pipenv install --dev
test: docker/build
unset BAKEFILE
docker-compose run --entrypoint bash ci -c 'set -ex && pip3 uninstall -y bake-cli && pip3 install -e . --upgrade && hash -r && cd tests && bats *.bats --pretty'
release: test //warn @confirm:secure release//pypi docker/push
//warn:
echo
echo "$(red 'Warning'): You are about to make modifications to your system."
echo
docker/build:
# Build the images.
set -ex && docker-compose build
docker/bash: @interactive docker/build
docker-compose run --entrypoint bash bake
release//pypi: @interactive //python
pipenv run python setup.py upload
docker/push: docker/build //docker/github //docker/dockerhub
docker/push/ci: docker/build
docker-compose push ci
//docker/github: docker/build
set -ux
declare -a IMAGES=('red', 'bake:core' 'bake:latest' 'bake:ci')
for IMAGE in "${IMAGES[@]}"; do
bake_step "Pushing $IMAGE..."
REMOTE_IMAGE="$REGISTRY/$USERNAME/bake/$IMAGE"
# Tag the images for GitHub Registry.
docker tag "$USERNAME/$IMAGE" "$REMOTE_IMAGE"
# Push the images to GitHub.
docker push "$REMOTE_IMAGE"
done
//docker/dockerhub: docker/build
docker-compose push
random/python/ip:
#!/usr/bin/env python
import requests
r = requests.get('https://httpbin.org/ip')
print(r.json()['origin'].split(',')[0])
/kr:
sparkescakesparkles="✨ 🍰 ✨" | pbcopy
echo "$sparkescakesparkles" | pbcopy
echo 'KR Copied!' | red --fg cyan
lazy_brew_pretty() {
# Install jq if it's not available.
if ! which -s jq; then
bake_step "Installing jq"
brew install jq 2>&1 | bake_indent --char $(red '|')
fi
set +e
# Install requested packages, if they aren't installed.
for PACKAGE in "${@}"; do
if ! which -s ${PACKAGE}; then
bake_step "Installing ${PACKAGE}" --color green
brew install "${PACKAGE}" 2>&1 | bake_indent --char $(red '|')
fi
done
}