diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index f1ffa3a..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,8 +0,0 @@ -port = ENV["HOST_PORT"] || 8080 - -Vagrant.configure("2") do |config| - # Ubuntu 14.04 LTS - config.vm.box = "ubuntu/trusty64" - config.vm.network "forwarded_port", guest: 80, host: port - config.vm.provision "shell", path: "vagrant/provision.sh" -end diff --git a/vagrant/index.php b/vagrant/index.php deleted file mode 100644 index e9c02d9..0000000 --- a/vagrant/index.php +++ /dev/null @@ -1,54 +0,0 @@ -addPsr4("", __DIR__ . "/../autoload"); - - -// Build some middleware. We'll register these with a server below. -// We're using callables to fit this all in one example, but these -// could also be classes implementing WellRESTed\MiddlewareInterface. - -// Set the status code and provide the greeting as the response body. -$hello = function ($request, $response, $next) { - - // Check for a "name" attribute which may have been provided as a - // path variable. Use "world" as a default. - $name = $request->getAttribute("name", "world"); - - // Set the response body to the greeting and the status code to 200 OK. - $response = $response->withStatus(200) - ->withHeader("Content-type", "text/plain") - ->withBody(new Stream("Hello, $name!")); - - // Propagate to the next middleware, if any, and return the response. - return $next($request, $response); - -}; - -// Add a header to the response. -$headerAdder = function ($request, $response, $next) { - // Add the header. - $response = $response->withHeader("X-example", "hello world"); - // Propagate to the next middleware, if any, and return the response. - return $next($request, $response); -}; - -// Create a server -$server = new Server(); - -// Start each request-response cycle by dispatching the header adder. -$server->add($headerAdder); - -// The header adder will propagate to this router, which will dispatch the -// $hello middleware, possibly with a {name} variable. -$server->add($server->createRouter() - ->register("GET", "/hello", $hello) - ->register("GET", "/hello/{name}", $hello) -); - -// Read the request from the client, dispatch middleware, and output. -$server->respond(); diff --git a/vagrant/log-in-message.txt b/vagrant/log-in-message.txt deleted file mode 100644 index cfeadab..0000000 --- a/vagrant/log-in-message.txt +++ /dev/null @@ -1,9 +0,0 @@ -Welcome to the WellRESTed development box. - -To run unit tests: - vendor/bin/phpunit - -To generate documentation: - make html -C docs - - diff --git a/vagrant/nginx b/vagrant/nginx deleted file mode 100644 index 6d13ca5..0000000 --- a/vagrant/nginx +++ /dev/null @@ -1,17 +0,0 @@ -server { - listen 80; - server_name localhost; - root /vagrant/htdocs; - index index.php index.html; - charset utf-8; - - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - location ~ \.php$ { - try_files $uri /index.php; - include /etc/nginx/fastcgi_params; - fastcgi_pass unix:/var/run/php5-fpm.sock; - } -} diff --git a/vagrant/provision.sh b/vagrant/provision.sh deleted file mode 100644 index b5368e1..0000000 --- a/vagrant/provision.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -# PHP-5.6 repository -if ! apt-cache policy | grep ondrej/php5-5.6 ; then - apt-add-repository -y ppa:ondrej/php5-5.6 -fi - -apt-get update -apt-get install -q -y git augeas-tools nginx php5 php5-fpm php5-cli php5-curl php5-xdebug python-pip - -# Install or update composer. -if type composer &> /dev/null; then - composer self-update -else - curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin -fi - -# Install Python dependencies -pip install sphinx sphinx_rtd_theme - -# Configure software -changes=" -set /files/etc/php5/cli/php.ini/Date/date.timezone America/New_York -set /files/etc/php5/fpm/php.ini/Date/date.timezone America/New_York -set /files/etc/php5/fpm/php.ini/cgi/cgi.fix_pathinfo 0 -set /files/etc/php5/fpm/php.ini/Session/session.save_path 127.0.0.1:11211 -set /files/etc/php5/mods-available/xdebug.ini/.anon/zend_extension xdebug.so -set /files/etc/php5/mods-available/xdebug.ini/.anon/xdebug.remote_enable on -set /files/etc/php5/mods-available/xdebug.ini/.anon/xdebug.remote_connect_back on -set /files/etc/php5/fpm/pool.d/www.conf/www/listen /var/run/php5-fpm.sock -# Disable sendfile in Nginx to avoid VirtualBox synced directory bug. -set /files/etc/nginx/nginx.conf/http/sendfile off -save -" -echo "$changes" | augtool - -# Install the Nginx site. -cp /vagrant/vagrant/nginx /etc/nginx/sites-available/wellrested -if [ ! -h /etc/nginx/sites-enabled/wellrested ] ; then - ln -s /etc/nginx/sites-available/wellrested /etc/nginx/sites-enabled/wellrested -fi -if [ -h /etc/nginx/sites-enabled/default ] ; then - rm /etc/nginx/sites-enabled/default -fi - -# Create the document and symlinks. -if [ ! -d /vagrant/htdocs ] ; then - mkdir /vagrant/htdocs -fi -if [ ! -h /vagrant/htdocs/docs ] ; then - ln -s /vagrant/docs/build/html /vagrant/htdocs/docs -fi -if [ ! -h /vagrant/htdocs/coverage ] ; then - ln -s /vagrant/report /vagrant/htdocs/coverage -fi -if [ ! -f /vagrant/htdocs/index.php ] ; then - cp /vagrant/vagrant/index.php /vagrant/htdocs/index.php -fi -if [ ! -d /vagrant/autoload ] ; then - mkdir /vagrant/autoload -fi - -# Install Composer dependencies -composer --working-dir=/vagrant install - -# Restart services. -service php5-fpm restart -service nginx restart - -# Drop the user into the /vagrant directory on log in and dislay a message. -if ! grep /home/vagrant/.bashrc -e "cd /vagrant" &> /dev/null ; then - echo "cd /vagrant" >> /home/vagrant/.bashrc - echo "cat /vagrant/vagrant/log-in-message.txt" >> /home/vagrant/.bashrc -fi