Permalink
Browse files

Merge pull request #271 from travis-ci/hh-vagrant

Add a Vagrantfile
  • Loading branch information...
2 parents bbf7e34 + 81fcef8 commit 33f8bf9eb60838414789d0063fb21808393398d9 @joshk joshk committed Jul 22, 2014
Showing with 50 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +8 −3 README.md
  3. +41 −0 Vagrantfile
View
@@ -7,3 +7,4 @@ tmp
play/*.sh
examples
rspec.log
+.vagrant
View
@@ -12,12 +12,17 @@ form.
## Running test suites
-### Note
-Currently, the specs actually runs generated build scripts. We recommend
-running them inside a virtual machine.
+Since the specs runs the generated build script, we recommend running it in a
+virtual machine to contain the changes. There's a Vagrantfile in this
+repository, so you can use [Vagrant](http://www.vagrantup.com) for this:
+ vagrant up
+ vagrant ssh
+ cd /vagrant
bundle exec rspec spec
+If you wish to just run the specs, you can just run `bundle exec rspec spec`.
+
## Use as addon for CLI
You can set travis-build up as a plugin for the [command line client](https://github.com/travis-ci/travis):
View
@@ -0,0 +1,41 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ config.vm.box = "ubuntu/precise64"
+
+ config.vm.provision "shell", privileged: true, inline: <<-EOF
+ if ! [[ -f /usr/local/share/chruby/chruby.sh ]]; then
+ mkdir /tmp/chruby
+ cd /tmp/chruby
+ wget -qO chruby-0.3.8.tar.gz https://github.com/postmodern/chruby/archive/v0.3.8.tar.gz
+ tar -xzvf chruby-0.3.8.tar.gz
+ cd chruby-0.3.8/
+ make install
+ fi
+
+ apt-get update
+ apt-get install -y git libssl-dev
+ EOF
+
+ config.vm.provision "shell", privileged: false, inline: <<-EOF
+ if ! [[ -d ~/.rubies/ruby-2.0.0-p481 ]]; then
+ echo "Installing Ruby 2.0.0 (this might take a while depending on your network connection)"
+ mkdir ~/.rubies
+ wget -qO- http://rubies.travis-ci.org/ubuntu/12.04/x86_64/ruby-2.0.0-p481.tar.bz2 | tar -jx -C ~/.rubies
+ RUBIES=(~/.rubies/*)
+ fi
+
+ echo 'source /usr/local/share/chruby/chruby.sh' >> ~/.bashrc
+ echo 'chruby ruby-2.0' >> ~/.bashrc
+
+ source /usr/local/share/chruby/chruby.sh
+ chruby ruby-2.0
+
+ gem install bundler
+ bundle install --gemfile=/vagrant/Gemfile
+ EOF
+end

0 comments on commit 33f8bf9

Please sign in to comment.