diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:32:15 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 12:32:15 -0300 |
| commit | 36a0ddb01a4fcb8fb2fefd7c407ecca0e3e56e7c (patch) | |
| tree | bfd0a067edb5e802725bab48ebc7a0a09838feb1 /Makefile | |
| download | ruby-36a0ddb01a4fcb8fb2fefd7c407ecca0e3e56e7c.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1f9fc17 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# Development tasks. Everything runs through the Ruby that is on PATH — the +# library and its test suite have no dependencies beyond the standard library, +# so there is nothing to install first. +# +# make list the targets +# make test run the suite with minitest +# make lint syntax and warning checks, no files touched +# make build build the gem into pkg/ + +RUBY ?= ruby +GEM ?= gem + +SOURCES = $(shell find lib test -name '*.rb') cepis.gemspec +TESTS = $(shell find test -name '*_test.rb') +VERSION = $(shell $(RUBY) -Ilib -e 'require "cepis/version"; print Cepis::VERSION') + +.DEFAULT_GOAL := help +.PHONY: help test lint format build check clean + +help: + @echo 'Targets:' + @echo ' test run the test suite' + @echo ' lint ruby -w -c over the tree, plus rubocop when installed' + @echo ' format apply rubocop -A, when installed (writes)' + @echo ' build build the gem into pkg/' + @echo ' check lint + test + build, in that order' + @echo ' clean remove build artefacts' + +test: + @set -e; for f in $(TESTS); do $(RUBY) -Ilib -Itest $$f; done + +# Read-only by design, so it is safe in CI and in a pre-commit hook. Ruby has +# no formatter or linter in the standard library; rubocop is not a dependency +# of this gem, so it is used only when it happens to be installed. +lint: + @set -e; for f in $(SOURCES); do $(RUBY) -w -c $$f >/dev/null; done + @echo 'syntax OK: $(words $(SOURCES)) files' + $(RUBY) -w -Ilib -e 'require "cepis"' + @if command -v rubocop >/dev/null 2>&1; then rubocop; else \ + echo 'rubocop not installed: syntax and warning checks only'; fi + +format: + @if command -v rubocop >/dev/null 2>&1; then rubocop -A; else \ + echo 'rubocop not installed: nothing to format with'; fi + +build: + @mkdir -p pkg + $(GEM) build cepis.gemspec --output pkg/cepis-$(VERSION).gem + +# The order matters: lint is the fastest to fail, build the slowest, so a +# broken run reports the cheapest problem first. +check: lint test build + +clean: + rm -rf pkg doc .yardoc |