Редакция 69 | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS
Редакция | Автор | № строки | Строка |
---|---|---|---|
69 | alex-w | 1 | <?php |
2 | /** |
||
3 | * PEAR_Command_Auth (build command) |
||
4 | * |
||
5 | * PHP versions 4 and 5 |
||
6 | * |
||
7 | * LICENSE: This source file is subject to version 3.0 of the PHP license |
||
8 | * that is available through the world-wide-web at the following URI: |
||
9 | * http://www.php.net/license/3_0.txt. If you did not receive a copy of |
||
10 | * the PHP License and are unable to obtain it through the web, please |
||
11 | * send a note to license@php.net so we can mail you a copy immediately. |
||
12 | * |
||
13 | * @category pear |
||
14 | * @package PEAR |
||
15 | * @author Stig Bakken <ssb@php.net> |
||
16 | * @author Tomas V.V.Cox <cox@idecnet.com> |
||
17 | * @author Greg Beaver <cellog@php.net> |
||
18 | * @copyright 1997-2008 The PHP Group |
||
19 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
||
20 | * @version CVS: $Id: Build.php,v 1.14 2008/01/03 20:26:36 cellog Exp $ |
||
21 | * @link http://pear.php.net/package/PEAR |
||
22 | * @since File available since Release 0.1 |
||
23 | */ |
||
24 | |||
25 | /** |
||
26 | * base class |
||
27 | */ |
||
28 | require_once 'PEAR/Command/Common.php'; |
||
29 | |||
30 | /** |
||
31 | * PEAR commands for building extensions. |
||
32 | * |
||
33 | * @category pear |
||
34 | * @package PEAR |
||
35 | * @author Stig Bakken <ssb@php.net> |
||
36 | * @author Tomas V.V.Cox <cox@idecnet.com> |
||
37 | * @author Greg Beaver <cellog@php.net> |
||
38 | * @copyright 1997-2008 The PHP Group |
||
39 | * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
||
40 | * @version Release: 1.7.2 |
||
41 | * @link http://pear.php.net/package/PEAR |
||
42 | * @since Class available since Release 0.1 |
||
43 | */ |
||
44 | class PEAR_Command_Build extends PEAR_Command_Common |
||
45 | { |
||
46 | // {{{ properties |
||
47 | |||
48 | var $commands = array( |
||
49 | 'build' => array( |
||
50 | 'summary' => 'Build an Extension From C Source', |
||
51 | 'function' => 'doBuild', |
||
52 | 'shortcut' => 'b', |
||
53 | 'options' => array(), |
||
54 | 'doc' => '[package.xml] |
||
55 | Builds one or more extensions contained in a package.' |
||
56 | ), |
||
57 | ); |
||
58 | |||
59 | // }}} |
||
60 | |||
61 | // {{{ constructor |
||
62 | |||
63 | /** |
||
64 | * PEAR_Command_Build constructor. |
||
65 | * |
||
66 | * @access public |
||
67 | */ |
||
68 | function PEAR_Command_Build(&$ui, &$config) |
||
69 | { |
||
70 | parent::PEAR_Command_Common($ui, $config); |
||
71 | } |
||
72 | |||
73 | // }}} |
||
74 | |||
75 | // {{{ doBuild() |
||
76 | |||
77 | function doBuild($command, $options, $params) |
||
78 | { |
||
79 | require_once 'PEAR/Builder.php'; |
||
80 | if (sizeof($params) < 1) { |
||
81 | $params[0] = 'package.xml'; |
||
82 | } |
||
83 | $builder = &new PEAR_Builder($this->ui); |
||
84 | $this->debug = $this->config->get('verbose'); |
||
85 | $err = $builder->build($params[0], array(&$this, 'buildCallback')); |
||
86 | if (PEAR::isError($err)) { |
||
87 | return $err; |
||
88 | } |
||
89 | return true; |
||
90 | } |
||
91 | |||
92 | // }}} |
||
93 | // {{{ buildCallback() |
||
94 | |||
95 | function buildCallback($what, $data) |
||
96 | { |
||
97 | if (($what == 'cmdoutput' && $this->debug > 1) || |
||
98 | ($what == 'output' && $this->debug > 0)) { |
||
99 | $this->ui->outputData(rtrim($data), 'build'); |
||
100 | } |
||
101 | } |
||
102 | |||
103 | // }}} |
||
104 | } |