-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pakefile
98 lines (80 loc) · 2.78 KB
/
Pakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/* registration */
pake_import('pear');
pake_desc('release a new mvc_installer version');
pake_task('release');
pake_task('create_package_xml');
/* tasks */
/**
* To be able to include a plugin in pake_runtime.php, you have to use include_once for external dependencies
* and require_once for internal dependencies (for other included PI or pake classes) because we strip
* all require_once statements
*/
function run_create_pear_package()
{
run_create_package_xml();
$_root = dirname(__FILE__);
$options = pakeYaml::loadFile($_root.'/options.yaml');
$version = $options['version'];
$app_file = 'lib/midgardmvc_installer/midgardMvcInstallerApp.class.php';
pake_replace_tokens(
$app_file, $_root,
'const VERSION = \'', '\';',
array(
'1.1.DEV' => "const VERSION = '$version';"
)
);
// run packager
try {
pakePearTask::package_pear_package($_root.'/package.xml', $_root.'/target');
} catch (pakeException $e) {
}
// cleanup
pake_remove('package.xml', $_root);
pake_replace_tokens(
$app_file, $_root, // file
"const VERSION = '", "';", // dividers
array( // tokens
$version => "const VERSION = '1.1.DEV';"
)
);
if (isset($e))
throw $e;
}
function run_create_package_xml()
{
$_root = dirname(__FILE__);
$options = pakeYaml::loadFile($_root.'/options.yaml');
$version = $options['version'];
// create a pear package
pake_echo_comment('creating PEAR package.xml for version "'.$version.'"');
pake_copy($_root.'/package.xml.tmpl', $_root.'/package.xml', array('override' => true));
// add class files
$class_files = pakeFinder::type('file')
->ignore_version_control()
->not_name('/^midgardMvcInstallerApp.class.php$/')
->name('*.php')
->relative()
->in($_root.'/lib');
$xml_classes = '';
foreach ($class_files as $file) {
$dir_name = dirname($file);
$file_name = basename($file);
$xml_classes .= '<file role="php" baseinstalldir="'.$dir_name.'" install-as="'.$file_name.'" name="lib/'.$file.'"/>'."\n";
}
// replace tokens
pake_replace_tokens('package.xml', $_root, '##', '##', array(
'INSTALLER_VERSION' => $version,
'CURRENT_DATE' => date('Y-m-d'),
'CLASS_FILES' => $xml_classes,
));
}
function run_release($task)
{
$_root = dirname(__FILE__);
$options = pakeYaml::loadFile($_root.'/options.yaml');
$version = $options['version'];
if ($task->is_verbose())
pake_echo_comment('releasing mvc_installer version "'.$version.'"');
run_create_pear_package();
}