forked from sunspot/sunspot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
executable file
·67 lines (51 loc) · 1.39 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
#!/bin/sh
set +e
solr_responding() {
port=$1
curl -o /dev/null "http://localhost:$port/solr/admin/ping" > /dev/null 2>&1
}
wait_until_solr_responds() {
port=$1
while ! solr_responding $1; do
/bin/echo -n "."
sleep 1
done
}
case $GEM in
"sunspot")
cd sunspot
/bin/echo -n "Starting Solr on port 8983 for Sunspot specs..."
bundle install --quiet --path vendor/bundle
if [ -f sunspot-solr.pid ]; then bundle exec sunspot-solr stop || true; fi
bundle exec sunspot-solr start -p 8983 -d /tmp/solr
wait_until_solr_responds 8983
/bin/echo "done."
# Invoke the sunspot specs
bundle exec rake spec
rv=$?
/bin/echo -n "Stopping Solr... "
bundle exec sunspot-solr stop
/bin/echo "done."
exit $rv
;;
"sunspot_rails")
cd sunspot
/bin/echo -n "Starting Solr on port 8983 for Sunspot specs..."
bundle install --quiet --path vendor/bundle
if [ -f sunspot-solr.pid ]; then bundle exec sunspot-solr stop || true; fi
bundle exec sunspot-solr start -p 8983 -d /tmp/solr
wait_until_solr_responds 8983
/bin/echo "done."
# Install gems for test Rails application
cd ../sunspot_rails
rake spec RAILS=$RAILS
rv=$?
# Cleanup Solr
/bin/echo -n "Stopping Solr... "
cd ../sunspot
bundle exec sunspot-solr stop
/bin/echo "done."
exit $rv
;;
*)
esac