-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support of readme generation #35
Changes from 7 commits
c937138
f1e1bc2
772c210
852cbc8
a03ede3
91d2bcb
d2216f7
a14309f
0b312b6
7dba942
9dc0d14
334f941
eb502c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Cloud Posse Build Harness [![Build Status](https://travis-ci.org/cloudposse/build-harness.svg)](https://travis-ci.org/cloudposse/build-harness) | ||
{{ (datasource "section").warning }} | ||
|
||
This `build-harness` is a collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more. | ||
|
||
It's designed to work with CI/CD systems such as Travis CI, CircleCI and Jenkins. | ||
|
||
It's 100% Open Source and licensed under [APACHE2](LICENSE). | ||
|
||
|
||
## Usage | ||
|
||
At the top of your `Makefile` add, the following... | ||
|
||
```make | ||
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) | ||
``` | ||
|
||
This will download a `Makefile` called `.build-harness` and include it at run-time. We recommend adding the `.build-harness` file to your `.gitignore`. | ||
|
||
This automatically exposes many new targets that you can leverage throughout your build & CI/CD process. | ||
|
||
Run `make help` for a list of available targets. | ||
|
||
{{ (datasource "make").help }} | ||
|
||
## Real World Examples | ||
|
||
- [`github-authorized-keys`](https://github.com/cloudposse/github-authorized-keys/) - A Golang project that leverages `docker:%`, `go:%`, `travis:%` targets | ||
- [`charts`](https://github.com/cloudposse/charts/) - A collection of Helm Charts that leverages `docker:%` and `helm:%` targets | ||
- [`bastion`](https://github.com/cloudposse/bastion/) - A docker image that leverages `docker:%` and `bash:lint` targets | ||
- [`terraform-null-label`](https://github.com/cloudposse/terraform-null-label/) - A terraform module that leverages `terraform:%` targets | ||
|
||
{{ (datasource "section").help }} | ||
{{ (datasource "section").contributing }} | ||
|
||
Here's how to get started... | ||
|
||
1. `git clone https://github.com/cloudposse/{{ (datasource "repo").name }}.git` to pull down the repository | ||
2. `make init` to initialize the [`{{ (datasource "repo").name }}`](https://github.com/cloudposse/{{ (datasource "repo").name }}/) | ||
3. Review the [documentation](docs/) on compiling | ||
|
||
|
||
{{ (datasource "license").apache2 }} | ||
{{ (datasource "section").about }} | ||
|
||
### Contributors | ||
|
||
| | ||
{{- (datasource "contributor").erik }} | | ||
{{- (datasource "contributor").igor }} | | ||
|---|---| | ||
|
||
{{ (datasource "contributor")._links }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./terraform |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# Cloud Posse Build Harness [![Build Status](https://travis-ci.org/cloudposse/build-harness.svg)](https://travis-ci.org/cloudposse/build-harness) | ||
<!--- | ||
--- This file was automatically generated by the `build-harness` | ||
--- Make changes instead to `.README.md` and rebuild. | ||
---> | ||
|
||
This `build-harness` is a collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more. | ||
This `build-harness` is a collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more. | ||
|
||
It's designed to work with CI/CD systems such as Travis CI, CircleCI and Jenkins. | ||
|
||
|
@@ -21,24 +25,22 @@ This automatically exposes many new targets that you can leverage throughout you | |
|
||
Run `make help` for a list of available targets. | ||
|
||
|
||
## Makefile Targets | ||
|
||
```bash | ||
$ make help | ||
|
||
Available targets: | ||
Available targets: | ||
|
||
bash:lint Lint all bash scripts | ||
docker:build Build docker image | ||
docker:login Login into docker hub | ||
docs:copyright-add Add copyright headers to source code | ||
docs:toc-update Update table of contents in README.md | ||
geodesic:deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG) | ||
git:aliases-update Update git aliases | ||
git:submodules-update Update submodules | ||
github:download-private-release Download release from github | ||
github:download-public-release Download release from github | ||
git:submodules-update Update submodules | ||
go:build Build binary | ||
go:build-all Build binary for all platforms | ||
go:clean Clean compiled binary | ||
|
@@ -63,14 +65,20 @@ Available targets: | |
help This help screen | ||
jenkins:run-job-with-tag Run a Jenkins Job with $(TAG) | ||
make:lint Lint all makefiles | ||
readme:build Create README.md by building it from .README.md file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generate README.md from template file |
||
readme:deps Install dependencies | ||
readme:init Create basic minimalistic .README.md template file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
readme:toc-update Update table of contents in README.md | ||
terraform:deps Install dependencies | ||
terraform:get-modules Ensure all modules can be fetched | ||
terraform:get-plugins Ensure all plugins can be fetched | ||
terraform:install Install terraform | ||
terraform:lint Lint check Terraform | ||
terraform:validate Basic terraform sanity check | ||
travis:docker-login Login into docker hub | ||
travis:docker-tag-and-push Tag & Push according Travis environment variables | ||
``` | ||
|
||
``` | ||
|
||
## Real World Examples | ||
|
||
|
@@ -81,10 +89,9 @@ Available targets: | |
|
||
## Help | ||
|
||
**Got a question?** | ||
**Got a question?** | ||
|
||
File a GitHub [issue](https://github.com/cloudposse/build-harness/issues), send us an [email](mailto:[email protected]) or reach out to us on [Gitter](https://gitter.im/cloudposse/). | ||
|
||
## Contributing | ||
|
||
### Bug Reports & Feature Requests | ||
|
@@ -93,7 +100,7 @@ Please use the [issue tracker](https://github.com/cloudposse/build-harness/issue | |
|
||
### Developing | ||
|
||
If you are interested in being a contributor and want to get involved in developing the `build-harness`, we would love to hear from you! Shoot us an [email](mailto:[email protected]). | ||
If you are interested in being a contributor and want to get involved in developing `build-harness`, we would love to hear from you! Shoot us an [email](mailto:[email protected]). | ||
|
||
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. | ||
|
||
|
@@ -107,13 +114,16 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. | |
|
||
Here's how to get started... | ||
|
||
1. `git clone https://github.com/cloudposse/build-harness.git` to pull down the repository | ||
1. `git clone https://github.com/cloudposse/build-harness.git` to pull down the repository | ||
2. `make init` to initialize the [`build-harness`](https://github.com/cloudposse/build-harness/) | ||
3. Review the [documentation](docs/) on compiling | ||
|
||
|
||
## License | ||
|
||
[APACHE 2.0](LICENSE) © 2016-2017 [Cloud Posse, LLC](https://cloudposse.com) | ||
[APACHE 2.0](LICENSE) © 2017 [Cloud Posse, LLC](https://cloudposse.com) | ||
|
||
See [LICENSE](LICENSE) for full details. | ||
|
||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
|
@@ -122,7 +132,7 @@ Here's how to get started... | |
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
|
@@ -131,28 +141,41 @@ Here's how to get started... | |
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
## About | ||
|
||
GitHub Authorized Keys is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <[email protected]> | ||
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <[email protected]> | ||
|
||
We love [Open Source Software](https://github.com/cloudposse/)! | ||
We love [Open Source Software](https://github.com/cloudposse/)! | ||
|
||
See [our other projects][community] or [hire us][hire] to help build your next cloud-platform. | ||
See [our other projects][community] | ||
or [hire us][hire] to help build your next cloud-platform. | ||
|
||
[website]: http://cloudposse.com/ | ||
[community]: https://github.com/cloudposse/ | ||
[hire]: http://cloudposse.com/contact/ | ||
|
||
### Contributors | ||
|
||
|[![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] |[![Igor Rodionov][igor_img]][igor_web]<br/>[Igor Rodionov][igor_img] | | ||
|---|---| | ||
|
||
[andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[andriy_web]: https://github.com/aknysh/ | ||
|
||
[erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144 | ||
[erik_web]: https://github.com/osterman/ | ||
|
||
[igor_img]: http://s.gravatar.com/avatar/bc70834d32ed4517568a1feb0b9be7e2?s=144 | ||
[igor_web]: https://github.com/goruha/ | ||
|
||
| [![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] | [![Igor Rodionov][igor_img]][igor_web]<br/>[Igor Rodionov][igor_web] | | ||
|-------------------------------------------------------|------------------------------------------------------------------| | ||
[konstantin_img]: https://avatars1.githubusercontent.com/u/11299538?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[konstantin_web]: https://github.com/comeanother/ | ||
|
||
[erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144 | ||
[erik_web]: https://github.com/osterman/ | ||
[igor_img]: http://s.gravatar.com/avatar/bc70834d32ed4517568a1feb0b9be7e2?s=144 | ||
[igor_web]: https://github.com/goruha/ | ||
[sergey_img]: https://avatars1.githubusercontent.com/u/1134449?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[sergey_web]: https://github.com/s2504s/ | ||
|
||
[valeriy_img]: https://avatars1.githubusercontent.com/u/10601658?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[valeriy_web]: https://github.com/drama17/ | ||
|
||
[vladimir_img]: https://avatars1.githubusercontent.com/u/26582191?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 | ||
[vladimir_web]: https://github.com/SweetOps/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
|
||
define make-docs-provide | ||
--datasource make=file:///$(TEMPLATES)/make.yml | ||
endef | ||
|
||
define make_data-docs-provide | ||
--datasource make_data=file:///tmp/make_data.yml | ||
endef | ||
|
||
define make-docs-prepare-data | ||
$(shell echo "---" > /tmp/make_data.$(TIMESTAMP).yml) | ||
$(shell echo " help: |" >> /tmp/make_data.yml) | ||
$(shell make -s help | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | sed -e 's/^/ /' >> /tmp/make_data.yml) | ||
endef | ||
|
||
define make-docs-cleanup-data | ||
$(shell rm -rf /tmp/make_data.yml) | ||
endef |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
GOMPLATE_VERSION ?= v2.2.0 | ||
GOMPLATE_REPO ?= hairyhenderson/gomplate | ||
GOMPLATE ?= gomplate | ||
|
||
TEMPLATES ?= $(BUILD_HARNESS_PATH)/templates/readme | ||
|
||
INCLUDED_MODULES ?= "repo" | ||
|
||
.PHONY : readme\:toc-update | ||
## Update table of contents in README.md | ||
readme\:toc-update: | ||
@doctoc --notitle --github README.md | ||
|
||
## Install dependencies | ||
readme\:deps: | ||
@make github:download-public-release \ | ||
REPO=$(GOMPLATE_REPO) \ | ||
FILE=$(GOMPLATE)_$(OS)-amd64 \ | ||
VERSION=$(GOMPLATE_VERSION) \ | ||
OUTPUT=/usr/local/bin/$(GOMPLATE) > /dev/null | ||
@chmod +x /usr/local/bin/$(GOMPLATE) | ||
|
||
.PHONY : readme\:init | ||
## Create basic minimalistic .README.md template file | ||
readme\:init: | ||
@if [ -s ./.README.md ]; then \ | ||
echo ".README.md already exists!"; \ | ||
else \ | ||
cp $(BUILD_HARNESS_PATH)/templates/README.md ./.README.md ; \ | ||
echo ".README.md created!"; \ | ||
fi; | ||
|
||
.PHONY : readme\:build | ||
## Create README.md by building it from .README.md file | ||
readme\:build: | ||
$(eval IN=./.README.md) | ||
$(eval OUT=./README.md) | ||
|
||
## We support only 10 levels on inheritance templates | ||
$(foreach module, 1 2 3 4 5 6 7 8 9 10, \ | ||
$(eval MODULES=) \ | ||
$(call modules,MODULES) \ | ||
$(call modules-merge,INCLUDED_MODULES,$(INCLUDED_MODULES),$(MODULES)) \ | ||
$(foreach module, $(MODULES), $(call $(module)-docs-prepare-data)) \ | ||
$(shell $(GOMPLATE) --file $(IN) --out $(OUT) $(foreach module, $(INCLUDED_MODULES), $(call $(module)-docs-provide))) \ | ||
$(eval IN=./README.md) \ | ||
) | ||
|
||
$(foreach module, \ | ||
$(INCLUDED_MODULES), \ | ||
$(call $(module)-docs-cleanup-data) \ | ||
) | ||
@echo "README.md generated" | ||
|
||
|
||
# Get template docs modules from $(IN) file ( .README.md / README.md ) | ||
define modules | ||
$(eval MODULES=$$(shell grep -oP "(?<=datasource)\s+\".*?\"" $(IN) | sed 's/[ |\"]//g' | sort | uniq | paste -sd " " - )) | ||
endef | ||
|
||
# Merge 2 lists (in format words separated be space in string) | ||
define modules-merge | ||
$(eval $(1)=$$(shell echo "$(2) $(3)" | tr ' ' '\n' | sort | uniq | paste -sd " " - )) | ||
endef | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
define contributor-docs-provide | ||
--datasource contributor=file:///$(TEMPLATES)/contributor.yml | ||
endef |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
define license-docs-provide | ||
--datasource license=file:///$(TEMPLATES)/license.yml | ||
endef |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
define repo-docs-provide | ||
--datasource repo=file:///$(TEMPLATES)/repo.yml | ||
endef | ||
|
||
define repo_data-docs-provide | ||
--datasource repo_data=file:///tmp/repo_data.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like the reliance on |
||
endef | ||
|
||
define repo-docs-prepare-data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what this does |
||
$(shell echo "---" > /tmp/repo_data.yml) | ||
$(shell git ls-remote --get-url | xargs -I{} echo "url: {}" >> /tmp/repo_data.yml) | ||
$(shell git ls-remote --get-url | grep -oP "(?<=\/).*(?=.git)" | xargs -I{} echo "name: {}" >> /tmp/repo_data.yml) | ||
endef | ||
|
||
define repo-docs-cleanup-data | ||
$(shell rm -rf /tmp/repo_data.yml) | ||
endef | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
define section-docs-provide | ||
--datasource section=file:///$(TEMPLATES)/section.yml | ||
endef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done