source: trunk/website/scripts/BuildPublish.php @ 2389

Revision 2389, 1.3 KB checked in by lowjoel, 3 years ago (diff)

Remove the dependency on the Database since we can make do with static information.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1<?php
2/**
3 * Publishes a Bitten build to the public build server.
4 *
5 * @author Joel Low <lowjoel@users.sourceforge.net>
6 * @version $Id$
7 */
8
9if (count($argv) < 4)
10{
11    echo 'There are insufficient arguments for BuildPublish.php.' . "\n\n" .
12        'Usage: BuildPublish.php <branch name> <revision> <installer>';
13    exit(1);
14}
15
16require_once('Credentials.php');
17require_once('BuildBranch.php');
18require_once('BuildUtil.php');
19
20$file = fopen($argv[3], 'rb');
21if (!$file)
22{
23    echo 'The file ' . $argv[3] . ' could not be opened for reading.';
24    exit(1);
25}
26
27try
28{
29    //Generate a filename for the installer.
30    $branches = BuildBranch::Get();
31    if (!array_key_exists($argv[1], $branches))
32        throw new Exception('The branch ' . $argv[1] . ' does not exist.');
33
34    define('SHELL_WEB_ROOT', 'sftp://web.sourceforge.net/home/groups/e/er/eraser/htdocs');
35    define('HTTP_WEB_ROOT', 'http://eraser.sourceforge.net');
36
37    $branch = $branches[$argv[1]];
38    $pathInfo = pathinfo($argv[3]);
39    $fileName = sprintf('Eraser %s.%d.%s', $branch->Version, $argv[2], $pathInfo['extension']);
40    $installerPath = sprintf('/builds/%s/%s', $branch->ID, $fileName);
41
42    //Upload the installer to the URL.
43    Upload(SHELL_WEB_ROOT . $installerPath, $file, $sftp_username, $sftp_password);
44   
45    //Then update our website builds information
46   
47}
48catch (Exception $e)
49{
50    echo $e->getMessage();
51    exit(1);
52}
53
54fclose($file);
55?>
Note: See TracBrowser for help on using the repository browser.