Skip to content

Instantly share code, notes, and snippets.

@GeopJr
Last active April 17, 2023 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeopJr/8c00a73e0c2ecdb5caa88cc43ccc82e0 to your computer and use it in GitHub Desktop.
Save GeopJr/8c00a73e0c2ecdb5caa88cc43ccc82e0 to your computer and use it in GitHub Desktop.
Makefile + shard features example

Makefile to build a shard.yml file by merging others using yq:

  • make shards => base
  • make shards web=1 => with kemal
  • make shards database=1 => with mysql
  • make shards web=1 database=1 => with both
name: test
version: 0.1.0
authors:
- Evangelos Paterakis <evan@geopjr.dev>
targets:
test:
main: src/test.cr
crystal: 1.8.0
license: MIT
dependencies:
mysql:
github: crystal-lang/crystal-mysql
dependencies:
kemal:
github: kemalcr/kemal
web ?= 0
database ?= 0
shards:
cp base.yaml shard.yml
ifeq ($(web), 1)
yq -i '. *= load("features.web.yaml")' shard.yml
endif
ifeq ($(database), 1)
yq -i '. *= load("features.database.yaml")' shard.yml
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment