add a test build pate to the website, pointing to the automated hourly builds

for #50
This commit is contained in:
Jon Atkins 2013-04-30 03:20:26 +01:00
parent 5a5e6b9850
commit 51c17daf53
5 changed files with 168 additions and 91 deletions

View File

@ -1,40 +1,3 @@
<?php
$path = "release";
if ( $_REQUEST['build'] == 'dev' )
$path = "dev";
function loadUserScriptHeader($path)
{
$result = Array();
$f = fopen ( $path, "rt" );
while ( ( $line = fgets ( $f ) ) !== FALSE )
{
if ( preg_match ( '#//[ \\t]*==/UserScript==#', $line ) )
break;
$matches = Array();
if ( preg_match ( '#^//[ \\t]*(@[a-zA-Z0-9]+)[ \\t]+(.*)$#', $line, $matches ) )
{
$name = $matches[1];
$value = $matches[2];
if ( ! array_key_exists ( $name, $result ) )
{
$result[$name] = $value;
}
}
}
fclose ( $f );
return $result;
}
?>
<!DOCTYPE html>
<html lang="en">
@ -114,6 +77,7 @@ $pages = Array (
'faq' => '<i class="icon-question-sign"></i> FAQ',
'desktop' => '<i class="icon-chevron-right"></i> Desktop',
'mobile' => '<i class="icon-chevron-right"></i> Mobile',
'test' => '<i class="icon-wrench"></i> Test Builds',
'developer' => '<i class="icon-cog"></i> Developers',
'about' => '<i class="icon-info-sign"></i> About',
'donate' => '<i class="icon-gift"></i> Donate',
@ -138,7 +102,7 @@ foreach ( $pages as $key => $name )
print "<li".($page == $key ? ' class="active"' :'')."><a href=\"$url\">$name</a></li>\n";
# after 'mobile', add a horizontal seperator
if ( $key == 'mobile' )
if ( $key == 'test' )
print "<li class=\"divider\"></li>";
}

View File

@ -0,0 +1,68 @@
<?php
include_once ( "userscript.php" );
function iitcDesktopDownload ( $path )
{
$iitc_details = loadUserScriptHeader ( "$path/total-conversion-build.user.js" );
$iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1<small class="muted">.\2</small>', $iitc_details['@version'] );
print "<p>IITC version $iitc_version</p>\n";
print "<a class=\"btn btn-large btn-primary\" onclick=\"if(track){track('desktop','iitc',$path);}\" href=\"$path/total-conversion-build.user.js\">Download</a>\n";
}
function iitcDesktopPluginDownloadTable ( $path )
{
?>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>ID / Version</th>
<th>Description</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<?php
foreach ( glob ( "$path/plugins/*.user.js" ) as $path )
{
$basename = basename ( $path, ".user.js" );
$details = loadUserScriptHeader ( $path );
print "<tr id=\"plugin-$basename\">\n";
# remove 'IITC Plugin: ' prefix if it's there, for neatness
$name = preg_replace ( '/^IITC plugin: /i', '', $details['@name'] );
# format extended version info in less prominant font
$version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1<small class="muted">.\2</small>', $details['@version'] );
# remove unneeded prefix from description
$description = preg_replace ( '/^\[[^]]*\] */', '', $details['@description'] );
print "<td>$name</td>";
print "<td>$basename<br />$version</td>";
print "<td>$description</td>";
print "<td><a onclick=\"if(track){track('desktop','download','iitc-plugin-$basename');}\" href=\"$path\" class=\"btn btn-small btn-primary\">Download</a></td>";
# print "<a href=\"$path\">".$details['@name']."</a> <i>$name - version ".$details['@version']."</i>: <br/>\n";
# print $details['@description'];
print "</tr>\n";
}
?>
</tbody>
</table>
<?php
}
?>

View File

@ -0,0 +1,32 @@
<?php
function loadUserScriptHeader($path)
{
$result = Array();
$f = fopen ( $path, "rt" );
while ( ( $line = fgets ( $f ) ) !== FALSE )
{
if ( preg_match ( '#//[ \\t]*==/UserScript==#', $line ) )
break;
$matches = Array();
if ( preg_match ( '#^//[ \\t]*(@[a-zA-Z0-9]+)[ \\t]+(.*)$#', $line, $matches ) )
{
$name = $matches[1];
$value = $matches[2];
if ( ! array_key_exists ( $name, $result ) )
{
$result[$name] = $value;
}
}
}
fclose ( $f );
return $result;
}
?>

