Add some resilience to the travis-ci job so that if rubygems is temperamental or...
authorPeter Donald <donaldp@apache.org>
Fri, 11 Oct 2013 22:43:51 +0000 (22:43 +0000)
committerPeter Donald <donaldp@apache.org>
Fri, 11 Oct 2013 22:43:51 +0000 (22:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1531453 13f79535-47bb-0310-9956-ffa450edef68

.travis.yml
ci-setup.sh [new file with mode: 0644]

index 6b1e173..0b54111 100644 (file)
@@ -14,8 +14,7 @@ scala:
 #  - 2.9.1
 #  - 2.8.1
 install:
-  - gem install bundler
-  - bundle install
+  - source ci-setup.sh
   - export JRUBY_OPTS="-J-XX:MaxPermSize=312m -J-Xmx700M"
   - export JAVA_OPTS="-Xmx700m -XX:MaxPermSize=312m"
 script: rake ci
diff --git a/ci-setup.sh b/ci-setup.sh
new file mode 100644 (file)
index 0000000..506c3df
--- /dev/null
@@ -0,0 +1,24 @@
+update_bundler() {
+  gem list | grep 'bundler' &> /dev/null
+  if [ $? -gt 0 ]; then
+    gem install bundler
+  fi
+  if [ "$1" = 'quiet' ]; then
+    bundle install --deployment > /dev/null 2> /dev/null
+  else
+    bundle install --deployment
+  fi
+}
+
+i="0"
+
+until (bundle check > /dev/null 2> /dev/null) || [ $i -gt 10 ]; do
+  echo "Bundle update. Attempt: $i"
+  update_bundler 'quiet'
+  i=$[$i+1]
+done
+
+if !(bundle check > /dev/null 2> /dev/null); then
+  echo "Last Bundle update attempt."
+  update_bundler
+fi