-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
45 lines (33 loc) · 1.16 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
GEM_NAME=puppet-lint-manifest_whitespace-check
GEMSPEC_FILE=$(GEM_NAME).gemspec
define get_version
$(shell ruby -e "require 'rubygems'; load '$(GEMSPEC_FILE)'; puts Gem::Specification.all.find{|s| s.name == '$(GEM_NAME)'}.version")
endef
define get_next_patch_version
$(shell ruby -e "require 'rubygems'; load '$(GEMSPEC_FILE)'; v = Gem::Specification.all.find{|s| s.name == '$(GEM_NAME)'}.version; puts Gem::Version.new(v.version+'.0').bump")
endef
.PHONY: all clean test release
install-deps:
bundle install
info:
@echo "Gem name: $(GEM_NAME)"
@echo "Spec file: $(GEMSPEC_FILE)"
@echo "Current version: $(call get_version)"
@echo "Next version: $(call get_next_patch_version)"
test:
bundle exec rspec
release: patch build push-git push-gem clean
patch:
sed "s/'$(call get_version)'/'$(call get_next_patch_version)'/" -i $(GEMSPEC_FILE)
grep -q "'$(call get_next_patch_version)'" $(GEMSPEC_FILE)
push-git:
git commit -m "Bump to version $(call get_next_patch_version)" -sS $(GEMSPEC_FILE)
git push
git tag $(call get_next_patch_version)
git push --tags
build:
gem build $(GEMSPEC_FILE)
push-gem:
gem push $(GEM_NAME)-$(call get_version).gem
clean:
rm *.gem