Skip to content
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

Implement new readme generator #61

Merged
merged 40 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5c8a14c
Implement new readme generator
osterman Jun 14, 2018
627412f
add a lint method
osterman Jun 14, 2018
2c97a33
clean up target
osterman Jun 14, 2018
dd27787
fix contributors
osterman Jun 14, 2018
180128d
fix branch icon
osterman Jun 14, 2018
3ed9165
Update readme
osterman Jun 14, 2018
5a702d4
update descriptions
osterman Jun 14, 2018
03179a8
Generalize includes
osterman Jun 14, 2018
42d6baf
Annotate README.md
osterman Jun 14, 2018
c7b28b8
install readme deps
osterman Jun 14, 2018
8f08b02
use tmp
osterman Jun 14, 2018
01127e1
update packages version
osterman Jun 15, 2018
352b9aa
silently run make
osterman Jun 15, 2018
da2c2ba
Add additional information
osterman Jun 15, 2018
56034fe
Update sentence
osterman Jun 15, 2018
d161d6b
Update language
osterman Jun 15, 2018
306ef35
update readme
osterman Jun 15, 2018
02e8d65
Add release
osterman Jun 15, 2018
c621210
Disable readme/lint
osterman Jun 15, 2018
03a0c08
Update readme
osterman Jun 15, 2018
8df1aaf
call it sweetops
osterman Jun 15, 2018
55e0391
call it sweetops
osterman Jun 15, 2018
bffd6a5
dynamically calculate year
osterman Jun 15, 2018
94bff78
fix spelling
osterman Jun 15, 2018
42136c6
remove paren
osterman Jun 15, 2018
7d74d30
add support for related section
osterman Jun 15, 2018
e48f18a
add support for related section
osterman Jun 15, 2018
bb044be
Add license badge
osterman Jun 15, 2018
aa5c2c0
license
osterman Jun 15, 2018
e864f82
license
osterman Jun 15, 2018
6d8af3b
license
osterman Jun 15, 2018
58585c3
add more branding
osterman Jun 15, 2018
6a132d0
add more branding
osterman Jun 15, 2018
3b30f8a
add more branding
osterman Jun 15, 2018
40001e9
add more branding
osterman Jun 15, 2018
9b38b45
add logo
osterman Jun 15, 2018
eed9dbe
drop logo
osterman Jun 15, 2018
53a7067
Add support for terraform-docs
osterman Jun 15, 2018
4c032d6
fix readme
osterman Jun 15, 2018
5ac7e27
fix typo
osterman Jun 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ install:
- make docker/login
- make go/deps-build
- make go/deps-dev
- make readme/deps

script:
- make bash/lint
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export SELF ?= make
export PATH := $(BUILD_HARNESS_PATH)/vendor:$(PATH)
export DOCKER_BUILD_FLAGS ?=

# List of targets the `readme` target should call before generating the readme
export README_DEPS ?= docs/targets.md

