Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow for easier Apache installs. Closes #45.

  • Loading branch information...
commit 25bc3e00319229e41b2ae38606f4f54c58d3112f 1 parent 5144c6e
@NSinopoli NSinopoli authored
View
5 .htaccess
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteRule ^$ app/public/ [L]
+ RewriteRule (.*) app/public/$1 [L]
+</IfModule>
View
64 README.md
@@ -77,69 +77,11 @@ Place this code block within the `http {}` block in your `nginx.conf` file:
Note that you will have to change the `server_name` to the name you use in your hosts file. You will also have to adjust the directories according to where you installed the code. In this configuration, /srv/http/vpu/ is the project root. The public-facing part of VisualPHPUnit, however, is located in app/public within the project root (so in this example, it's /srv/http/vpu/app/public).
-### Apache
-
-In your `httpd.conf` file, locate your `DocumentRoot`. It will look something like this:
-
-```apache
-DocumentRoot "/srv/http"
-```
-
-Now find the `<Directory>` tag that corresponds to your `DocumentRoot`. It will look like this:
-
-```apache
-<Directory "/srv/http">
-```
-
-Within that tag, change the `AllowOverride` setting:
-
-```apache
-AllowOverride All
-```
-
-Ensure that your `DirectoryIndex` setting contains index.php:
+When that's done, restart your web server, and then point your browser at the server name you chose above!
-```apache
-DirectoryIndex index.php
-```
-
-Now uncomment the following line:
-
-```apache
-Include conf/extra/httpd-vhosts.conf
-```
-
-Edit your conf/extra/httpd-vhosts.conf file and add the following code block:
-
-```apache
-<VirtualHost *:80>
- DocumentRoot "/srv/http/vpu/app/public"
- ServerName vpu
- ErrorLog "/var/log/httpd/vpu_error.log"
- CustomLog "/var/log/httpd/vpu_access.log" common
- <Directory /srv/http/vpu/app/public>
- Options +FollowSymLinks
- </Directory>
-</VirtualHost>
-```
-
-Note that you will have to change the `ServerName` to the name you use in your hosts file. You will also have to adjust the directories ( in `DocumentRoot`, as well as the `<Directory>` tag) according to where you checked out the code. In this configuration, /srv/http/vpu/ is the project root. The public-facing part of VisualPHPUnit, however, is located in app/public within the project root (so in this example, it's /srv/http/vpu/app/public).
-
-Within your project's public root, create an .htaccess file (in our case, it'd be located at /srv/http/vpu/app/public/.htaccess) and paste the following block inside:
-
-```apache
-<IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !favicon.ico$
- RewriteRule ^(.*)$ index.php [QSA,L]
-</IfModule>
-```
-
-### Restart Your Web Server
+### Apache
-Restart your web server, and then point your browser at the server name you chose above!
+VPU comes with .htaccess files, so you won't have to worry about configuring anything. Simply point your browser at the location where you installed the code!
## Project Configuration (optional)
View
6 app/config/bootstrap.php
@@ -9,7 +9,7 @@
'pear_path' => '/usr/share/pear',
// The directory where the tests reside
- 'test_directory' => '/srv/http/vpu/app/test',
+ 'test_directory' => "{$root}/app/test",
/* Optional */
@@ -35,7 +35,7 @@
'create_snapshots' => false,
// The directory where the test results will be stored
- 'snapshot_directory' => '/srv/http/vpu/app/history/',
+ 'snapshot_directory' => "{$root}/app/history/",
// Whether or not to sandbox PHP errors
'sandbox_errors' => false,
@@ -58,7 +58,7 @@
// In order for VPU to function correctly, the configuration file must
// contain a JSON listener (see the README for more information)
'xml_configuration_file' => false,
- //'xml_configuration_file' => '/srv/http/vpu/app/config/phpunit.xml',
+ //'xml_configuration_file' => "{$root}/app/config/phpunit.xml",
// Paths to any necessary bootstraps
'bootstraps' => array(
View
7 app/public/.htaccess
@@ -0,0 +1,7 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !favicon.ico$
+ RewriteRule ^(.*)$ index.php [QSA,L]
+</IfModule>
View
20 app/view/archives/index.html
@@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
- <link href="/css/bootstrap.css" rel="stylesheet">
+ <link href="./css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
- <link href="/css/bootstrap-responsive.css" rel="stylesheet">
+ <link href="./css/bootstrap-responsive.css" rel="stylesheet">
<link href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/themes/redmond/jquery-ui.css' rel='stylesheet'>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
@@ -31,13 +31,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
- <a class="brand" href="/">VisualPHPUnit</a>
+ <a class="brand" href="./">VisualPHPUnit</a>
<div class="nav-collapse">
<ul class="nav">
- <li><a href="/">Home</a></li>
- <li class='active'><a href="/archives">Archives</a></li>
- <li><a href="/graphs">Graphs</a></li>
- <li><a href="/help">Help</a></li>
+ <li><a href="./">Home</a></li>
+ <li class='active'><a href="./archives">Archives</a></li>
+ <li><a href="./graphs">Graphs</a></li>
+ <li><a href="./help">Help</a></li>
</ul>
</div>
</div>
@@ -49,7 +49,7 @@
<div class='row'>
<div class='span3'>
- <form action='/archives' method='get' class='well'>
+ <form action='./archives' method='get' class='well'>
<ul class="nav nav-list">
<li class='nav-header'>Archives</li>
<li>
@@ -121,7 +121,7 @@
</div>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
- <script src='/js/jquery.sortElements.js'></script>
+ <script src='./js/jquery.sortElements.js'></script>
<script>
$(document).ready(function() {
@@ -133,7 +133,7 @@
$output.fadeOut(300, function() {
$output.html(
- "<div class='loader'><img src='/img/ajax-loader.gif'></div>"
+ "<div class='loader'><img src='./img/ajax-loader.gif'></div>"
).fadeIn(300);
$.get($form.attr('action'), $form.serialize(), function(response) {
View
18 app/view/graph/index.html
@@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
- <link href="/css/bootstrap.css" rel="stylesheet">
+ <link href="./css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
- <link href="/css/bootstrap-responsive.css" rel="stylesheet">
+ <link href="./css/bootstrap-responsive.css" rel="stylesheet">
<link href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/themes/redmond/jquery-ui.css' rel='stylesheet'>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
@@ -31,13 +31,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
- <a class="brand" href="/">VisualPHPUnit</a>
+ <a class="brand" href="./">VisualPHPUnit</a>
<div class="nav-collapse">
<ul class="nav">
- <li><a href="/">Home</a></li>
- <li><a href="/archives">Archives</a></li>
- <li class='active'><a href="/graphs">Graphs</a></li>
- <li><a href="/help">Help</a></li>
+ <li><a href="./">Home</a></li>
+ <li><a href="./archives">Archives</a></li>
+ <li class='active'><a href="./graphs">Graphs</a></li>
+ <li><a href="./help">Help</a></li>
</ul>
</div>
</div>
@@ -97,7 +97,7 @@
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/highcharts/2.2.3/highcharts.js'></script>
- <script src='/js/bootstrap-alert.js'></script>
+ <script src='./js/bootstrap-alert.js'></script>
<script type='text/html' id='error'>
<div class="alert alert-block alert-danger">
@@ -112,7 +112,7 @@ <h4 class="alert-heading"><%= error.title %></h4>
$('#draw-graph').click(function(event) {
event.preventDefault();
- $.post('/graphs', {
+ $.post('./graphs', {
'graph_type' : $('#graph-type').val(),
'time_frame' : $('#time-frame').val(),
'start_date' : $('#start-date').val(),
View
14 app/view/home/help.html
@@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
- <link href="/css/bootstrap.css" rel="stylesheet">
+ <link href="./css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
- <link href="/css/bootstrap-responsive.css" rel="stylesheet">
+ <link href="./css/bootstrap-responsive.css" rel="stylesheet">
<link href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/themes/redmond/jquery-ui.css' rel='stylesheet'>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
@@ -31,13 +31,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
- <a class="brand" href="/">VisualPHPUnit</a>
+ <a class="brand" href="./">VisualPHPUnit</a>
<div class="nav-collapse">
<ul class="nav">
- <li><a href="/">Home</a></li>
- <li><a href="/archives">Archives</a></li>
- <li><a href="/graphs">Graphs</a></li>
- <li class='active'><a href="/help">Help</a></li>
+ <li><a href="./">Home</a></li>
+ <li><a href="./archives">Archives</a></li>
+ <li><a href="./graphs">Graphs</a></li>
+ <li class='active'><a href="./help">Help</a></li>
</ul>
</div>
</div>
View
26 app/view/home/index.html
@@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
- <link href="/css/bootstrap.css" rel="stylesheet">
+ <link href="./css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
- <link href="/css/bootstrap-responsive.css" rel="stylesheet">
+ <link href="./css/bootstrap-responsive.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
@@ -30,13 +30,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
- <a class="brand" href="/">VisualPHPUnit</a>
+ <a class="brand" href="./">VisualPHPUnit</a>
<div class="nav-collapse">
<ul class="nav">
- <li class='active'><a href="/">Home</a></li>
- <li><a href="/archives">Archives</a></li>
- <li><a href="/graphs">Graphs</a></li>
- <li><a href="/help">Help</a></li>
+ <li class='active'><a href="./">Home</a></li>
+ <li><a href="./archives">Archives</a></li>
+ <li><a href="./graphs">Graphs</a></li>
+ <li><a href="./help">Help</a></li>
</ul>
</div>
</div>
@@ -48,7 +48,7 @@
<div class='row'>
<div class='span3'>
- <form action='/' method='post' class='well'>
+ <form action='./' method='post' class='well'>
<ul class="nav nav-list">
<li class='nav-header'>Files</li>
@@ -169,9 +169,9 @@
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js'></script>
- <script src='/js/jqueryFileSelector.js'></script>
- <script src='/js/jquery.sortElements.js'></script>
- <script src='/js/bootstrap-alert.js'></script>
+ <script src='./js/jqueryFileSelector.js'></script>
+ <script src='./js/jquery.sortElements.js'></script>
+ <script src='./js/bootstrap-alert.js'></script>
<script type='text/html' id='test-results'>
<% _.each(notifications, function(notification) { %>
@@ -308,7 +308,7 @@ <h4 class="alert-heading"><%= error.type %></h4>
$output.fadeOut(300, function() {
$output.html(
- "<div class='loader'><img src='/img/ajax-loader.gif'></div>"
+ "<div class='loader'><img src='./img/ajax-loader.gif'></div>"
).fadeIn(300);
$.post($form.attr('action'), $form.serialize(), function(response) {
@@ -382,7 +382,7 @@ <h4 class="alert-heading"><%= error.type %></h4>
$('#test-files').val(tests.slice(0, -1));
},
root: '<?=$test_directory;?>',
- serverEndpoint: '/file-list'
+ serverEndpoint: './file-list'
});
});
</script>
View
12 nx/core/Request.php
@@ -84,10 +84,14 @@ public function __construct(array $config = array()) {
$this->_env['DOCUMENT_ROOT'], '', $this->_env['SCRIPT_FILENAME']
));
- $uri = $this->_env['REQUEST_URI'];
- $parsed = parse_url($uri);
-
- $this->url = $parsed['path'];
+ $parsed = parse_url($this->_env['REQUEST_URI']);
+
+ $base = str_replace('\\', '/', dirname($this->_env['PHP_SELF']));
+ $base = rtrim(str_replace('/app/public', '', $base), '/');
+ $pattern = '/^' . preg_quote($base, '/') . '/';
+ $this->url = '/' . trim(
+ preg_replace($pattern, '', $parsed['path']),
+ '/');
$query = array();
if ( isset($parsed['query']) ) {
Please sign in to comment.
Something went wrong with that request. Please try again.