forked from sunspot/sunspot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
executable file
·86 lines (63 loc) · 1.59 KB
/
travis.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
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
86
#!/bin/sh
set +e
SOLR_PORT=8983
export SUNSPOT_LIB_HOME=`pwd`
solr_responding() {
curl -o /dev/null "http://localhost:$SOLR_PORT/solr/admin/ping" > /dev/null 2>&1
}
start_solr_server() {
# go to sunspot_solr folder and install dependencies
current_path=`pwd`
cd ../sunspot_solr
bundle install --quiet --path vendor/bundle
# stop solr of already running (but it should not be)
if [ -f sunspot-solr.pid ]; then stop_solr_server || true; fi
/bin/echo -n "Starting Solr on port $SOLR_PORT for Sunspot specs..."
# start solr
bundle exec sunspot-solr start -p $SOLR_PORT
# wait while Solr is up and running
while ! solr_responding; do
/bin/echo -n "."
sleep 1
done
/bin/echo "done."
cd $current_path
}
stop_solr_server() {
cd ../sunspot_solr
/bin/echo -n "Stopping Solr... "
bundle exec sunspot-solr stop -p $SOLR_PORT
/bin/echo "done."
}
case $GEM in
"sunspot")
cd sunspot
bundle install --quiet --path vendor/bundle
start_solr_server
# Invoke the sunspot specs
bundle exec appraisal install && bundle exec appraisal rake spec
rv=$?
stop_solr_server
exit $rv
;;
"sunspot_rails")
cd sunspot
bundle install --quiet --path vendor/bundle
start_solr_server
cd ../sunspot_rails
bundle install --quiet --path vendor/bundle
gem list
bundle exec appraisal install && bundle exec appraisal rspec
rv=$?
cd ../sunspot
stop_solr_server
exit $rv
;;
"sunspot_solr")
cd sunspot_solr
bundle install --quiet --path vendor/bundle
bundle exec rake spec
exit $?
;;
*)
esac