List:Commits« Previous MessageNext Message »
From:jon Date:July 15 2008 11:24am
Subject:svn commit - mysqldoc@docsrva: r11248 - trunk/tools
View as plain text  
Author: jstephens
Date: 2008-07-15 11:24:34 +0200 (Tue, 15 Jul 2008)
New Revision: 11248

Log:

Quick and dirty tool to sort renamed-nodes.txt entries



Added:
   trunk/tools/sort-renames

Property changes on: trunk/tools/sort-renames
___________________________________________________________________
Name: svn:executable
   + *


Added: trunk/tools/sort-renames
===================================================================
--- trunk/tools/sort-renames	                        (rev 0)
+++ trunk/tools/sort-renames	2008-07-15 09:24:34 UTC (rev 11248)
Changed blocks: 1, Lines Added: 57, Lines Deleted: 0; 1773 bytes

@@ -0,0 +1,57 @@
+#!/usr/bin/php
+<?php
+  /*  sort-renames
+
+      A quick-and-dirty PHP script to sort the entries in a
+      renamed-nodes.txt file into alphabetical order
+
+      Jon Stephens (jon@stripped), 2008-07-15
+
+      *Usage*
+
+      sort-renames $dirname
+
+      where $dirname is the name of the directory containing the
+      renamed-nodes.txt file to be sorted. $dirname should not include
+      any path information.
+
+      sort-renames must be run from the tools directory. It expects to
+      find the name of the file to be sorted as
+      '../$dirname/renamed-nodes.txt'.
+*/
+
+  if(strpos(getcwd(), 'tools') === FALSE)
+    exit("This script must be run from the 'tools' directory.\n");
+
+  if($argc <= 1)
+    exit("Please provide the name of the directory where the "
+       . "'renamed-nodes.txt' file is located. "
+       . " E.g.:\n\nsort-renames refman-4.1\n\n");
+
+  if(in_array($argv[1], array('-h', '-?', '--help')))
+    exit("Read the source, Luke!\n");
+
+  $name = "../$argv[1]/renamed-nodes.txt";
+
+  $lines = file($name);
+
+  $comments = array();
+  $renames = array();
+
+  foreach($lines as $line)
+  {
+    if(substr($line, 0, 1) == '#')
+      $comments[]= $line;
+    else
+      $renames[]= $line;
+  }
+
+  sort($renames);
+
+  $newlines = array_merge($comments, $renames);
+
+  $newfile = fopen("$name", 'w');
+  fwrite($newfile, implode($newlines));
+  fclose($newfile);
+
+?>
\ No newline at end of file


Property changes on: trunk/tools/sort-renames
___________________________________________________________________
Name: svn:executable
   + *


Thread
svn commit - mysqldoc@docsrva: r11248 - trunk/toolsjon15 Jul