-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove makefile and replace with go generate
- Loading branch information
1 parent
a7a9bcb
commit 9281a1c
Showing
9 changed files
with
333 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
dist | ||
tldr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,10 @@ | ||
.PHONY: generate data setup | ||
|
||
install: setup data generate | ||
go get ./... | ||
go install | ||
|
||
release: setup-release | ||
@: $(if ${GITHUB_TOKEN},,$(error GITHUB_TOKEN must be defined)) | ||
git tag -a $(VERSION) -m "$(VERSION)" | ||
git push origin $(VERSION) | ||
goreleaser --rm-dist --parallelism 1 || (git tag -d $(VERSION) && git push --delete origin $(VERSION)) | ||
|
||
autorelease: install | ||
@: $(if ${GITHUB_TOKEN},,$(error GITHUB_TOKEN must be defined)) | ||
git add . && git diff --cached --exit-code || \ | ||
( \ | ||
echo 'New data files found, updating...' \ | ||
&& git commit -m "Update data files" \ | ||
&& git push origin master \ | ||
&& GITHUB_TOKEN="${GITHUB_TOKEN}" $(MAKE) release VERSION=v1.0.$$(date +%s)\ | ||
) | ||
|
||
data: | ||
rm -fr data | ||
mkdir data | ||
curl -sSL https://github.com/tldr-pages/tldr/raw/master/LICENSE.md -o LICENSE-tldr-pages | ||
curl -sSL https://github.com/tldr-pages/tldr/archive/master.tar.gz | \ | ||
tar --transform 's/\.md//' -xz --directory data tldr-master/pages/ --strip-components=2 | ||
cp -n data/common/* data/linux/ | ||
cp -n data/common/* data/osx/ | ||
cp -n data/common/* data/sunos/ | ||
cp -n data/common/* data/windows/ | ||
|
||
generate: | ||
cd data/linux && embedfiles -out ../../data_linux.go . | ||
cd data/osx && embedfiles -out ../../data_darwin.go . | ||
cd data/sunos && embedfiles -out ../../data_solaris.go . | ||
cd data/windows && embedfiles -out ../../data_windows.go . | ||
go generate | ||
|
||
setup: | ||
go get 4d63.com/embedfiles | ||
build: generate | ||
go build | ||
|
||
setup-release: | ||
go get github.com/goreleaser/goreleaser | ||
release: generate | ||
git diff --cached --exit-code | ||
git add . && git diff --cached --exit-code | ||
go run github.com/goreleaser/goreleaser --rm-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package main | ||
|
||
//go:generate sh data.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /usr/bin/env sh | ||
|
||
cwd="$PWD" | ||
|
||
rm -fr data | ||
mkdir data | ||
curl -sSL https://github.com/tldr-pages/tldr/raw/master/LICENSE.md -o LICENSE-tldr-pages | ||
curl -sSL https://github.com/tldr-pages/tldr/archive/master.tar.gz | tar --transform 's/\.md//' -xz --directory data tldr-master/pages/ --strip-components=2 | ||
cp -n data/common/* data/linux/ | ||
cp -n data/common/* data/osx/ | ||
cp -n data/common/* data/sunos/ | ||
cp -n data/common/* data/windows/ | ||
cd "$cwd"/data/linux && go run 4d63.com/embedfiles -out ../../data_linux.go . | ||
cd "$cwd"/data/osx && go run 4d63.com/embedfiles -out ../../data_darwin.go . | ||
cd "$cwd"/data/sunos && go run 4d63.com/embedfiles -out ../../data_solaris.go . | ||
cd "$cwd"/data/windows && go run 4d63.com/embedfiles -out ../../data_windows.go . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// +build tools | ||
|
||
package main | ||
|
||
import ( | ||
_ "4d63.com/embedfiles" | ||
_ "github.com/goreleaser/goreleaser" | ||
) |