From 51f01d36cfd3c538299cfcea637edd90f0959c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Sat, 4 Apr 2020 16:00:11 +0200 Subject: [PATCH 1/5] Add lib to Makefile --- Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0d0b989a..a1a19614 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ all: bin/shards clean: phony rm -f bin/shards -bin/shards: $(SOURCES) $(TEMPLATES) +bin/shards: $(SOURCES) $(TEMPLATES) lib @mkdir -p bin $(CRYSTAL) build src/shards.cr -o bin/shards $(CRFLAGS) @@ -35,10 +35,16 @@ uninstall: phony test: test_unit test_integration -test_unit: phony - $(CRYSTAL) spec ./spec/unit/*_spec.cr +test_unit: phony lib + $(CRYSTAL) spec ./spec/unit/ test_integration: bin/shards phony - $(CRYSTAL) spec ./spec/integration/*_spec.cr + $(CRYSTAL) spec ./spec/integration/ + +lib: shard.lock + shards install + +shard.lock: shard.yml + shards update phony: From 1842dbd6941f97fecfba096df2acb4d224de77e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Sat, 4 Apr 2020 16:06:11 +0200 Subject: [PATCH 2/5] Format only src and spec tmp/integrations is created by integration specs and contains non-formatted files --- .circleci/config.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c626feea..f0748752 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ commands: - crystal/shards-install - run: make - run: make test - - crystal/format-check + - run: crystal tool format --check src spec with-brew-cache: parameters: diff --git a/.travis.yml b/.travis.yml index 7962e2e2..45f5a148 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ before_script: | script: - make test - - crystal tool format --check + - crystal tool format --check src spec From 8ae832a6c276d8867bbdae87c2dc367e648bc116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 7 Apr 2020 11:51:38 +0200 Subject: [PATCH 3/5] Add SHARDS variable --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a1a19614..262cc71f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .POSIX: CRYSTAL = crystal +SHARDS = shards CRFLAGS = SHARDS_SOURCES = $(shell find src -name '*.cr') MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr') @@ -42,9 +43,9 @@ test_integration: bin/shards phony $(CRYSTAL) spec ./spec/integration/ lib: shard.lock - shards install + $(SHARDS) install shard.lock: shard.yml - shards update + $(SHARDS) update phony: From 1630c095f0389555a405cf7cd4e71fdce01af7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 7 Apr 2020 12:03:04 +0200 Subject: [PATCH 4/5] Add boostrap recipe for installing molinillo without shards --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 262cc71f..8fdca76c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CRYSTAL = crystal SHARDS = shards CRFLAGS = SHARDS_SOURCES = $(shell find src -name '*.cr') -MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr') +MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr' 2> /dev/null) SOURCES = $(SHARDS_SOURCES) $(MOLINILLO_SOURCES) TEMPLATES = src/templates/*.ecr @@ -14,6 +14,9 @@ BINDIR = $(DESTDIR)$(PREFIX)/bin MANDIR = $(DESTDIR)$(PREFIX)/share/man INSTALL = /usr/bin/install +MOLINILLO_VERSION = $(shell $(CRYSTAL) eval 'require "yaml"; puts YAML.parse(File.read("shard.lock"))["shards"]["molinillo"]["version"]') +MOLINILLO_URL = "https://github.com/crystal-lang/crystal-molinillo/archive/v$(MOLINILLO_VERSION).tar.gz" + all: bin/shards clean: phony @@ -43,7 +46,8 @@ test_integration: bin/shards phony $(CRYSTAL) spec ./spec/integration/ lib: shard.lock - $(SHARDS) install + mkdir -p lib/molinillo + $(SHARDS) install || (curl -L $(MOLINILLO_URL) | tar -xzf - -C lib/molinillo --strip-components=1) shard.lock: shard.yml $(SHARDS) update From b195b56f6401c42e550159dc0a655236ee4770a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 7 Apr 2020 12:03:47 +0200 Subject: [PATCH 5/5] Remove CRFLAGS in favour of default CRYSTAL_OPTS --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8fdca76c..43ff8670 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ CRYSTAL = crystal SHARDS = shards -CRFLAGS = SHARDS_SOURCES = $(shell find src -name '*.cr') MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr' 2> /dev/null) SOURCES = $(SHARDS_SOURCES) $(MOLINILLO_SOURCES) @@ -24,7 +23,7 @@ clean: phony bin/shards: $(SOURCES) $(TEMPLATES) lib @mkdir -p bin - $(CRYSTAL) build src/shards.cr -o bin/shards $(CRFLAGS) + $(CRYSTAL) build src/shards.cr -o bin/shards install: bin/shards phony $(INSTALL) -m 0755 -d "$(BINDIR)" "$(MANDIR)/man1" "$(MANDIR)/man5"