Ruby detab

From EggeWiki
Revision as of 14:36, 17 August 2006 by Brianegge (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Recently, at my work, a policy has been put into place that all files being checked in need to have a source control header and have spaces instead of tabs. Since we have thousands of files which are out of compliance, I put together a small Ruby script to fix them. I found the script rather useful, so I decided to share it with others. Well, not everyone liked my script as well as me.

I received an email stating my script had been deleted this morning.

... #8 change 53775 delete on 2006/08/17 by tordoffy@tordoffy.unix (kxtext)

        Removed detab, as it is not in an approved language.

To add insult to injury, I was worked until 12:30 AM last night, and returned to work at 7:30 AM this morning. I was working late to fix a problem with a server in the London office. Did the London office thank me for fixing their server last night? No, they deleted my script while I was sleeping.

One might argue that it's normal for an organization to have approved languages. That, I can understand. However, this was a tool which I designed to save me time, and no one else is required to use it or maintain it. It wouldn't even be so bad if we only had a few 'approved' languages. If, I had written my script using one of these languages, I would have been fine:

#!/usr/bin/ksh
#!/usr/bin/sh
#!/usr/lcoal/tcl/bin/destcl
#!/usr/local/bin/bash
#!/usr/local/bin/destcl
#!/usr/local/bin/expect
#!/usr/local/bin/gawk
#!/usr/local/bin/gmake
#!/usr/local/bin/gtcl
#!/usr/local/bin/gtwish
#!/usr/local/bin/perl
#!/usr/local/bin/python
#!/usr/local/bin/tclsh
#!/usr/local/bin/tcsh
#!/usr/local/bin/wish4.0
#!/usr/local/gnu/bin/bash
#!/usr/local/tcl-7.4/bin/destcl
#!/usr/local/tcl-7.4/bin/destk
#!/usr/local/tcl/bin/destcl
#!/usr/local/tcl/bin/destk
#!/usr/local/tcl/bin/tcl
#!/usr/local/tcl/bin/tcldes
#!/usr/local/tcl/bin/wishdes

You can view the source code to this script, or download it.

The html page was created with vim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" detab.rb