diff --git a/.gitignore b/.gitignore index edbbb66..e4b6c18 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ workspace.xml # Vagrant .vagrant/ -# Vagrant site's document root. +# Vagrant sandbox site files. /htdocs/ +/autoload/ diff --git a/vagrant/index.php b/vagrant/index.php index 7aa012a..a6bbc64 100644 --- a/vagrant/index.php +++ b/vagrant/index.php @@ -1,3 +1,11 @@ addPsr4("", __DIR__ . "/../vagrant/src"); +$loader->addPsr4("", __DIR__ . "/../autoload"); + +$router = new Router(); +$router->add("/", "\\WellRESTedDev\\RootHandler"); +$router->respond(); diff --git a/vagrant/provision.sh b/vagrant/provision.sh index 7107bfe..75cd8c1 100644 --- a/vagrant/provision.sh +++ b/vagrant/provision.sh @@ -41,7 +41,7 @@ fi # Create the document and symlinks. if [ ! -d /vagrant/htdocs ] ; then - mkdir /vagrant/htdocs 2&> /dev/null + mkdir /vagrant/htdocs fi if [ ! -h /vagrant/htdocs/docs ] ; then ln -s /vagrant/docs/build/html /vagrant/htdocs/docs @@ -49,7 +49,12 @@ fi if [ ! -h /vagrant/htdocs/coverage ] ; then ln -s /vagrant/report /vagrant/htdocs/coverage fi -cp /vagrant/vagrant/index.php /vagrant/htdocs/index.php +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 diff --git a/vagrant/src/WellRESTedDev/RootHandler.php b/vagrant/src/WellRESTedDev/RootHandler.php new file mode 100644 index 0000000..1336d66 --- /dev/null +++ b/vagrant/src/WellRESTedDev/RootHandler.php @@ -0,0 +1,50 @@ + + +
+ +Run vagrant ssh, then:
vendor/bin/phpunitmake html -C docsUse this site as a sandbox. Modify the router /htdocs/index.php however you like.
Any classes you create inside /autoload will be autoloaded with a PSR-4 autoloader.