-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_gem.sh
More file actions
48 lines (42 loc) · 738 Bytes
/
build_gem.sh
File metadata and controls
48 lines (42 loc) · 738 Bytes
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
#!/bin/sh
LIB_NAME="snipp"
if [ $# -ne 2 ]
then
echo "Usage: $0 {version} {target}"
exit 1
fi
GEMSPEC="${LIB_NAME}.gemspec"
PKG_FILE="${LIB_NAME}-$1.gem"
echo "[RUN] gem install"
bundle install
echo "[RUN] rake"
bundle exec rake
if [ $? -eq 1 ]
then
exit 1
fi
echo "[RUN] gem build ${GEMSPEC}"
gem build ${GEMSPEC}
if [ $? -eq 1 ]
then
exit 1
fi
echo "[RUN] mv ${PKG_FILE} pkg/"
mv ${PKG_FILE} ./pkg
case "$2" in
"install")
echo "[RUN] rake install pkg/${PKG_FILE}"
bundle exec rake install --trace
;;
"deploy")
echo "[RUN] gem push pkg/${PKG_FILE}"
gem push pkg/${PKG_FILE}
echo "[RUN] git tag -a version-$1"
git tag -a version-$1 -m ""
git push --tags
;;
*)
echo "FATAL: invalid target"
exit 1
;;
esac