? coder-DRUPAL-5.patch
Index: scripts/coder_format/README
===================================================================
RCS file: scripts/coder_format/README
diff -N scripts/coder_format/README
--- scripts/coder_format/README	7 Apr 2007 16:08:33 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-This is a standalone script developed by sun that only concentrates on
-formatting code and the style review.
-
-This is an alternative approach to the coder module.  Having two different
-modules with different approaches is, in some ways an advantage, since each
-becomes - in effect - a unit test upon the other. This is a great way for them
-to both improve, and maintain accuracy in what is a very detail oriented area!
-
-See http://drupal.org/node/126938.
Index: scripts/coder_format/README.txt
===================================================================
RCS file: scripts/coder_format/README.txt
diff -N scripts/coder_format/README.txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scripts/coder_format/README.txt	6 Jun 2007 17:39:32 -0000
@@ -0,0 +1,67 @@
+// $Id$
+
+DESCRIPTION
+-----------
+This is a standalone script developed by sun (http://drupal.org/user/54136) that
+only concentrates on re-formatting code and style review.
+
+Coder Format alters source code files directly. Although this script is
+state-of-the-art, be sure to backup your source files in front of executing this
+script. If executed on a directory, the script automatically creates backup
+copies of all changed files.
+
+This is an alternative approach to the Coder module. Having two different
+modules with different approaches is in some ways an advantage, since each
+becomes - in effect - a unit test upon the other. This is a great way for them
+to both improve, and maintain accuracy in what is a very detail oriented area!
+
+See http://drupal.org/node/126938.
+
+
+USAGE
+-----
+See coder_format.php.
+
+
+INSTALLATION (Windows)
+----------------------
+Coder Format provides a Windows Explorer context menu extension that allows you
+to run Coder Format on single PHP files or complete directory trees.
+
+WARNING: Do not proceed unless you know what you are doing!
+
+- Copy all files of this directory to a central location. If you like to,
+  c:\program files\coder_format\ is okay, too.
+
+- Open coder_format.reg in your preferred editor and replace all instances of
+
+  c:\\program files\\coder_format
+
+  with the path of your chosen central location. Be sure to escape backslashes
+  with another backslash (as shown above).
+
+- "Merge" coder_format.reg into your Windows Registry using the "Merge" command
+  in the context menu.
+
+- Open coder_format.cmd in your preferred editor and replace the path in
+  
+  set coderFormatPath=c:\program files\coder_format
+
+  with the path of your chosen central location. Afterwards, adjust the location
+  of file.inc in
+
+  set fileInc=c:\program files\coder_format\file.inc
+
+  according to your local Drupal installation, i.e.
+
+  set fileInc=c:\inetpub\www\path\to\drupal\includes\file.inc
+
+  It is also possible to copy file.inc from a Drupal 5 installation to the
+  central location and adjust the path accordingly.
+
+- Done. Context menus of PHP files and directories should include the following
+  commands now:
+
+  - Clean Coding Style...
+  - Unclean Coding Style...
+
Index: scripts/coder_format/coder_format-uninstall.reg
===================================================================
RCS file: scripts/coder_format/coder_format-uninstall.reg
diff -N scripts/coder_format/coder_format-uninstall.reg
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scripts/coder_format/coder_format-uninstall.reg	6 Jun 2007 17:50:41 -0000
@@ -0,0 +1,10 @@
+Windows Registry Editor Version 5.00
+
+[-HKEY_CLASSES_ROOT\phpfile\shell\coder_format]
+
+[-HKEY_CLASSES_ROOT\Directory\shell\coder_format]
+[-HKEY_CLASSES_ROOT\Directory\shell\coder_format_undo]
+
+[-HKEY_CLASSES_ROOT\Folder\shell\coder_format]
+[-HKEY_CLASSES_ROOT\Folder\shell\coder_format_undo]
+
Index: scripts/coder_format/coder_format.cmd
===================================================================
RCS file: scripts/coder_format/coder_format.cmd
diff -N scripts/coder_format/coder_format.cmd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scripts/coder_format/coder_format.cmd	6 Jun 2007 17:46:03 -0000
@@ -0,0 +1,52 @@
+@echo off
+rem $Id$
+
+rem Define Coder Format shell invocation script path.
+set coderFormatPath=c:\program files\coder_format
+rem Define location of Drupal's file.inc.
+set fileInc=c:\program files\coder_format\file.inc
+
+
+:: ----- You should not need to edit anything below. ----- ::
+
+set oldpwd=%CD%
+cd /d "%coderFormatPath%"
+
+rem Simple file extension check, won't work with directories containing a dot.
+if '%1'=='--undo' goto undo-directory
+if '%~x1'=='' goto directory
+goto file
+
+:undo-directory
+rem Undo source code formattings performed by --batch-replace
+rem Process directory.
+if "%~2"=="" goto :EOF
+start "coder_format" /D "%coderFormatPath%" /B /WAIT php coder_format.php --undo "%~2" --file-inc "%fileInc%"
+goto processed
+
+:directory
+rem Recursively format all source code files in a directory.
+rem Process directory.
+if "%~1"=="" goto :EOF
+start "coder_format" /D "%coderFormatPath%" /B /WAIT php coder_format.php --batch-replace "%~1" --file-inc "%fileInc%"
+goto processed
+
+:file
+rem Format a single source code file.
+rem Define source and target files by command line arguments.
+set sourcefile=%~1
+if not '%~2'=='' (
+	set targetfile=%~2
+) else (
+	set targetfile=%~1
+)
+rem Process file.
+if "%sourcefile%"=="" goto :EOF
+if "%targetfile%"=="" goto :EOF
+start "coder_format" /D "%coderFormatPath%" /B /WAIT php coder_format.php "%sourcefile%" "%targetfile%" --file-inc "%fileInc%"
+
+
+:processed
+rem Jump back to original working directory.
+cd /d "%oldpwd%"
+
Index: scripts/coder_format/coder_format.reg
===================================================================
RCS file: scripts/coder_format/coder_format.reg
diff -N scripts/coder_format/coder_format.reg
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ scripts/coder_format/coder_format.reg	6 Jun 2007 17:50:31 -0000
@@ -0,0 +1,32 @@
+Windows Registry Editor Version 5.00
+
+[HKEY_CLASSES_ROOT\phpfile\shell\coder_format]
+@="&Clean Coding Style..."
+
+[HKEY_CLASSES_ROOT\phpfile\shell\coder_format\command]
+@="c:\\program files\\coder_format\\coder_format.cmd \"%1\""
+
+[HKEY_CLASSES_ROOT\Directory\shell\coder_format]
+@="&Clean Coding Style..."
+
+[HKEY_CLASSES_ROOT\Directory\shell\coder_format\command]
+@="c:\\program files\\coder_format\\coder_format.cmd \"%1\""
+
+[HKEY_CLASSES_ROOT\Directory\shell\coder_format_undo]
+@="&Unclean Coding Style..."
+
+[HKEY_CLASSES_ROOT\Directory\shell\coder_format_undo\command]
+@="c:\\program files\\coder_format\\coder_format.cmd --undo \"%1\""
+
+[HKEY_CLASSES_ROOT\Folder\shell\coder_format]
+@="&Clean Coding Style..."
+
+[HKEY_CLASSES_ROOT\Folder\shell\coder_format\command]
+@="c:\\program files\\coder_format\\coder_format.cmd \"%1\""
+
+[HKEY_CLASSES_ROOT\Folder\shell\coder_format_undo]
+@="&Unclean Coding Style..."
+
+[HKEY_CLASSES_ROOT\Folder\shell\coder_format_undo\command]
+@="c:\\program files\\coder_format\\coder_format.cmd --undo \"%1\""
+
