This repository was archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (60 loc) · 3.13 KB
/
Makefile
File metadata and controls
71 lines (60 loc) · 3.13 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
BIN_PATH := $(CURDIR)/bin
VENDOR_PATH := $(CURDIR)/vendor
.PHONY: default install-ruby-dependencies vagrant-provision install clean test
default:
@echo "No default $(MAKE) target configured."
@exit 1
required-dependency = \
echo -n "Checking if '$(1)' is available... " ; \
$(eval COMMAND := which '$(1)') \
if $(COMMAND) >/dev/null; then \
$(COMMAND) ; \
else \
echo "fail:" ; \
echo ; \
echo " $(COMMAND)" ; \
echo ; \
echo "You must install '$(2)' before you could continue." ; \
exit 1; \
fi
install-ruby-gem-if-missing = \
echo -n "Checking if '$(1)' RubyGem is available... " ; \
$(eval GEM_VERSION := ruby -rubygems -e "puts Gem::Specification::find_by_name('$(1)').version") \
if $(GEM_VERSION) 1>/dev/null 2>&1; then \
$(GEM_VERSION) ; \
else \
$(eval COMMAND_INSTALL := gem install --remote --no-ri --no-rdoc '$(1)') \
echo "nope." ; \
echo -n "Installing '$(1)' RubyGem... " ; \
$(COMMAND_INSTALL) 1>/dev/null ; \
$(GEM_VERSION) ; \
fi
install-ruby-dependencies: $(VENDOR_PATH)/ruby
$(VENDOR_PATH)/ruby:
@$(call required-dependency,ruby,Ruby)
@$(call required-dependency,gem,RubyGems)
@$(call install-ruby-gem-if-missing,bundler)
@$(call required-dependency,bundle,Bundler)
@echo -n 'Installing RubyGem dependencies... '
@bundle install --path '$(VENDOR_PATH)' --binstubs '$(BIN_PATH)' 1>/dev/null
@echo 'OK'
vagrant-provision: install-ruby-dependencies $(CURDIR)/.vagrant
$(CURDIR)/.vagrant:
@'$(BIN_PATH)/vagrant' up
install: vagrant-provision
clean:
@if [ -f '$(CURDIR)/.vagrant' ]; then \
'$(BIN_PATH)/vagrant' destroy --force ; \
rm '$(CURDIR)/.vagrant' ; \
fi
@if [ -d '$(VENDOR_PATH)/ruby' ]; then \
rm -Rf '$(VENDOR_PATH)/ruby'* ; \
fi
@for file in bin/*; do \
grep "$$( basename "$$file" )" bin/.gitignore >/dev/null || rm "$$file" ; \
done
test: install
@for file in test/*-test.sh; do \
'$(BIN_PATH)/vagrant' ssh -c '( cd /vagrant && bin/roundup '"$$file"' )' ; \
done
# vim: ts=2 sw=2 noet