View File

@ -1,9 +1,7 @@
<h2>IITC Browser Addon</h2>
<?php
if ( $path != "release" )
print "<div class=\"alert alert-block alert-error\"><b>NOTE</b>: the <b>$path</b> build is currently selected. <a href=\"?page=desktop\">Return to the standard build</a>.</div>";
include_once ( "code/desktop-download.php" );
?>
<div class="alert alert-block">
@ -51,16 +49,9 @@ Check your browser documentation for details on installing userscripts.
<h3>Download</h3>
<?php
$iitc_details = loadUserScriptHeader ( "$path/total-conversion-build.user.js" );
$iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1<small class="muted">.\2</small>', $iitc_details['@version'] );
iitcDesktopDownload ( "release" );
?>
<p>
IITC version <?php print $iitc_version;?>
</p>
<a class="btn btn-large btn-primary" onclick="if(track){track('desktop','download','iitc');}" href="<?php print $path;?>/total-conversion-build.user.js">Download</a>
<hr>
@ -71,47 +62,6 @@ Plugins extend/modify the IITC experience. You do <b>not</b> need to install all
a minority of users.
</p>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Name</th>
<th>ID / Version</th>
<th>Description</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<?php
foreach ( glob ( "$path/plugins/*.user.js" ) as $path )
{
$basename = basename ( $path, ".user.js" );
$details = loadUserScriptHeader ( $path );
print "<tr id=\"plugin-$basename\">\n";
# remove 'IITC Plugin: ' prefix if it's there, for neatness
$name = preg_replace ( '/^IITC plugin: /i', '', $details['@name'] );
# format extended version info in less prominant font
$version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1<small class="muted">.\2</small>', $details['@version'] );
# remove unneeded prefix from description
$description = preg_replace ( '/^\[[^]]*\] */', '', $details['@description'] );
print "<td>$name</td>";
print "<td>$basename<br />$version</td>";
print "<td>$description</td>";
print "<td><a onclick=\"if(track){track('desktop','download','iitc-plugin-$basename');}\" href=\"$path\" class=\"btn btn-small btn-primary\">Download</a></td>";
# print "<a href=\"$path\">".$details['@name']."</a> <i>$name - version ".$details['@version']."</i>: <br/>\n";
# print $details['@description'];
print "</tr>\n";
}
iitcDesktopPluginDownloadTable ( "release" );
?>
</tbody>
</table>

63
website/page/test.php Normal file
View File

@ -0,0 +1,63 @@
<h2>Test Builds</h2>
<p>
These test builds are made available for those who would like to try the latest development code without
needing to build it yourself. Automated scripts should update these builds within an hour of a change being
<a href="https://github.com/jonatkins/ingress-intel-total-conversion/commits/master">committed</a> to Github.
</p>
<div class="alert alert-block alert-error">
Test builds are built automatically. They could be <b>broken at any time</b>. If you have any doubts about using
unstable software, please use the standard <a href="?page=desktop">desktop</a> or <a href="?page=mobile">mobile</a>
builds.
</div>
<?php
include_once ( "code/desktop-download.php" );
$path = "test";
if ( $_REQUEST['build'] == 'dev' )
$path = "dev";
if ( $path != "test" )
print "<div class=\"alert alert-block alert-error\"><b>NOTE</b>: A non-standard test build, <b>$path</b>, is currently selected. The notes <b>may not apply!</b> <a href=\"?page=test\">Return to the standard test build</a>.</div>";
$timestamp_file = $path . "/.build-timestamp";
if ( file_exists ( $timestamp_file ) )
{
$build_time = file_get_contents ( $timestamp_file );
print "<div class=\"alert alert-info\">The current test build was built at <b>$build_time</b></div>";
}
else
{
}
?>
<h3 id="test-desktop">Desktop test build</h3>
<?php
iitcDesktopDownload ( $path );
?>
<hr>
<h4>Desktop test plugins</h4>
<?php
iitcDesktopPluginDownloadTable ( $path );
?>
<hr>
<h3 id="test-mobile">Mobile test build</h3>
<p>IITC Mobile version informpation - not currently available for test builds</p>
<a class="btn btn-large btn-primary" href="<?php print $path; ?>/IITC_Mobile-test.apk">Download</a>