root/trunk/buildscripts/setup.php

Revision 747, 1.2 kB (checked in by knut, 3 years ago)

Added a setup script to automatically install Phing and friends through PEAR

Line 
1<?php
2/**
3 * Setup script for build system. You could run this script to install or upgrade Phing
4 * with dependencies. Please make sure to change the PEAR_CMD constant to how you want
5 * to execute the PEAR installer.
6 *
7 * @author Knut Urdalen
8 */
9
10// Where to find the PEAR installer
11define('PEAR_CMD', 'sudo pear');
12
13// Storing your preferred_state
14$preferred_state = exec(PEAR_CMD.' config-get preferred_state');
15
16// Setting preferred state temporary to development to automatically get all dependencies
17system(PEAR_CMD.' config-set preferred_state devel');
18
19// Ensure that the PEAR channel protocol is updated
20system(PEAR_CMD.' channel-update pear.php.net');
21
22// Ensure that the Phing PEAR channel is added
23system(PEAR_CMD.' channel-discover pear.phing.info');
24
25// and channel protocol is updated
26system(PEAR_CMD.' channel-update pear.phing.info');
27
28// Checking if Phing is already installed
29$result = exec(PEAR_CMD.' info phing/phing');
30if(strstr($result, 'No information found for')) { // Install
31  system(PEAR_CMD.' install --alldeps phing/phing');
32} else { // Try to upgrade
33  system(PEAR_CMD.' upgrade --alldeps phing/phing');
34}
35
36// Setting your preferred state back to what it was
37system(PEAR_CMD.' config-set preferred_state '.$preferred_state);
38
39?>
Note: See TracBrowser for help on using the browser.