From ef5d1fcb3fb1253d9316f92e4f9383146b316f08 Mon Sep 17 00:00:00 2001 From: flemay Date: Sat, 4 Aug 2018 11:02:38 +1000 Subject: [PATCH] init --- .gitignore | 1 + .travis.yml | 7 ++++ CODEOWNERS | 1 + LICENSE | 21 ++++++++++++ Makefile | 18 +++++++++++ README.md | 22 +++++++++++++ cookiecutter.json | 4 +++ docker-compose.yml | 8 +++++ {{cookiecutter.git_repo_name}}/.env.example | 1 + {{cookiecutter.git_repo_name}}/.env.template | 1 + {{cookiecutter.git_repo_name}}/.gitignore | 3 ++ {{cookiecutter.git_repo_name}}/Makefile | 32 +++++++++++++++++++ {{cookiecutter.git_repo_name}}/README.md | 13 ++++++++ .../docker-compose.yml | 9 ++++++ 14 files changed, 141 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CODEOWNERS create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 cookiecutter.json create mode 100644 docker-compose.yml create mode 100644 {{cookiecutter.git_repo_name}}/.env.example create mode 100644 {{cookiecutter.git_repo_name}}/.env.template create mode 100644 {{cookiecutter.git_repo_name}}/.gitignore create mode 100644 {{cookiecutter.git_repo_name}}/Makefile create mode 100644 {{cookiecutter.git_repo_name}}/README.md create mode 100644 {{cookiecutter.git_repo_name}}/docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af6afb1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +musketeers-echo \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7e4cef1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +sudo: required + +services: + - docker + +script: + - make diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..ad2307e --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @flemay diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..00debd8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 @flemay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ede89fb --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +COMPOSE_RUN_COOKIECUTTER = docker-compose run --rm cookiecutter +GIT_REPO_NAME = musketeers-echo + +all: generate test clean +.PHONY: all + +generate: + $(COMPOSE_RUN_COOKIECUTTER) cookiecutter --no-input -f . +.PHONY: generate + +test: + cd $(GIT_REPO_NAME) && make +.PHONY: test + +clean: + $(COMPOSE_RUN_COOKIECUTTER) rm -fr $(GIT_REPO_NAME) + docker-compose down --remove-orphans +.PHONY: clean \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bb66a7 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +[![License](https://img.shields.io/dub/l/vibe-d.svg)](LICENSE) + +# 3 Musketeers - Cookiecutter Echo + +🍪 A very simple [Cookiecutter](https://github.com/audreyr/cookiecutter) template to show the [3 Musketeers](https://github.com/flemay/3musketeers) in action. ⚔️ + +The generated application echos the value of the environment variable `ECHO_MESSAGE`. + +## Usage + +> To generate the example, cloning this repository is **not** necessary. + +```bash +# generate the example (with the default values from cookiecutter.json) using Docker +$ docker run --rm -v $PWD:/opt/app -w /opt/app flemay/cookiecutter https://github.com/3musketeersio/cookiecutter-musketeers-echo --no-input + +# generate the example (choosing interactively the values) using Docker +$ docker run -it --rm -v $PWD:/opt/app -w /opt/app flemay/cookiecutter https://github.com/3musketeersio/cookiecutter-musketeers-echo + +# test this repository: generate, run, and clean locally +$ make +``` diff --git a/cookiecutter.json b/cookiecutter.json new file mode 100644 index 0000000..0ddb1be --- /dev/null +++ b/cookiecutter.json @@ -0,0 +1,4 @@ +{ + "git_repo_name": "musketeers-echo", + "git_username": "flemay" +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..47966ea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.4' +services: + cookiecutter: + image: flemay/cookiecutter + entrypoint: "" + volumes: + - .:/opt/app + working_dir: /opt/app \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/.env.example b/{{cookiecutter.git_repo_name}}/.env.example new file mode 100644 index 0000000..16dae31 --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/.env.example @@ -0,0 +1 @@ +ECHO_MESSAGE={{cookiecutter.git_repo_name}} \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/.env.template b/{{cookiecutter.git_repo_name}}/.env.template new file mode 100644 index 0000000..f0bf32c --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/.env.template @@ -0,0 +1 @@ +ECHO_MESSAGE \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/.gitignore b/{{cookiecutter.git_repo_name}}/.gitignore new file mode 100644 index 0000000..979a895 --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/.gitignore @@ -0,0 +1,3 @@ +.env* +!.env.template +!.env.example \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/Makefile b/{{cookiecutter.git_repo_name}}/Makefile new file mode 100644 index 0000000..ad0e1ea --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/Makefile @@ -0,0 +1,32 @@ +COMPOSE_RUN_MUSKETEERS = docker-compose run --rm musketeers +# ENVFILE is .env.template by default but can be overwritten +ENVFILE ?= .env.template + +all: + ENVFILE=.env.example $(MAKE) envfile echo clean +.PHONY: all + +# envfile creates or overwrites .env with $(ENVFILE) +envfile: + cp -f $(ENVFILE) .env +.PHONY: envfile + +# echo calls the target _echo with the musketeers image +echo: + $(COMPOSE_RUN_MUSKETEERS) make _echo +.PHONY: echo + +# shell allows you to enter a musketeers container +shell: + $(COMPOSE_RUN_MUSKETEERS) sh -l +.PHONY: shell + +# clean the repository and docker environment +clean: + docker-compose down --remove-orphans +.PHONY: clean + +# _echo prints out ECHO_MESSAGE +_echo: + echo $(ECHO_MESSAGE) +.PHONY: _echo \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/README.md b/{{cookiecutter.git_repo_name}}/README.md new file mode 100644 index 0000000..7e3a63e --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/README.md @@ -0,0 +1,13 @@ +# {{cookiecutter.git_repo_name}} + +{{cookiecutter.git_repo_name}} echos the application's name. + +## Prerequisites + +- [Docker](https://docs.docker.com/engine/installation/) +- [Compose](https://docs.docker.com/compose/install/) +- Make + +## Usage + + $ make \ No newline at end of file diff --git a/{{cookiecutter.git_repo_name}}/docker-compose.yml b/{{cookiecutter.git_repo_name}}/docker-compose.yml new file mode 100644 index 0000000..1aaf8f0 --- /dev/null +++ b/{{cookiecutter.git_repo_name}}/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.4' +services: + musketeers: + image: flemay/musketeers + env_file: .env + volumes: + - .:/opt/app + working_dir: /opt/app +