root/trunk/make-standalone.php

Revision 321, 2.4 KB (checked in by john, 3 years ago)

added make standalone script

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#! /usr/local/bin/php
2<?php
3/**
4 *  Make a standalone ready to go PHPonTrax application
5 *
6 *  (PHP 5)
7 *
8 *  Simply run <b>php make-standalone.php</b>.
9 *  Once ran this script will generate a folder "trax-standalone" and a tar file of that folder.
10 *  That folder is the standalone version that you can used to build an app just as if you ran
11 *  the "trax ." command and generated a fresh app.
12 *
13 *  This script is mainly for me to make the standalone version easily, but included
14 *  it for anyone that wants to play with it.
15 *
16 *  Required to use this is Unix-type system (I think), wget, tar, svn, PHPonTrax already installed.
17 *
18 *  @package PHPonTrax
19 *  @version $Id$
20 */
21
22echo "cleaning up old builds of trax-standalone\n";
23exec("rm -Rf trax-standalone*");
24echo "creating folder trax-standalone\n";
25mkdir("trax-standalone");
26
27if(!is_dir("trax-standalone")) {
28    echo "no trax-standalone dir\n";
29    exit;
30}
31
32chdir("trax-standalone");
33
34echo "creating trax skeleton files\n";
35exec("trax ".dirname(__FILE__)."/trax-standalone");
36
37echo "fetching README\n";
38exec("wget http://www.phpontrax.com/downloads/README-standalone.txt");
39rename("README-standalone.txt", "README");
40 
41chdir("vendor");
42echo "fetching PEAR files\n";
43exec("wget http://www.phpontrax.com/downloads/PEAR.tar.gz");
44echo "untarring PEAR files\n";
45exec("tar zxvf PEAR.tar.gz");
46echo "removing PEAR tar file.\n";
47unlink("PEAR.tar.gz");
48echo "checking out edge Trax from svn\n";
49exec("svn co svn://svn.phpontrax.com/trax/trunk/trax/vendor/trax trax");
50
51chdir("../");
52echo "updating config files\n";
53$htaccess = file_get_contents("./public/.htaccess");
54file_put_contents("./public/.htaccess", str_replace(dirname(__FILE__)."/trax-standalone/config", "/home/username/trax/config", $htaccess));
55$environment = file_get_contents("./config/environment.php");
56$environment = str_replace("# define(\"PHP_LIB_ROOT\",    \"/usr/local/lib/php\");", "define(\"PHP_LIB_ROOT\",    dirname(dirname(__FILE__)).\"/vendor/PEAR\");", $environment);
57$environment = str_replace("# define(\"TRAX_ROOT\",       dirname(dirname(__FILE__)));", "define(\"TRAX_ROOT\",       dirname(dirname(__FILE__)));", $environment);
58file_put_contents("./config/environment.php", $environment);
59include("./vendor/trax/trax.php");
60$version = Trax::version();
61chdir("../");
62exec("tar zcvf trax-standalone-".$version.".tar.gz trax-standalone");
63
64echo "done creating standalone Trax\n";
65
66?>
Note: See TracBrowser for help on using the browser.