Skip to content

Commit

Permalink
added vagrant config to automate env setup and unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Shipley committed Oct 9, 2013
1 parent 9ad25d0 commit fec66de
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ nbproject/
vendor/
*.local.php
build/
.vagrant/
26 changes: 26 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntuserver12.04x86_64"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-vagrant-amd64-disk1.box"

# System setup/configuration
config.vm.provision :shell, :path => "vagrant-setup.sh"

# Give it some more memory
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory","768"]
end
end
31 changes: 31 additions & 0 deletions vagrant-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Install necessary packages
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update -y
sudo apt-get install -y git python-software-properties build-essential libxml2-dev nodejs redis-server php5 php5-curl
sudo npm install -g apiaxle-repl apiaxle-proxy apiaxle-api

# Start ApiAxle processes
apiaxle-proxy -p 3000 &
sleep 3
apiaxle-api -p 8000 &
sleep 3

# Create non-shared folder for running tests
sudo mkdir /apiaxle
sudo cp -R /vagrant/* /apiaxle/
sudo chown -R vagrant:vagrant /apiaxle

# Reuse travis configuration to provision apiaxle api and key
cd /apiaxle
./travis.setup.sh

# Update composer dependencies
cd /apiaxle
php composer.phar self-update
php composer.phar update

# Run unit tests
cd /apiaxle
./vendor/bin/phpunit tests/

0 comments on commit fec66de

Please sign in to comment.