]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/bin/pearpackage3.php
removed community home addon
[friendica-addons.git] / dav / SabreDAV / bin / pearpackage3.php
1 #!/usr/bin/env php
2 <?php
3
4 date_default_timezone_set('UTC');
5
6 $make = false;
7 $packageName = null;
8
9 foreach($argv as $index=>$arg) {
10     if ($index==0) continue;
11     if ($arg=='make') {
12         $make = true;
13         continue;
14     }
15
16     $packageName = $arg;
17 }
18
19 if (is_null($packageName)) {
20     echo "A packagename is required\n";
21     die(1);
22 }
23
24 if (!is_dir('build/' . $packageName)) {
25     echo "Could not find package directory: build/$packageName\n";
26     die(2);
27 }
28
29 // We'll figure out something better for this one day
30
31 $dependencies = array(
32     array(
33         'type' => 'php',
34         'min'  => '5.3.1',
35     ),
36     array(
37         'type' => 'pearinstaller',
38         'min'  => '1.9',
39     ),
40 );
41
42
43 switch($packageName) {
44
45     case 'Sabre' :
46         $summary = 'Sabretooth base package.';
47         $description = <<<TEXT
48 The base package provides some functionality used by all packages.
49
50 Currently this is only an autoloader
51 TEXT;
52         $version = '1.0.0';
53         $stability = 'stable';
54         break;
55
56     case 'Sabre_DAV' :
57         $summary = 'Sabre_DAV is a WebDAV framework for PHP.';
58         $description = <<<TEXT
59 SabreDAV allows you to easily integrate WebDAV access into your existing PHP application.
60
61 Feature List:
62 * Fully WebDAV (class 1, 2, 3) compliant
63 * Supports Windows clients, OS/X, DavFS, Cadaver, and pretty much everything we've come accross
64 * Custom property support
65 * RFC4918-compliant
66 * Authentication support
67 * Plugin system
68 TEXT;
69         $dependencies[] = array(
70             'type' => 'package',
71             'name' => 'Sabre',
72             'channel' => 'pear.sabredav.org',
73             'min'  => '1.0.0',
74         );
75         $dependencies[] = array(
76             'type' => 'package',
77             'name' => 'Sabre_HTTP',
78             'channel' => 'pear.sabredav.org',
79             'min'  => '1.6.0',
80         );
81
82         break;
83
84     case 'Sabre_HTTP' :
85         $summary = 'Sabre_HTTP provides various HTTP helpers, for input and output and authentication';
86         $description = <<<TEXT
87 Sabre_HTTP effectively wraps around \$_SERVER, php://input, php://output and the headers method,
88 allowing for a central interface to deal with this as well as easier unittesting.
89
90 In addition Sabre_HTTP provides classes for Basic, Digest and Amazon AWS authentication.
91 TEXT;
92         $dependencies[] = array(
93             'type' => 'package',
94             'name' => 'Sabre',
95             'channel' => 'pear.sabredav.org',
96             'min'  => '1.0.0',
97         );
98         break;
99
100     case 'Sabre_DAVACL' :
101         $summary = 'Sabre_DAVACL provides rfc3744 support.';
102         $description = <<<TEXT
103 Sabre_DAVACL is the RFC3744 implementation for SabreDAV. It provides principals
104 (users and groups) and access control.
105 TEXT;
106         $dependencies[] = array(
107             'type' => 'package',
108             'name' => 'Sabre',
109             'channel' => 'pear.sabredav.org',
110             'min'  => '1.0.0',
111         );
112         $dependencies[] = array(
113             'type' => 'package',
114             'name' => 'Sabre_DAV',
115             'channel' => 'pear.sabredav.org',
116             'min'  => '1.6.0',
117         );
118         break;
119
120     case 'Sabre_CalDAV' :
121         $summary = 'Sabre_CalDAV provides CalDAV extensions to SabreDAV';
122         $description = <<<TEXT
123 Sabre_CalDAV provides RFC4791 (CalDAV) support to Sabre_DAV.
124
125 Feature list:
126 * Multi-user Calendar Server
127 * Support for Apple iCal, Evolution, Sunbird, Lightning
128 TEXT;
129
130         $dependencies[] = array(
131             'type' => 'package',
132             'name' => 'Sabre',
133             'channel' => 'pear.sabredav.org',
134             'min'  => '1.0.0',
135         );
136         $dependencies[] = array(
137             'type' => 'package',
138             'name' => 'Sabre_HTTP',
139             'channel' => 'pear.sabredav.org',
140             'min'  => '1.6.0',
141         );
142         $dependencies[] = array(
143             'type' => 'package',
144             'name' => 'Sabre_DAV',
145             'channel' => 'pear.sabredav.org',
146             'min'  => '1.6.0',
147         );
148         $dependencies[] = array(
149             'type' => 'package',
150             'name' => 'Sabre_DAVACL',
151             'channel' => 'pear.sabredav.org',
152             'min'  => '1.6.0',
153         );
154         $dependencies[] = array(
155             'type' => 'package',
156             'name' => 'Sabre_VObject',
157             'channel' => 'pear.sabredav.org',
158             'min'  => '1.3.0',
159         );
160         break;
161
162     case 'Sabre_CardDAV' :
163         $summary = 'Sabre_CardDAV provides CardDAV extensions to SabreDAV';
164         $description = <<<TEXT
165 Sabre_CardDAV provides CardDAV support to Sabre_DAV.
166
167 Feature list:
168 * Multi-user addressbook server
169 * ACL support
170 * Support for OS/X, iOS, Evolution and probably more
171 * Hook-ins for creating a global \'directory\'.
172 TEXT;
173
174         $dependencies[] = array(
175             'type' => 'package',
176             'name' => 'Sabre',
177             'channel' => 'pear.sabredav.org',
178             'min'  => '1.0.0',
179         );
180         $dependencies[] = array(
181             'type' => 'package',
182             'name' => 'Sabre_HTTP',
183             'channel' => 'pear.sabredav.org',
184             'min'  => '1.6.0',
185         );
186         $dependencies[] = array(
187             'type' => 'package',
188             'name' => 'Sabre_DAV',
189             'channel' => 'pear.sabredav.org',
190             'min'  => '1.6.0',
191         );
192         $dependencies[] = array(
193             'type' => 'package',
194             'name' => 'Sabre_DAVACL',
195             'channel' => 'pear.sabredav.org',
196             'min'  => '1.6.0',
197         );
198         $dependencies[] = array(
199             'type' => 'package',
200             'name' => 'Sabre_VObject',
201             'channel' => 'pear.sabredav.org',
202             'min'  => '1.3.0',
203         );
204         break;
205
206     case 'Sabre_VObject' :
207         $summary = 'Sabre_VObject is a natural-interface iCalendar and vCard reader';
208         $description = <<<TEXT
209 Sabre_VObject is an intuitive reader for iCalendar and vCard objects.
210
211 It provides a natural array/object accessor interface to the parsed tree, much like
212 simplexml for XML files.
213 TEXT;
214         $dependencies[] = array(
215             'type' => 'package',
216             'name' => 'Sabre',
217             'channel' => 'pear.sabredav.org',
218             'min'  => '1.0.0',
219         );
220         break;
221
222 }
223
224
225 if (!isset($version)) {
226     include 'lib/' . str_replace('_','/',$packageName) . '/Version.php';
227     $versionClassName = $packageName . '_Version';
228     $version = $versionClassName::VERSION;
229     $stability = $versionClassName::STABILITY;
230 }
231
232 $lead = 'Evert Pot';
233 $lead_email = 'evert@rooftopsolutions.nl';
234 $date = date('Y-m-d');
235
236 $license = 'Modified BSD';
237 $licenseuri = 'http://code.google.com/p/sabredav/wiki/License';
238 $notes = 'New release. Read the ChangeLog and announcement for more details';
239 $channel = 'pear.sabredav.org';
240
241 /* This function is intended to generate the full file list */
242 function parsePath($fullPath, $role, $padding = 4) {
243
244     $fileList = '';
245     $file = basename($fullPath);
246     if (is_dir($fullPath)) {
247         $fileList .= str_repeat(' ', $padding) . "<dir name=\"{$file}\">\n";
248         foreach(scandir($fullPath) as $subPath) {;
249             if ($subPath==='.' || $subPath==='..') continue;
250             $fileList .= parsePath($fullPath. '/' . $subPath,$role, $padding+2);
251         }
252         $fileList .= str_repeat(' ', $padding) . "</dir><!-- {$file} -->\n";
253     } elseif (is_file($fullPath)) {
254         $fileList .= str_repeat(' ', $padding) . "<file name=\"{$file}\" role=\"{$role}\" />\n";
255     }
256
257     return $fileList;
258
259 }
260
261 $rootDir = realpath('build/' . $packageName);
262
263 $fileList  = parsePath($rootDir . '/Sabre', 'php');
264 $fileList .= parsePath($rootDir . '/examples', 'doc');
265 $fileList .= parsePath($rootDir . '/ChangeLog', 'doc');
266 $fileList .= parsePath($rootDir . '/LICENSE', 'doc');
267
268 $dependenciesXML = "\n";
269 foreach($dependencies as $dep) {
270     $pad = 8;
271     $dependenciesXML.=str_repeat(' ',$pad) . '<' . $dep['type'] . ">\n";
272     foreach($dep as $key=>$value) {
273         if ($key=='type') continue;
274         $dependenciesXML.=str_repeat(' ',$pad+2) . "<$key>$value</$key>\n";
275     }
276     $dependenciesXML.=str_repeat(' ',$pad) . '</' . $dep['type'] . ">\n";
277 }
278
279 $package = <<<XML
280 <?xml version="1.0"?>
281 <package version="2.0"
282     xmlns="http://pear.php.net/dtd/package-2.0">
283
284     <name>{$packageName}</name>
285     <channel>{$channel}</channel>
286     <summary>{$summary}</summary>
287     <description>{$description}</description>
288     <lead>
289       <name>{$lead}</name>
290       <user>{$lead}</user>
291       <email>{$lead_email}</email>
292       <active>true</active>
293     </lead>
294     <date>{$date}</date>
295     <version>
296       <release>{$version}</release>
297       <api>{$version}</api>
298     </version>
299     <stability>
300       <release>{$stability}</release>
301       <api>{$stability}</api>
302     </stability>
303     <license uri="{$licenseuri}">{$license}</license>
304     <notes>{$notes}</notes>
305     <contents>
306       <dir name="/">{$fileList}
307       </dir>
308     </contents>
309     <dependencies>
310       <required>{$dependenciesXML}
311       </required>
312     </dependencies>
313     <phprelease />
314 </package>
315 XML;
316
317 if (isset($argv) && in_array('make',$argv)) {
318     file_put_contents($rootDir . '/package.xml',$package);
319 } else {
320     echo $package;
321 }