This repository has been archived by the owner on Aug 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-package.php
executable file
·135 lines (115 loc) · 3.27 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
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env php
<?php
ini_set('date.timezone', 'Europe/Berlin');
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$api_version = '0.7.0';
$api_state = 'beta';
$release_version = '0.7.0';
$release_state = 'beta';
$release_notes = "Refactored error handling.";
$summary = "A Memcache-MySQL-based session handler for Zend Framework (1)";
$description = "Lagged_Session_SaveHandler_Memcache is a session handler for the Zend Framework (1) which supports: \n"
. " * Memcached (via ext/memcache) as a primary backend\n"
. " * MySQL (via ext/mysqli with mysqlnd) for backup\n";
$package = new PEAR_PackageFileManager2();
$package->setOptions(
array(
'filelistgenerator' => 'file',
'simpleoutput' => true,
'baseinstalldir' => '/',
'packagedirectory' => './',
'dir_roles' => array(
'src' => 'php',
'tests' => 'test',
'docs' => 'doc',
'var' => 'data',
),
'exceptions' => array(
'README.md' => 'doc',
),
'ignore' => array(
'.git*',
'.idea*',
'.vagrant',
'Vagrantfile',
'vendor/',
'generate-package.php',
'phpunit.xml',
'composer.*',
'*.tgz',
)
)
);
$package->setPackage('Lagged_Session_SaveHandler_Memcache');
$package->setSummary($summary);
$package->setDescription($description);
$package->setChannel('easybib.github.com/pear');
$package->setPackageType('php');
$package->setLicense(
'New BSD License',
'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__ . '/src');
/**
* @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('src/', '', $file2));
}
$package->setPhpDep('5.2.0');
$package->addPackageDepWithChannel(
'optional',
'ZF',
'pear.zfcampus.org',
'1.11.11'
);
$package->addExtensionDep('required', 'spl');
$package->addExtensionDep('required', 'memcache');
$package->addExtensionDep('required', 'mysqli');
$package->setPearInstallerDep('1.9.4');
$package->generateContents();
if ( isset($_GET['make'])
|| (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')
) {
$package->writePackageFile();
} else {
$package->debugPackageFile();
}