rapid7/metasploit-framework — pull request #2364 by todb-r7 (2013-09-13 15:52:22+00:00)
Title: Update retab util

For `retab.rb`, Instead of just relying on a filename of *.rb, use a file utility to determine file type.

For systems that lack lack 'which' and 'file', fall back to filename matching.

This is useful for retabbing things like 'msfconsole' that don't have a .rb extension.

## Verification

This will demonstrate that retabbing works sensibly for .rb files, files that do parse out as Ruby, and will avoid retabbing non-Ruby files.

### Check that files that parse out as Ruby get retabbed:

- [ ] In the framework top-level, `tools/dev/retab.rb msfconsole`
- [ ] See the return message, `Retabbed msfconsole`
- [ ] `git checkout -- msfconsole` to avoid committing a retabbed msfconsole with this.

### Check that files that end in .rb get retabbed (assumes it's ruby and doesn't bother testing)

- [ ] `echo hello world > test.rb`
- [ ] 'tools/dev/retab.rb test.rb`
- [ ] See the result message, `Retabbed test.rb`
- [ ] `rm test.rb` to clean up your top level dir.

### Check that files that are not parse out as Ruby get retabbed:

- [ ] In the framework top-level, `tools/dev/retab.rb data/vncdll.dll`
- [ ] See no return message.
- [ ] `git status data/` to see that there are no changes.

Once this PR lands, @tabassassin can then retab all of Metasploit without having to name specific files or directories. This will pick up spec, top-level utilities, external libraries, data, etc.