Skip to content

Commit

Permalink
Merge pull request #28 from WillAbides/bindown
Browse files Browse the repository at this point in the history
rename the command to bindown
  • Loading branch information
WillAbides authored Nov 25, 2019
2 parents 590e6c4 + fc79eec commit 9947760
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
- name: Test
run: script/test
- name: Build
run: make bin/bindownloader
run: make bin/bindown
- name: Lint
run: script/lint
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ before:
hooks:
- script/lint
builds:
- id: bindownloader
main: ./cmd/bindownloader
- id: bindown
main: ./cmd/bindown
goos:
- linux
- darwin
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ GOBUILD=$(GOCMD) build

.PHONY: gobuildcache

bin/bindownloader: gobuildcache
$(GOBUILD) -o $@ ./cmd/bindownloader
bins += bin/bindownloader
bin/bindown: gobuildcache
$(GOBUILD) -o $@ ./cmd/bindown
bins += bin/bindown

bin/golangci-lint: bin/bindownloader
bin/bindownloader download $@
bin/golangci-lint: bin/bindown
bin/bindown download $@
bins += bin/golangci-lint

bin/gobin: bin/bindownloader
bin/bindownloader download $@
bin/gobin: bin/bindown
bin/bindown download $@
bins += bin/gobin

bin/goreleaser: bin/bindownloader
bin/bindownloader download $@
bin/goreleaser: bin/bindown
bin/bindown download $@
bins += bin/goreleaser

bin/semver-next: bin/bindownloader
bin/bindownloader download $@
bin/semver-next: bin/bindown
bin/bindown download $@
bins += bin/semver-next

GOIMPORTS_REF := 8aaa1484dc108aa23dcf2d4a09371c0c9e280f6b
Expand Down
4 changes: 2 additions & 2 deletions bootstrapper/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ execute() {
srcdir="${tmpdir}"
(cd "${tmpdir}" && untar "${TARBALL}")
test ! -d "${BINDIR}" && install -d "${BINDIR}"
binexe="bindownloader"
binexe="bindown"
if [ "$OS" = "windows" ]; then
binexe="${binexe}.exe"
fi
Expand All @@ -63,7 +63,7 @@ uname_arch_check "$ARCH"
parse_args "$@"

VERSION=${TAG#v}
NAME=bindownloader_${VERSION}_${OS}_${ARCH}
NAME=bindown_${VERSION}_${OS}_${ARCH}
TARBALL=${NAME}.${FORMAT}
TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}

Expand Down
2 changes: 1 addition & 1 deletion bootstrapper/shlib.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##/ this is the part of bootstrap-bindownloader.sh that comes from https://github.com/client9/shlib
##/ this is the part of bootstrap-bindown.sh that comes from https://github.com/client9/shlib
##/ used in script/build-bootstrapper

cat /dev/null <<EOF
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions script/bindownloader → script/bindown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

CDPATH="" cd -- "$(dirname -- "$(dirname -- "$0")")"

make -s bin/bindownloader
make -s bin/bindown

# shellcheck disable=SC2068
bin/bindownloader $@
bin/bindown $@
14 changes: 7 additions & 7 deletions script/build-bootstrapper
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ TAG="v$(grep "_linux_amd64.tar.gz" "dist/checksums.txt" | cut -d "_" -f2)"

CHECKSUMS="$(cat dist/checksums.txt)"

rm -f dist/bootstrap-bindownloader.sh
touch dist/bootstrap-bindownloader.sh
chmod +x dist/bootstrap-bindownloader.sh
rm -f dist/bootstrap-bindown.sh
touch dist/bootstrap-bindown.sh
chmod +x dist/bootstrap-bindown.sh

# write the dynamic part of bootstrap-bindownloader.sh
cat << EOF > dist/bootstrap-bindownloader.sh
# write the dynamic part of bootstrap-bindown.sh
cat << EOF > dist/bootstrap-bindown.sh
#!/bin/sh
set -e
Expand All @@ -31,5 +31,5 @@ EOT
EOF

cat bootstrapper/shlib.sh | grep -v "^##/" >> dist/bootstrap-bindownloader.sh
cat bootstrapper/main.sh | grep -v "^##/" >> dist/bootstrap-bindownloader.sh
cat bootstrapper/shlib.sh | grep -v "^##/" >> dist/bootstrap-bindown.sh
cat bootstrapper/main.sh | grep -v "^##/" >> dist/bootstrap-bindown.sh
10 changes: 5 additions & 5 deletions script/upload-release-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ CDPATH="" cd -- "$(dirname -- "$(dirname -- "$0")")"

AUTH_HEADER="Authorization: token $GITHUB_TOKEN"

[ -f "dist/bootstrap-bindownloader.sh" ] || {
echo dist/bootstrap-bindownloader.sh is required
[ -f "dist/bootstrap-bindown.sh" ] || {
echo dist/bootstrap-bindown.sh is required
exit 1
}

TAG="$(grep "^TAG=" dist/bootstrap-bindownloader.sh | cut -d\" -f2)"
TAG="$(grep "^TAG=" dist/bootstrap-bindown.sh | cut -d\" -f2)"

release_id="$(curl -s -H "$AUTH_HEADER" "https://api.github.com/repos/WillAbides/bindownloader/releases/tags/$TAG" | jq .id)"
upload_url="https://uploads.github.com/repos/WillAbides/bindownloader/releases/$release_id/assets?name=bootstrap-bindownloader.sh"
upload_url="https://uploads.github.com/repos/WillAbides/bindownloader/releases/$release_id/assets?name=bootstrap-bindown.sh"
echo "$upload_url"

file_content="$(cat dist/bootstrap-bindownloader.sh)"
file_content="$(cat dist/bootstrap-bindown.sh)"

curl -X POST -H "$AUTH_HEADER" -H "Content-Type: application/text" -d "$file_content" "$upload_url"

0 comments on commit 9947760

Please sign in to comment.