1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-27 03:34:46 +01:00

Add a Makefile

This commit is contained in:
Oliver Steele 2017-06-20 09:00:04 -04:00
parent 67ebfd87a9
commit 6938f80fea
2 changed files with 58 additions and 1 deletions

45
Makefile Normal file
View File

@ -0,0 +1,45 @@
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
BINARY = gojekyll
PACKAGE = github.com/osteele/gojekyll
COMMIT_HASH = `git rev-parse --short HEAD 2>/dev/null`
BUILD_TIME = `date +%FT%T%z`
VERSION=0.0.0
LDFLAGS=-ldflags "-X ${PACKAGE}.Version=${VERSION} -X ${PACKAGE}.BuildTime=${BUILD_TIME}"
.DEFAULT_GOAL: $(BINARY)
.PHONY: build clean dependencies setup install lint test help
$(BINARY): $(SOURCES)
go build ${LDFLAGS} -o ${BINARY} ${PACKAGE}/cmd/gojekyll
build: $(BINARY) ## compile the package
clean: ## remove binary files
rm -fI ${BINARY}
dependencies: ## list dependencies
go list -f '{{ join .Imports "\n" }}' \
| grep -v ${PACKAGE} \
| grep '\.'
setup: ## install dependencies and development tools
go get ./...
go get -u github.com/alecthomas/gometalinter
gometalinter --install
install: ## compile and install the executable
go install ${LDFLAGS} ${PACKAGE}/cmd/gojekyll
lint: ## lint the package
gometalinter ./...
test: ## test the package
go test ${LDFLAGS} ./...
# Source: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@ -87,9 +87,19 @@ This is currently about 10x slower than using the embedded engine, but still 5x
Neither the embedded Liquid server nor the Liquid Template Server implements very many Jekyll Liquid filters or tags. I'm adding to these as necessary to support my own sites. Neither the embedded Liquid server nor the Liquid Template Server implements very many Jekyll Liquid filters or tags. I'm adding to these as necessary to support my own sites.
## Development ## Develop
Install package dependencies and development tools:
```bash ```bash
make setup
```
Test:
```bash
make test
make lint
gojekyll render index.md # render a file to stdout gojekyll render index.md # render a file to stdout
gojekyll render / # render a URL to stdout gojekyll render / # render a URL to stdout
gojekyll variables / # print a file or URL's variables gojekyll variables / # print a file or URL's variables
@ -108,6 +118,8 @@ go tool pprof gojekyll gojekyll.prof
For rendering Liquid templates: ACS Technologies's fork [acstech/liquid](https://github.com/acstech/liquid) of Karl Seguin's [karlseguin/liquid](https://github.com/karlseguin/liquid) Go implementation; or, Jun Yang's JavaScript implementation [harttle/shopify-liquid](https://github.com/harttle/shopify-liquid/) via JSON-RPC. For rendering Liquid templates: ACS Technologies's fork [acstech/liquid](https://github.com/acstech/liquid) of Karl Seguin's [karlseguin/liquid](https://github.com/karlseguin/liquid) Go implementation; or, Jun Yang's JavaScript implementation [harttle/shopify-liquid](https://github.com/harttle/shopify-liquid/) via JSON-RPC.
Jascha Ephraim's [jaschaephraim/lrserver](https://github.com/jaschaephraim/lrserver) Live Reload server.
The gopher image in the test directory is from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Gophercolor.jpg). It is used under the [Creative Commons Attribution-Share Alike 3.0 Unported license](https://creativecommons.org/licenses/by-sa/3.0/deed.en). The gopher image in the test directory is from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Gophercolor.jpg). It is used under the [Creative Commons Attribution-Share Alike 3.0 Unported license](https://creativecommons.org/licenses/by-sa/3.0/deed.en).
## Related ## Related