-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (70 loc) · 2.61 KB
/
Makefile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
GEM ?= nicefn
TAG ?= 0.1.1
default: test_examples
# Run tests on all the files in the `exa` folder
all_test_examples:
@bundle exec ruby ./bin/verify before inst
@bundle exec ruby ./bin/verify after inst
@bundle exec ruby ./bin/verify before sing
@bundle exec ruby ./bin/verify after sing
# Add the ./pkg/ Gemfile to the project root
add_root_gemfile:
@cp ./pkg/Gemfile ./
# Remove the Gemfile in the project root
rem_root_gemfile:
@rm -f Gemfile || true
# Remove the Gemfile.lock in the project root
rem_root_gemfile_lock:
@rm -f Gemfile.lock || true
rem_example_gemfile_lock:
@rm -f ./pkg/example_project/Gemfile.lock || true
# Add version from env var to the .gemspec in project root
ver_root_gemspec:
@echo "ver = '$(TAG)'" | cat - ./$(GEM).gemspec > ./__TMP
@mv ./__TMP ./$(GEM).gemspec
# Add the .gemspec to the project root
add_root_gemspec:
@cp ./pkg/$(GEM).gemspec.bak ./$(GEM).gemspec
# Remove the .gemspec from the project root
rem_root_gemspec:
@rm -f nicefn.gemspec || true
test_setup:
# Add the gemfile from ./pkg/ folder to project root
@make add_root_gemfile
# Add the .gemspec from ./pkg/ folder to project root
@make add_root_gemspec
# Uses TAG env for version info at top of .gemspec in project root
@make ver_root_gemspec
# Remove Gemfile and .gemspec in project root and restore ./pkg/ .gemspec
test_teardown:
@make rem_root_gemfile
@make rem_root_gemspec
test_example_project:
# Remove Gemfile and .gemspec in project root (if they exist)
@make test_teardown
# Add the gemfile and .gemspec from ./pkg/ folder to project root
@make test_setup
# Simulate install of gem inside an example project and run it
@cd ./pkg/example_project && bundle install && bundle exec ruby test.rb
# Remove Gemfile.lock created when installing example_project deps
@make rem_example_gemfile_lock
# Remove Gemfile and .gemspec in project root and restore ./pkg/ .gemspec
@make test_teardown
test_examples:
# Add the gemfile and .gemspec from ./pkg/ folder to project root
@make test_setup
# Install dev deps for simplecov to run correctly
@bundle install
# Run tests against all examples (before and after using gem)
@make all_test_examples
# Remove Gemfile and .gemspec in project root and restore ./pkg/ .gemspec
@make test_teardown
# Remove project root Gemfile.lock created when installing dev deps
@make rem_root_gemfile_lock
# Add new tag defaults to using the version stored at top of Makefile
# Creates a tag named v$(TAG) and pushes it to the remote repository
update_gem_tag:
@./bin/tag-gem $(TAG)
# Checks out a tagged gem release and publishes it to rubygems
publish_to_rubygems:
@./bin/publish $(TAG)