Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (48 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
55 lines (48 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PHONY: help build test publish clean all
GEM_NAME = boring_services
GEMSPEC = $(GEM_NAME).gemspec
GEM_FILE = $(shell ls -t $(GEM_NAME)-*.gem 2>/dev/null | head -n1)
help:
@echo "$(GEM_NAME) Release Makefile"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " build - Build the gem"
@echo " test - Test gem specification"
@echo " publish - Publish gem to RubyGems.org (interactive)"
@echo " clean - Remove built gem files"
@echo " all - Build, test, and publish (interactive)"
@echo ""
build:
@echo "Building $(GEM_NAME)..."
@rm -f $(GEM_NAME)-*.gem
@gem build $(GEMSPEC)
@echo "✓ Built $(GEM_NAME) successfully"
test:
@echo "Testing $(GEM_NAME) specification..."
@if [ -z "$(GEM_FILE)" ]; then \
echo "✗ No gem file found. Run 'make build' first."; \
exit 1; \
fi
@gem specification $(GEM_FILE) > /dev/null
@echo "✓ Gem specification is valid"
publish:
@echo "Publishing $(GEM_NAME)..."
@if [ -z "$(GEM_FILE)" ]; then \
echo "✗ No gem file found. Run 'make build' first."; \
exit 1; \
fi
@echo "About to push $(GEM_FILE) to RubyGems.org"
@echo -n "Continue? [y/N] " && read ans && [ $${ans:-N} = y ]
@gem push $(GEM_FILE)
@echo "✓ Published $(GEM_NAME) successfully"
clean:
@echo "Cleaning build artifacts..."
@rm -f $(GEM_NAME)-*.gem
@echo "✓ Cleaned $(GEM_NAME)"
all: build test
@echo ""
@echo "Build and tests passed. Ready to publish?"
@echo -n "Publish to RubyGems.org? [y/N] " && read ans && [ $${ans:-N} = y ]
@$(MAKE) publish