mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
e249d9ebe5
git-svn-id: file:///home/svn/incoming/trunk@3450 4d416f70-5f16-0410-b530-b9f4589650da
26 lines
535 B
Ruby
Executable File
26 lines
535 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
##
|
|
# Convert a ruby source file from space to tab indentation
|
|
# XXX - This program is dumb, it doesn't know about heredocs,
|
|
# multiline strings, or anything remotely fancy!
|
|
##
|
|
|
|
fd = STDIN
|
|
input = ARGV.shift
|
|
fd = File.open(input, "r") if input
|
|
tbuff = ''
|
|
etabs = 4
|
|
|
|
# Replace the leading spaces with equivalent tab characters
|
|
fd.each_line do |line|
|
|
line.sub!(/^\x20+/) do |m|
|
|
spaces = m.length
|
|
while (spaces % etabs != 0); spaces -= 1; end;
|
|
"\t" * (spaces / etabs)
|
|
end
|
|
tbuff << line
|
|
end
|
|
|
|
puts tbuff
|