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