Skip to content

Commit

Permalink
Add a small config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian committed Aug 11, 2010
1 parent ecbc1fb commit 72fab64
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
4 changes: 3 additions & 1 deletion build.php
@@ -1,10 +1,12 @@
<?php

$config = include 'config.php';

header('Content-Type: text/javascript');

require dirname(__FILE__) . '/Packager/packager.php';

$pkg = new Packager(array('mootools-core','mootools-more'));
$pkg = new Packager(array($config['core-path'], $config['more-path']));

$components = $_GET['require'];
$files = (empty($components)) ? $pkg->get_all_files() : $pkg->components_to_files(explode(',',$components));
Expand Down
9 changes: 9 additions & 0 deletions config.php
@@ -0,0 +1,9 @@
<?php

return array(
'app-name' => 'MooTools More 1.3 Test Runner',
'core-path' => 'mootools-core',
'more-path' => 'mootools-more',
'tests-path' => 'mootools-more/Tests',
'default-file' => 'Class/Chain.Wait'
);
10 changes: 6 additions & 4 deletions index.php
@@ -1,13 +1,15 @@
<?php

$config = include 'config.php';

include_once 'libs/Request/Path.php';
include_once 'libs/Template.php';
include_once 'libs/markdown.php';

$rq = new Awf_Request_Path();

$testsPath = 'mootools-more/Tests';
$defaultFile = 'Class/Chain.Wait';
$testsPath = $config['tests-path'];
$defaultFile = $config['default-file'];

// Determine the right file
$file = $rq->toArray();
Expand All @@ -31,6 +33,7 @@
$tpl->baseurl = $baseurl = $_SERVER['SCRIPT_NAME'];
$tpl->basepath = $basepath = str_replace('index.php','',$baseurl);
$tpl->title = $file;
$tpl->appName = $config['app-name'];

// Get the content
$content = file_get_contents($filePath);
Expand All @@ -44,9 +47,7 @@

// Replace script src attribute
$content = str_replace('/depender/build', $basepath.'build.php', $content);

$content = str_replace('/asset/more/', $basepath.$testsPath.'/_assets/', $content);

$content = preg_replace('/\/ajax_(html_echo)\//', $basepath.'ajax.php', $content);

$tpl->content = $content;
Expand Down Expand Up @@ -85,5 +86,6 @@
$tpl->prevTest = $prevTest;


// Fire the page!!
$tpl->display('index.php');

2 changes: 1 addition & 1 deletion templates/index.php
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<link href="<?php echo $basepath; ?>assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools More 1.3 Test Runner - <?php echo htmlentities(str_replace('_', ' ', $title)); ?></title>
<title><?php echo $appName; ?> - <?php echo htmlentities(str_replace('_', ' ', $title)); ?></title>

<script>

Expand Down

0 comments on commit 72fab64

Please sign in to comment.