-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·56 lines (45 loc) · 919 Bytes
/
run.sh
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
#!/bin/bash
#CONSTANTS
CURRENT_DIR=$(readlink -f $(dirname $0))
# Go to the current directory
cd $CURRENT_DIR;
# Functions
function checkStatus() {
if [ $1 -ne 0 ] ; then echo "Error..."; exit $1; fi
}
function log() {
echo "";
s="===============================";
echo "$s"
echo "$1"
echo "$s"
}
# Cleaning previous build
find . -type f -name "*.gem" -delete
# Get the Gem
GEMSPEC=$(find . -name "*.gemspec")
# Building
log "Building ..."
gem build $GEMSPEC
checkStatus $?
# Running tests
log "Running tests ..."
rake test
checkStatus $?
# Installing
GEM=$(find . -type f -name "*.gem")
log "Installing ..."
gem install $GEM --verbose
checkStatus $?
# List
GEM_NAME=$(basename ${GEMSPEC%.*})
log "List $GEM_NAME"
gem list -r $GEM_NAME
gem list $GEM_NAME
# Publishing ?
echo ""
read -p "Publishing ? [y/n] " pub;
if [[ "$pub" == "y" ]] ; then
log "Starting publishing ..."
gem push $GEM --verbose
fi