diff --git a/.README.md b/.README.md deleted file mode 100644 index 45439059..00000000 --- a/.README.md +++ /dev/null @@ -1,58 +0,0 @@ -# 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. - -**NOTE:** the `/` is interchangable with the `:` in target names - -{{ (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 "git").name }}.git` to pull down the repository -2. `make init` to initialize the [`{{ (datasource "git").name }}`](https://github.com/cloudposse/{{ (datasource "git").name }}/) -3. Review the [documentation](docs/) on compiling - - -{{ (datasource "license").apache2 }} -{{ (datasource "section").about }} - -### Contributors - -| -{{- (datasource "contributor").erik }} | -{{- (datasource "contributor").igor }} | -{{- (datasource "contributor").andriy }} | -|---|---|---| - -{{ (datasource "contributor")._links }} diff --git a/Makefile b/Makefile index f06f14b2..a31472b4 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,11 @@ export SELF ?= make export PATH := $(BUILD_HARNESS_PATH)/vendor:$(PATH) export DOCKER_BUILD_FLAGS ?= +ifeq ($(CURDIR),$(realpath $(BUILD_HARNESS_PATH))) # List of targets the `readme` target should call before generating the readme export README_DEPS ?= docs/targets.md +export DEFAULT_HELP_TARGET = help/all +endif # Import Makefiles into current context include $(BUILD_HARNESS_PATH)/Makefile.* diff --git a/Makefile.helpers b/Makefile.helpers index 1ad46e94..6945bd3c 100644 --- a/Makefile.helpers +++ b/Makefile.helpers @@ -6,6 +6,8 @@ EDITOR ?= vim SHELL = /bin/bash +DEFAULT_HELP_TARGET ?= help + green = $(shell echo -e '\x1b[32;01m$1\x1b[0m') yellow = $(shell echo -e '\x1b[33;01m$1\x1b[0m') red = $(shell echo -e '\x1b[33;31m$1\x1b[0m') @@ -21,12 +23,20 @@ define assert-unset @[ -z "$($1)" ] || (echo "$(1) should not be defined in $(@)"; exit 1) endef -default:: help +default:: $(DEFAULT_HELP_TARGET) @exit 0 .PHONY : help ## This help screen help: + @$(SELF) help/generate MAKEFILE_LIST="Makefile $(BUILD_HARNESS_PATH)/Makefile.helpers" + +## Display help for all targets +help/all: + @$(SELF) help/generate MAKEFILE_LIST="$(MAKEFILE_LIST)" + +# Generate help output from MAKEFILE_LIST +help/generate: @printf "Available targets:\n\n" @awk '/^[a-zA-Z\-\_0-9%:\\\/]+:/ { \ helpMessage = match(lastLine, /^## (.*)/); \ diff --git a/README.md b/README.md index b3f1d2e2..4775357c 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,16 @@ 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.This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. +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). +--- + +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. + + +It's 100% Open Source and licensed under the [APACHE2](LICENSE). + @@ -27,7 +33,9 @@ This automatically exposes many new targets that you can leverage throughout you Run `make help` for a list of available targets. -**NOTE:** the `/` is interchangable with the `:` in target names## Quick Start +**NOTE:** the `/` is interchangable with the `:` in target names + +## Quick Start Here's how to get started... @@ -98,6 +106,7 @@ Available targets: helm/toolbox/upsert Install or upgrade helm tiller helmfile/install Install helmfile help This help screen + help/all Display help for all targets jenkins/run-job-with-tag Run a Jenkins Job with $(TAG) make/lint Lint all makefiles packages/delete Delete packages @@ -178,13 +187,15 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. **NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! +## Copyright + +Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) + ## License [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) - See [LICENSE](LICENSE) for full details. Licensed to the Apache Software Foundation (ASF) under one @@ -205,6 +216,10 @@ See [LICENSE](LICENSE) for full details. under the License. +## Trademarks + +All other trademarks referenced herein are the property of their respective owners. + ## About This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at diff --git a/docs/targets.md b/docs/targets.md index f27a60f9..365f6f8a 100644 --- a/docs/targets.md +++ b/docs/targets.md @@ -51,6 +51,7 @@ Available targets: helm/toolbox/upsert Install or upgrade helm tiller helmfile/install Install helmfile help This help screen + help/all Display help for all targets jenkins/run-job-with-tag Run a Jenkins Job with $(TAG) make/lint Lint all makefiles packages/delete Delete packages diff --git a/modules/docs/Makefile b/modules/docs/Makefile index ac8cd972..d2477bac 100644 --- a/modules/docs/Makefile +++ b/modules/docs/Makefile @@ -1,14 +1,18 @@ +.PHONY : docs +docs/deps:: + @mkdir -p docs + .PHONY : docs/targets.md ## Update `docs/targets.md` from `make help` -docs/targets.md: +docs/targets.md: docs/deps @( \ echo "## Makefile Targets"; \ echo '```'; \ - $(SELF) --no-print-directory --quiet --silent help | sed $$'s,\x1b\\[[0-9;]*[a-zA-Z],,g'; \ + $(SELF) --no-print-directory --quiet --silent $(DEFAULT_HELP_TARGET) | sed $$'s,\x1b\\[[0-9;]*[a-zA-Z],,g'; \ echo '```'; \ ) > $@ .PHONY : docs/terraform.md ## Update `docs/terraform.md` from `terraform-docs` -docs/terraform.md: packages/install/terraform-docs +docs/terraform.md: docs/deps packages/install/terraform-docs @terraform-docs md . > $@ diff --git a/modules/readme/Makefile b/modules/readme/Makefile index adc84c32..2b95e86d 100644 --- a/modules/readme/Makefile +++ b/modules/readme/Makefile @@ -28,7 +28,6 @@ readme/lint: ## Create README.md by building it from README.yaml readme/build: $(README_DEPS) - @mkdir -p docs @gomplate --file $(README_TEMPLATE_FILE) \ --out $(README_FILE) \ --datasource config=$(README_YAML) \ diff --git a/templates/README.md b/templates/README.md index 478d4ecf..da8cc5df 100644 --- a/templates/README.md +++ b/templates/README.md @@ -10,12 +10,19 @@ {{ if has (ds "config") "description" }} {{(ds "config").description }} -{{- end -}} +{{ end }} + +--- This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. {{ if eq (ds "config").license "APACHE2" }} -It's 100% Open Source and licensed under [APACHE2](LICENSE). +It's 100% Open Source and licensed under the [APACHE2](LICENSE). +{{ end }} +{{ if eq (ds "config").license "CC-BY-NC-SA-4.0" }} +It's 100% Open Source and licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](LICENSE). + + {{ end }} {{ if has (ds "config") "usage" }} @@ -24,7 +31,7 @@ It's 100% Open Source and licensed under [APACHE2](LICENSE). {{ (ds "config").usage -}} {{ end }} -{{- if has (ds "config") "quickstart" -}} +{{ if has (ds "config") "quickstart" -}} ## Quick Start {{ (ds "config").quickstart -}} @@ -94,13 +101,15 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. **NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! +## Copyright + +Copyright © 2017-{{ time.Now.Year }} [Cloud Posse, LLC](https://cloudposse.com) + {{ if eq (ds "config").license "APACHE2" }} ## License [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -Copyright © 2017-{{ time.Now.Year }} [Cloud Posse, LLC](https://cloudposse.com) - See [LICENSE](LICENSE) for full details. Licensed to the Apache Software Foundation (ASF) under one @@ -120,6 +129,30 @@ See [LICENSE](LICENSE) for full details. specific language governing permissions and limitations under the License. {{ end }} +{{ if eq (ds "config").license "CC-BY-NC-SA-4.0" }} +## License + +[![License](https://img.shields.io/badge/License-CC%20BY%20NC%20SA%204.0-blue.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/) + + + +This material may only be distributed subject to the terms and conditions set forth in the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License or later with the restrictions noted below (the latest version of the license is presently available at ). + +**Attribution** You must attribute the work in the manner specified by the author or licensor. + +**Noncommercial** The licensor permits others to copy, distribute and transmit the work. In return, licensees may not use the work for commercial purposes — unless they get the licensor's permission. + +**Share Alike** The licensor permits others to distribute derivative works only under the same license or one compatible with the one that governs the licensor's work. + +## Distribution + +Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. + +Distribution of the work or derivative of the work in any standard (paper) book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder. +{{ end }} +## Trademarks + +All other trademarks referenced herein are the property of their respective owners. ## About