# Import Makefiles into current context
include $(BUILD_HARNESS_PATH)/Makefile.*
include $(BUILD_HARNESS_PATH)/modules/*/bootstrap.Makefile*
Expand All @@ -13,3 +16,14 @@ ifndef TRANSLATE_COLON_NOTATION
%:
@$(SELF) $(subst :,/,$@) TRANSLATE_COLON_NOTATION=false
endif


.PHONY : docs/targets.md
## Update `docs/targets.md` from `make help`
docs/targets.md:
@( \
echo "## Makefile Targets"; \
echo '```'; \
$(SELF) --no-print-directory --quiet --silent help | sed $$'s,\x1b\\[[0-9;]*[a-zA-Z],,g'; \
echo '```'; \
) > $@
260 changes: 150 additions & 110 deletions README.md

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
#
# This is the configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#

# Name of this project
name: Build Harness

# License of this project
license: "APACHE2"

# Cannonical GitHub repo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canonical

github_repo: cloudposse/build-harness

# Badges to display
badges:
- name: "Build Status"
image: "https://travis-ci.org/cloudposse/build-harness.svg?branch=master"
href: "https://travis-ci.org/cloudposse/build-harness"
- name: "Latest Release"
image: "https://img.shields.io/github/release/cloudposse/build-harness.svg"
href: "https://github.com/cloudposse/build-harness/releases"
- name: "Slack Community"
image: "https://slack.cloudposse.com/badge.svg"
href: "https://slack.cloudposse.com"

# Short description of this project
description: |-
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.

# How to use this project
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

# Example usage
examples: |-
Here are some 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

# How to get started quickly
quickstart: |-
Here's how to get started...

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/)

# Other files to include in this README from the project folder
include:
- "docs/targets.md"

# Contributors to this project
contributors:
- name: "Erik Osterman"
homepage: "https://github.com/osterman"
avatar: "http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144"
github: "osterman"
- name: "Igor Rodionov"
homepage: "https://github.com/goruha/"
avatar: "http://s.gravatar.com/avatar/bc70834d32ed4517568a1feb0b9be7e2?s=144"
github: "goruha"
- name: "Andriy Knysh"
homepage: "https://github.com/aknysh/"
avatar: "https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "aknysh"
- name: "Konstantin"
homepage: "https://github.com/comeanother/"
avatar: "https://avatars1.githubusercontent.com/u/11299538?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "comeanother"
- name: "Sergey"
homepage: "https://github.com/s2504s/"
avatar: "https://avatars1.githubusercontent.com/u/1134449?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "s2504s"
- name: "Valeriy"
homepage: "https://github.com/drama17/"
avatar: "https://avatars1.githubusercontent.com/u/10601658?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "drama17"
- name: "Vladimir"
homepage: "https://github.com/SweetOps/"
avatar: "https://avatars1.githubusercontent.com/u/26582191?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144"
github: "SweetOps"
76 changes: 76 additions & 0 deletions docs/targets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## Makefile Targets
```
Available targets:

aws/install Install aws cli bundle
bash/lint Lint all bash scripts
chamber/install Install chamber
codefresh/trigger/webhook Trigger a CodeFresh WebHook
docker/build Build docker image
docker/login Login into docker hub
docs/copyright-add Add copyright headers to source code
geodesic/deploy Run a Jenkins Job to Deploy $(APP) with $(CANONICAL_TAG)
git/aliases-update Update git aliases
git/export Export git vars
git/show Show vars
git/submodules-update Update submodules
github/download-private-release Download release from github
github/download-public-release Download release from github
go/build Build binary
go/build-all Build binary for all platforms
go/clean Clean compiled binary
go/clean-all Clean compiled binary and dependency
go/deps Install dependencies
go/deps-build Install dependencies for build
go/deps-dev Install development dependencies
go/fmt Format code according to Golang convention
go/install Install cli
go/lint Lint code
go/test Run tests
go/vet Vet code
helm/chart/build Build chart $CHART_NAME from $CHART_TPL
helm/chart/build-all Build chart $CHART_NAME from $CHART_TPL for all available $SEMVERSIONS
helm/chart/clean Clean chart packages
helm/chart/create Create chart $CHART from starter scaffold
helm/chart/publish Publish chart $CHART_NAME to $REPO_GATEWAY_ENDPOINT
helm/chart/starter/fetch Fetch starter
helm/chart/starter/remove Remove starter
helm/chart/starter/update Update starter
helm/delete/namespace Delete all releases in a namespace as well as the namespace
helm/install Install helm
helm/repo/add Add $REPO_NAME from $REPO_ENDPOINT
helm/repo/add-current Add helm remote dev repos
helm/repo/add-remote Add helm remote repos
helm/repo/build Build repo
helm/repo/clean Clean helm repo
helm/repo/fix-perms Fix repo filesystem permissions
helm/repo/info Show repo info
helm/repo/lint Lint charts
helm/repo/update Update repo info
helm/serve/index Build index for serve helm charts
helm/toolbox/upsert Install or upgrade helm tiller
helmfile/install Install helmfile
help This help screen
jenkins/run-job-with-tag Run a Jenkins Job with $(TAG)
make/lint Lint all makefiles
packages/install Install packages
packages/install/% Install package (e.g. helm, helmfile, kubectl)
packages/uninstall/% Uninstall package (e.g. helm, helmfile, kubectl)
readme Alias for readme/build
readme/build Create README.md by building it from README.yaml
readme/init Create basic minimalistic .README.md template file
readme/lint Verify the `README.md` is up to date
semver/export Export semver vars
semver/show Show
stages/export Export stages vars
template/build Create $OUT file by building it from $IN template file
template/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

```
2 changes: 1 addition & 1 deletion modules/packages/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export INSTALL_PATH ?= $(BUILD_HARNESS_PATH)/vendor
export PACKAGES_VERSION ?= 0.1.7
export PACKAGES_VERSION ?= 0.1.8
export PACKAGES_PATH ?= $(BUILD_HARNESS_PATH)/vendor/packages

## Install packages
Expand Down
35 changes: 24 additions & 11 deletions modules/readme/Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
export README_LINT ?= $(TMP)/README.md
export README_FILE ?= README.md
export README_TEMPLATE_FILE ?= .$(README_FILE)
export README_YAML ?= README.yaml
export README_TEMPLATE_FILE ?= $(BUILD_HARNESS_PATH)/templates/README.md
export README_TEMPLATE_YAML ?= $(BUILD_HARNESS_PATH)/templates/README.yaml

## Alias for readme/build
readme: readme/build
@exit 0

## Update table of contents in README.md
readme/toc-update:
@doctoc --notitle --github $(README_FILE)
readme/deps: packages/install/gomplate
@exit 0

## Create basic minimalistic .README.md template file
readme/init:
@if [ -s ./$(README_TEMPLATE_FILE) ]; then \
echo "$(README_TEMPLATE_FILE) already exists!"; \
@if [ -f $(README_YAML) ]; then \
echo "$(README_YAML) already exists!"; \
else \
cp $(BUILD_HARNESS_PATH)/templates/$(README_TEMPLATE_FILE) ./$(README_TEMPLATE_FILE) ; \
echo "$(README_TEMPLATE_FILE) created!"; \
cp $(README_TEMPLATE_YAML) $(README_YAML) ; \
echo "$(README_YAML) created!"; \
fi;

## Create README.md by building it from .README.md file
readme/build:
@$(SELF) -s template/build IN=$(README_TEMPLATE_FILE) OUT=$(README_FILE)
## Verify the `README.md` is up to date
readme/lint:
@$(SELF) readme/build README_FILE=$(README_LINT) >/dev/null
@diff -ruN $(README_LINT) $(README_FILE)
@rm -f $(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) \
--datasource includes='file://$(shell pwd)/?type=text/plain'
@echo "Generated $(README_FILE) from $(README_TEMPLATE_FILE) using data from $(README_TEMPLATE_YAML)"
2 changes: 1 addition & 1 deletion modules/template/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export GOMPLATE ?= $(BUILD_HARNESS_PATH)/vendor/gomplate
GOMPLATE_VERSION ?= v2.2.0
GOMPLATE_VERSION ?= v2.6.0
GOMPLATE_REPO ?= hairyhenderson/gomplate

## Install dependencies
Expand Down
Loading