[geany/geany] f934d2: Update the `create_php_tags.php` script
Fitorec
git-noreply at xxxxx
Fri Aug 16 05:24:25 UTC 2013
Branch: refs/heads/master
Author: Fitorec <chanerec at gmail.com>
Committer: Matthew Brush <matt at geany.org>
Date: Fri, 16 Aug 2013 05:24:25 UTC
Commit: f934d2cf945dd23e9fe73dc7626719a18c439c26
https://github.com/geany/geany/commit/f934d2cf945dd23e9fe73dc7626719a18c439c26
Log Message:
-----------
Update the `create_php_tags.php` script
* Uses more recent URL (as updated in other PR)
* Downloads the funcsummary.txt file by itself
* Support running the script from any directory
Closes #47
Modified Paths:
--------------
scripts/create_php_tags.php
Modified: scripts/create_php_tags.php
28 files changed, 16 insertions(+), 12 deletions(-)
===================================================================
@@ -1,17 +1,14 @@
#!/usr/bin/php
-
<?php
// Author: Matti Mårds
// License: GPL V2 or later
-
+//
// Script to generate a new php.tags file from a downloaded PHP function summary list from
-// http://svn.php.net/viewvc/phpdoc/doc-base/trunk/funcsummary.txt?view=co
-// The script expects a file funcsummary.txt in /tmp and will write the parsed tags into
-// data/php.tags.
//
-// wget -O funcsummary.txt "http://svn.php.net/viewvc/phpdoc/doc-base/trunk/funcsummary.txt?view=co"
+// http://svn.php.net/repository/phpdoc/doc-base/trunk/funcsummary.txt
//
-// (the script should be run in the top source directory)
+// - The script can be run from any directory
+// - The script downloads the file funcsummary.txt using PHP's stdlib
# (from tagmanager/tm_tag.c:32)
define("TA_NAME", 200);
@@ -23,7 +20,8 @@
define("TYPE_FUNCTION", 128);
// Create an array of the lines in the file
-$file = file('funcsummary.txt');
+$url = 'http://svn.php.net/repository/phpdoc/doc-base/trunk/funcsummary.txt';
+$file = file($url, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// Create template for a tag (tagmanager format)
$tagTpl = "%s%c%d%c%s%c%s";
@@ -31,6 +29,13 @@
// String to store the output
$tagsOutput = array();
+// String data base path for tags.php
+$filePhpTags = implode( DIRECTORY_SEPARATOR,
+ array(
+ dirname(dirname(__FILE__)),
+ 'data',
+ 'php.tags'
+ ));
// Iterate through each line of the file
for($line = 0, $lineCount = count($file); $line < $lineCount; ++$line) {
@@ -54,7 +59,6 @@
}
// $funcDefMatch['funcName'] = str_replace('::', '->', $funcDefMatch['funcName']);
-
$tagsOutput[] = sprintf($tagTpl, $funcDefMatch['funcName'], TA_TYPE, TYPE_FUNCTION,
TA_ARGLIST, $funcDefMatch['params'], TA_VARTYPE, $funcDefMatch['retType']);
}
@@ -65,6 +69,6 @@
// Sort the output
sort($tagsOutput);
-file_put_contents('data/php.tags', join("\n", $tagsOutput));
-
-?>
+file_put_contents($filePhpTags, join("\n", $tagsOutput));
+echo "Created:\n${filePhpTags}\n";
+echo str_repeat('-',75)."\n";
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list