diff --git a/.gitignore b/.gitignore index ea33b4a..de8c5d2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ nbproject/ vendor/ *.local.php build/ +.vagrant/ diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..072eede --- /dev/null +++ b/Vagrantfile @@ -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 diff --git a/vagrant-setup.sh b/vagrant-setup.sh new file mode 100644 index 0000000..e1adf61 --- /dev/null +++ b/vagrant-setup.sh @@ -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/ \ No newline at end of file