-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-package.php
executable file
·122 lines (103 loc) · 2.79 KB
/
generate-package.php
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env php
<?php
ini_set('date.timezone', 'Europe/Berlin');
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$api_version = '0.2.0';
$api_state = 'alpha';
$release_version = '0.2.0';
$release_state = 'alpha';
$release_notes = "Partner support.";
$description = "An API wrapper to retrieve meta data of articles on huffingtonpost.com.";
$package = new PEAR_PackageFileManager2();
$package->setOptions(
array(
'filelistgenerator' => 'file',
'simpleoutput' => true,
'baseinstalldir' => '/',
'packagedirectory' => './',
'dir_roles' => array(
'library' => 'php',
'tests' => 'test',
'docs' => 'doc',
),
'exceptions' => array(
'README.md' => 'doc',
),
'ignore' => array(
'.git*',
'generate-package.php',
'*.tgz',
'phpunit.xml',
)
)
);
$package->setPackage('PEAR2_Services_HuffPo');
$package->setSummary($description);
$package->setDescription($description);
$package->setChannel('easybib.github.com/pear');
$package->setPackageType('php');
$package->setLicense(
'BSD',
'http://www.opensource.org/licenses/bsd-license.php'
);
$package->setNotes($release_notes);
$package->setReleaseVersion($release_version);
$package->setReleaseStability($release_state);
$package->setAPIVersion($api_version);
$package->setAPIStability($api_state);
$package->addMaintainer(
'lead',
'till',
'Till Klampaeckel',
);
/**
* Generate the list of files in {@link $GLOBALS['files']}
*
* @param string $path
*
* @return void
*/
function readDirectory($path) {
foreach (glob($path . '/*') as $file) {
if (!is_dir($file)) {
$GLOBALS['files'][] = $file;
} else {
readDirectory($file);
}
}
}
$files = array();
readDirectory(__DIR__ . '/library');
/**
* @desc Strip this from the filename for 'addInstallAs'
*/
$base = __DIR__ . '/';
foreach ($files as $file) {
$file2 = str_replace($base, '', $file);
$package->addReplacement(
$file2,
'package-info',
'@package_version@',
'version'
);
$file2 = str_replace($base, '', $file);
$package->addInstallAs($file2, str_replace('library/', '', $file2));
}
$package->setPhpDep('5.3.0');
$package->addPackageDepWithChannel(
'required',
'HTTP_Request2',
'pear.php.net'
);
$package->addExtensionDep('required', 'spl');
$package->setPearInstallerDep('1.9.4');
$package->generateContents();
if ( isset($_GET['make'])
|| (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')
) {
$package->writePackageFile();
} else {
$package->debugPackageFile();
}