| #!/usr/bin/perl -w |
| |
| # Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions |
| # are met: |
| # |
| # 1. Redistributions of source code must retain the above copyright |
| # notice, this list of conditions and the following disclaimer. |
| # 2. Redistributions in binary form must reproduce the above copyright |
| # notice, this list of conditions and the following disclaimer in the |
| # documentation and/or other materials provided with the distribution. |
| # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
| # its contributors may be used to endorse or promote products derived |
| # from this software without specific prior written permission. |
| # |
| # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| # Script to do a rename in JavaScriptCore, WebCore, and WebKit. |
| |
| use strict; |
| use FindBin; |
| use lib $FindBin::Bin; |
| use webkitdirs; |
| use File::Find; |
| use VCSUtils; |
| |
| setConfiguration(); |
| chdirWebKit(); |
| |
| my %words; |
| |
| # find all files we want to process |
| |
| my @paths; |
| find(\&wanted, "JavaScriptCore"); |
| find(\&wanted, "JavaScriptGlue"); |
| find(\&wanted, "WebCore"); |
| find(\&wanted, "WebKit"); |
| |
| sub wanted |
| { |
| my $file = $_; |
| |
| if ($file eq "icu") { |
| $File::Find::prune = 1; |
| return; |
| } |
| |
| if ($file =~ /^\../) { |
| $File::Find::prune = 1; |
| return; |
| } |
| |
| return if $file =~ /^ChangeLog/; |
| return if -d $file; |
| |
| push @paths, $File::Find::name; |
| } |
| my $isDOMTypeRename = 1; |
| my %renames = ( |
| "CanvasActiveInfo" => "WebGLActiveInfo", |
| "canvasActiveInfo" => "webGLActiveInfo", |
| "CanvasActiveInfoConstructor" => "WebGLActiveInfoConstructor", |
| "CanvasActiveInfoPrototype" => "WebGLActiveInfoPrototype", |
| "toCanvasActiveInfo" => "toWebGLActiveInfo", |
| "JSCanvasActiveInfo" => "JSWebGLActiveInfo", |
| "JSCanvasActiveInfoPrototype" => "JSWebGLActiveInfoPrototype", |
| "JSCanvasActiveInfoConstructor" => "JSWebGLActiveInfoConstructor", |
| "JSCanvasActiveInfoCustom" => "JSWebGLActiveInfoCustom", |
| "V8CanvasActiveInfo" => "V8WebGLActiveInfo", |
| "V8CanvasActiveInfoPrototype" => "V8WebGLActiveInfoPrototype", |
| "V8CanvasActiveInfoConstructor" => "V8WebGLActiveInfoConstructor", |
| "V8CanvasActiveInfoCustom" => "V8WebGLActiveInfoCustom", |
| "CanvasArray" => "WebGLArray", |
| "canvasArray" => "webGLArray", |
| "CanvasArrayConstructor" => "WebGLArrayConstructor", |
| "CanvasArrayPrototype" => "WebGLArrayPrototype", |
| "toCanvasArray" => "toWebGLArray", |
| "JSCanvasArray" => "JSWebGLArray", |
| "JSCanvasArrayPrototype" => "JSWebGLArrayPrototype", |
| "JSCanvasArrayConstructor" => "JSWebGLArrayConstructor", |
| "JSCanvasArrayCustom" => "JSWebGLArrayCustom", |
| "V8CanvasArray" => "V8WebGLArray", |
| "V8CanvasArrayPrototype" => "V8WebGLArrayPrototype", |
| "V8CanvasArrayConstructor" => "V8WebGLArrayConstructor", |
| "V8CanvasArrayCustom" => "V8WebGLArrayCustom", |
| "CanvasArrayBuffer" => "WebGLArrayBuffer", |
| "canvasArrayBuffer" => "webGLArrayBuffer", |
| "CanvasArrayBufferConstructor" => "WebGLArrayBufferConstructor", |
| "CanvasArrayBufferPrototype" => "WebGLArrayBufferPrototype", |
| "toCanvasArrayBuffer" => "toWebGLArrayBuffer", |
| "JSCanvasArrayBuffer" => "JSWebGLArrayBuffer", |
| "JSCanvasArrayBufferPrototype" => "JSWebGLArrayBufferPrototype", |
| "JSCanvasArrayBufferConstructor" => "JSWebGLArrayBufferConstructor", |
| "JSCanvasArrayBufferCustom" => "JSWebGLArrayBufferCustom", |
| "V8CanvasArrayBuffer" => "V8WebGLArrayBuffer", |
| "V8CanvasArrayBufferPrototype" => "V8WebGLArrayBufferPrototype", |
| "V8CanvasArrayBufferConstructor" => "V8WebGLArrayBufferConstructor", |
| "V8CanvasArrayBufferCustom" => "V8WebGLArrayBufferCustom", |
| "CanvasBuffer" => "WebGLBuffer", |
| "canvasBuffer" => "webGLBuffer", |
| "CanvasBufferConstructor" => "WebGLBufferConstructor", |
| "CanvasBufferPrototype" => "WebGLBufferPrototype", |
| "toCanvasBuffer" => "toWebGLBuffer", |
| "JSCanvasBuffer" => "JSWebGLBuffer", |
| "JSCanvasBufferPrototype" => "JSWebGLBufferPrototype", |
| "JSCanvasBufferConstructor" => "JSWebGLBufferConstructor", |
| "JSCanvasBufferCustom" => "JSWebGLBufferCustom", |
| "V8CanvasBuffer" => "V8WebGLBuffer", |
| "V8CanvasBufferPrototype" => "V8WebGLBufferPrototype", |
| "V8CanvasBufferConstructor" => "V8WebGLBufferConstructor", |
| "V8CanvasBufferCustom" => "V8WebGLBufferCustom", |
| "CanvasByteArray" => "WebGLByteArray", |
| "canvasByteArray" => "webGLByteArray", |
| "CanvasByteArrayConstructor" => "WebGLByteArrayConstructor", |
| "CanvasByteArrayPrototype" => "WebGLByteArrayPrototype", |
| "toCanvasByteArray" => "toWebGLByteArray", |
| "JSCanvasByteArray" => "JSWebGLByteArray", |
| "JSCanvasByteArrayPrototype" => "JSWebGLByteArrayPrototype", |
| "JSCanvasByteArrayConstructor" => "JSWebGLByteArrayConstructor", |
| "JSCanvasByteArrayCustom" => "JSWebGLByteArrayCustom", |
| "V8CanvasByteArray" => "V8WebGLByteArray", |
| "V8CanvasByteArrayPrototype" => "V8WebGLByteArrayPrototype", |
| "V8CanvasByteArrayConstructor" => "V8WebGLByteArrayConstructor", |
| "V8CanvasByteArrayCustom" => "V8WebGLByteArrayCustom", |
| "CanvasFloatArray" => "WebGLFloatArray", |
| "canvasFloatArray" => "webGLFloatArray", |
| "CanvasFloatArrayConstructor" => "WebGLFloatArrayConstructor", |
| "CanvasFloatArrayPrototype" => "WebGLFloatArrayPrototype", |
| "toCanvasFloatArray" => "toWebGLFloatArray", |
| "JSCanvasFloatArray" => "JSWebGLFloatArray", |
| "JSCanvasFloatArrayPrototype" => "JSWebGLFloatArrayPrototype", |
| "JSCanvasFloatArrayConstructor" => "JSWebGLFloatArrayConstructor", |
| "JSCanvasFloatArrayCustom" => "JSWebGLFloatArrayCustom", |
| "V8CanvasFloatArray" => "V8WebGLFloatArray", |
| "V8CanvasFloatArrayPrototype" => "V8WebGLFloatArrayPrototype", |
| "V8CanvasFloatArrayConstructor" => "V8WebGLFloatArrayConstructor", |
| "V8CanvasFloatArrayCustom" => "V8WebGLFloatArrayCustom", |
| "CanvasFramebuffer" => "WebGLFramebuffer", |
| "canvasFramebuffer" => "webGLFramebuffer", |
| "CanvasFramebufferConstructor" => "WebGLFramebufferConstructor", |
| "CanvasFramebufferPrototype" => "WebGLFramebufferPrototype", |
| "toCanvasFramebuffer" => "toWebGLFramebuffer", |
| "JSCanvasFramebuffer" => "JSWebGLFramebuffer", |
| "JSCanvasFramebufferPrototype" => "JSWebGLFramebufferPrototype", |
| "JSCanvasFramebufferConstructor" => "JSWebGLFramebufferConstructor", |
| "JSCanvasFramebufferCustom" => "JSWebGLFramebufferCustom", |
| "V8CanvasFramebuffer" => "V8WebGLFramebuffer", |
| "V8CanvasFramebufferPrototype" => "V8WebGLFramebufferPrototype", |
| "V8CanvasFramebufferConstructor" => "V8WebGLFramebufferConstructor", |
| "V8CanvasFramebufferCustom" => "V8WebGLFramebufferCustom", |
| "CanvasIntArray" => "WebGLIntArray", |
| "canvasIntArray" => "webGLIntArray", |
| "CanvasIntArrayConstructor" => "WebGLIntArrayConstructor", |
| "CanvasIntArrayPrototype" => "WebGLIntArrayPrototype", |
| "toCanvasIntArray" => "toWebGLIntArray", |
| "JSCanvasIntArray" => "JSWebGLIntArray", |
| "JSCanvasIntArrayPrototype" => "JSWebGLIntArrayPrototype", |
| "JSCanvasIntArrayConstructor" => "JSWebGLIntArrayConstructor", |
| "JSCanvasIntArrayCustom" => "JSWebGLIntArrayCustom", |
| "V8CanvasIntArray" => "V8WebGLIntArray", |
| "V8CanvasIntArrayPrototype" => "V8WebGLIntArrayPrototype", |
| "V8CanvasIntArrayConstructor" => "V8WebGLIntArrayConstructor", |
| "V8CanvasIntArrayCustom" => "V8WebGLIntArrayCustom", |
| "CanvasProgram" => "WebGLProgram", |
| "canvasProgram" => "webGLProgram", |
| "CanvasProgramConstructor" => "WebGLProgramConstructor", |
| "CanvasProgramPrototype" => "WebGLProgramPrototype", |
| "toCanvasProgram" => "toWebGLProgram", |
| "JSCanvasProgram" => "JSWebGLProgram", |
| "JSCanvasProgramPrototype" => "JSWebGLProgramPrototype", |
| "JSCanvasProgramConstructor" => "JSWebGLProgramConstructor", |
| "JSCanvasProgramCustom" => "JSWebGLProgramCustom", |
| "V8CanvasProgram" => "V8WebGLProgram", |
| "V8CanvasProgramPrototype" => "V8WebGLProgramPrototype", |
| "V8CanvasProgramConstructor" => "V8WebGLProgramConstructor", |
| "V8CanvasProgramCustom" => "V8WebGLProgramCustom", |
| "CanvasRenderbuffer" => "WebGLRenderbuffer", |
| "canvasRenderbuffer" => "webGLRenderbuffer", |
| "CanvasRenderbufferConstructor" => "WebGLRenderbufferConstructor", |
| "CanvasRenderbufferPrototype" => "WebGLRenderbufferPrototype", |
| "toCanvasRenderbuffer" => "toWebGLRenderbuffer", |
| "JSCanvasRenderbuffer" => "JSWebGLRenderbuffer", |
| "JSCanvasRenderbufferPrototype" => "JSWebGLRenderbufferPrototype", |
| "JSCanvasRenderbufferConstructor" => "JSWebGLRenderbufferConstructor", |
| "JSCanvasRenderbufferCustom" => "JSWebGLRenderbufferCustom", |
| "V8CanvasRenderbuffer" => "V8WebGLRenderbuffer", |
| "V8CanvasRenderbufferPrototype" => "V8WebGLRenderbufferPrototype", |
| "V8CanvasRenderbufferConstructor" => "V8WebGLRenderbufferConstructor", |
| "V8CanvasRenderbufferCustom" => "V8WebGLRenderbufferCustom", |
| "CanvasRenderingContext3D" => "WebGLRenderingContext", |
| "canvasRenderingContext3D" => "webGLRenderingContext", |
| "CanvasRenderingContext3DConstructor" => "WebGLRenderingContextConstructor", |
| "CanvasRenderingContext3DPrototype" => "WebGLRenderingContextPrototype", |
| "toCanvasRenderingContext3D" => "toWebGLRenderingContext", |
| "JSCanvasRenderingContext3D" => "JSWebGLRenderingContext", |
| "JSCanvasRenderingContext3DPrototype" => "JSWebGLRenderingContextPrototype", |
| "JSCanvasRenderingContext3DConstructor" => "JSWebGLRenderingContextConstructor", |
| "JSCanvasRenderingContext3DCustom" => "JSWebGLRenderingContextCustom", |
| "V8CanvasRenderingContext3D" => "V8WebGLRenderingContext", |
| "V8CanvasRenderingContext3DPrototype" => "V8WebGLRenderingContextPrototype", |
| "V8CanvasRenderingContext3DConstructor" => "V8WebGLRenderingContextConstructor", |
| "V8CanvasRenderingContext3DCustom" => "V8WebGLRenderingContextCustom", |
| "CanvasShader" => "WebGLShader", |
| "canvasShader" => "webGLShader", |
| "CanvasShaderConstructor" => "WebGLShaderConstructor", |
| "CanvasShaderPrototype" => "WebGLShaderPrototype", |
| "toCanvasShader" => "toWebGLShader", |
| "JSCanvasShader" => "JSWebGLShader", |
| "JSCanvasShaderPrototype" => "JSWebGLShaderPrototype", |
| "JSCanvasShaderConstructor" => "JSWebGLShaderConstructor", |
| "JSCanvasShaderCustom" => "JSWebGLShaderCustom", |
| "V8CanvasShader" => "V8WebGLShader", |
| "V8CanvasShaderPrototype" => "V8WebGLShaderPrototype", |
| "V8CanvasShaderConstructor" => "V8WebGLShaderConstructor", |
| "V8CanvasShaderCustom" => "V8WebGLShaderCustom", |
| "CanvasShortArray" => "WebGLShortArray", |
| "canvasShortArray" => "webGLShortArray", |
| "CanvasShortArrayConstructor" => "WebGLShortArrayConstructor", |
| "CanvasShortArrayPrototype" => "WebGLShortArrayPrototype", |
| "toCanvasShortArray" => "toWebGLShortArray", |
| "JSCanvasShortArray" => "JSWebGLShortArray", |
| "JSCanvasShortArrayPrototype" => "JSWebGLShortArrayPrototype", |
| "JSCanvasShortArrayConstructor" => "JSWebGLShortArrayConstructor", |
| "JSCanvasShortArrayCustom" => "JSWebGLShortArrayCustom", |
| "V8CanvasShortArray" => "V8WebGLShortArray", |
| "V8CanvasShortArrayPrototype" => "V8WebGLShortArrayPrototype", |
| "V8CanvasShortArrayConstructor" => "V8WebGLShortArrayConstructor", |
| "V8CanvasShortArrayCustom" => "V8WebGLShortArrayCustom", |
| "CanvasTexture" => "WebGLTexture", |
| "canvasTexture" => "webGLTexture", |
| "CanvasTextureConstructor" => "WebGLTextureConstructor", |
| "CanvasTexturePrototype" => "WebGLTexturePrototype", |
| "toCanvasTexture" => "toWebGLTexture", |
| "JSCanvasTexture" => "JSWebGLTexture", |
| "JSCanvasTexturePrototype" => "JSWebGLTexturePrototype", |
| "JSCanvasTextureConstructor" => "JSWebGLTextureConstructor", |
| "JSCanvasTextureCustom" => "JSWebGLTextureCustom", |
| "V8CanvasTexture" => "V8WebGLTexture", |
| "V8CanvasTexturePrototype" => "V8WebGLTexturePrototype", |
| "V8CanvasTextureConstructor" => "V8WebGLTextureConstructor", |
| "V8CanvasTextureCustom" => "V8WebGLTextureCustom", |
| "CanvasUnsignedByteArray" => "WebGLUnsignedByteArray", |
| "canvasUnsignedByteArray" => "webGLUnsignedByteArray", |
| "CanvasUnsignedByteArrayConstructor" => "WebGLUnsignedByteArrayConstructor", |
| "CanvasUnsignedByteArrayPrototype" => "WebGLUnsignedByteArrayPrototype", |
| "toCanvasUnsignedByteArray" => "toWebGLUnsignedByteArray", |
| "JSCanvasUnsignedByteArray" => "JSWebGLUnsignedByteArray", |
| "JSCanvasUnsignedByteArrayPrototype" => "JSWebGLUnsignedByteArrayPrototype", |
| "JSCanvasUnsignedByteArrayConstructor" => "JSWebGLUnsignedByteArrayConstructor", |
| "JSCanvasUnsignedByteArrayCustom" => "JSWebGLUnsignedByteArrayCustom", |
| "V8CanvasUnsignedByteArray" => "V8WebGLUnsignedByteArray", |
| "V8CanvasUnsignedByteArrayPrototype" => "V8WebGLUnsignedByteArrayPrototype", |
| "V8CanvasUnsignedByteArrayConstructor" => "V8WebGLUnsignedByteArrayConstructor", |
| "V8CanvasUnsignedByteArrayCustom" => "V8WebGLUnsignedByteArrayCustom", |
| "CanvasUnsignedIntArray" => "WebGLUnsignedIntArray", |
| "canvasUnsignedIntArray" => "webGLUnsignedIntArray", |
| "CanvasUnsignedIntArrayConstructor" => "WebGLUnsignedIntArrayConstructor", |
| "CanvasUnsignedIntArrayPrototype" => "WebGLUnsignedIntArrayPrototype", |
| "toCanvasUnsignedIntArray" => "toWebGLUnsignedIntArray", |
| "JSCanvasUnsignedIntArray" => "JSWebGLUnsignedIntArray", |
| "JSCanvasUnsignedIntArrayPrototype" => "JSWebGLUnsignedIntArrayPrototype", |
| "JSCanvasUnsignedIntArrayConstructor" => "JSWebGLUnsignedIntArrayConstructor", |
| "JSCanvasUnsignedIntArrayCustom" => "JSWebGLUnsignedIntArrayCustom", |
| "V8CanvasUnsignedIntArray" => "V8WebGLUnsignedIntArray", |
| "V8CanvasUnsignedIntArrayPrototype" => "V8WebGLUnsignedIntArrayPrototype", |
| "V8CanvasUnsignedIntArrayConstructor" => "V8WebGLUnsignedIntArrayConstructor", |
| "V8CanvasUnsignedIntArrayCustom" => "V8WebGLUnsignedIntArrayCustom", |
| "CanvasUnsignedShortArray" => "WebGLUnsignedShortArray", |
| "canvasUnsignedShortArray" => "webGLUnsignedShortArray", |
| "CanvasUnsignedShortArrayConstructor" => "WebGLUnsignedShortArrayConstructor", |
| "CanvasUnsignedShortArrayPrototype" => "WebGLUnsignedShortArrayPrototype", |
| "toCanvasUnsignedShortArray" => "toWebGLUnsignedShortArray", |
| "JSCanvasUnsignedShortArray" => "JSWebGLUnsignedShortArray", |
| "JSCanvasUnsignedShortArrayPrototype" => "JSWebGLUnsignedShortArrayPrototype", |
| "JSCanvasUnsignedShortArrayConstructor" => "JSWebGLUnsignedShortArrayConstructor", |
| "JSCanvasUnsignedShortArrayCustom" => "JSWebGLUnsignedShortArrayCustom", |
| "V8CanvasUnsignedShortArray" => "V8WebGLUnsignedShortArray", |
| "V8CanvasUnsignedShortArrayPrototype" => "V8WebGLUnsignedShortArrayPrototype", |
| "V8CanvasUnsignedShortArrayConstructor" => "V8WebGLUnsignedShortArrayConstructor", |
| "V8CanvasUnsignedShortArrayCustom" => "V8WebGLUnsignedShortArrayCustom" |
| ); |
| |
| my %renamesContemplatedForTheFuture = ( |
| "DOMObject" => "JSDOMObject", |
| |
| "runtimeObjectGetter" => "pluginElementGetter", |
| "runtimeObjectPropertyGetter" => "pluginElementPropertyGetter", |
| "runtimeObjectCustomGetOwnPropertySlot" => "pluginElementCustomGetOwnPropertySlot", |
| "runtimeObjectCustomPut" => "pluginElementCustomPut", |
| "runtimeObjectImplementsCall" => "pluginElementImplementsCall", |
| "runtimeObjectCallAsFunction" => "pluginElementCallAsFunction", |
| |
| "CLONE_CONTENTS" => "Clone", |
| "DELETE_CONTENTS" => "Delete", |
| "EXTRACT_CONTENTS" => "Extract", |
| |
| "DateInstance" => "JSDate", |
| "ErrorInstance" => "JSError", |
| |
| "KURL" => "URL", |
| "KURLCFNet" => "URLCF", |
| "KURLHash" => "URLHash", |
| "KURLMac" => "URLMac", |
| "KURL_h" => "URL_h", |
| |
| "ThreadSafeSharedBase" => "ThreadSafeRefCountedBase", |
| "ThreadSafeShared" => "ThreadSafeRefCounted", |
| "TreeShared" => "TreeRefCounted", |
| |
| "StringImpl" => "SharedString", |
| |
| "RenderView" => "RenderViewport", |
| |
| "ObjcFallbackObjectImp" => "ObjCFallbackObject", |
| "RuntimeObjectImp" => "ForeignObject", |
| |
| "runtime_array" => "BridgedArray", |
| "runtime_method" => "BridgedFunction", |
| "runtime_object" => "BridgedObject", |
| "objc_runtime" => "ObjCBridge", |
| |
| "equalIgnoringCase" => "equalFoldingCase", |
| |
| "FTPDirectoryTokenizer" => "FTPDirectoryDocumentBuilder", |
| "HTMLTokenizer" => "HTMLDocumentBuilder", |
| "ImageTokenizer" => "ImageDocumentBuilder", |
| "PluginTokenizer" => "PluginDocumentBuilder", |
| "TextTokenizer" => "TextDocumentBuilder", |
| "Tokenizer" => "DocumentBuilder", |
| "Tokenizer_h" => "DocumentBuilder_h", |
| "XMLTokenizer" => "XMLDocumentBuilder", |
| "isHTMLTokenizer" => "isHTMLDocumentBuilder", |
| "m_tokenizer" => "m_builder", |
| "createTokenizer" => "createBuilder", |
| "tokenizerProcessedData" => "documentBuilderProcessedData", |
| |
| "WTF_UNICODE_H" => "Unicode_h", |
| "WTF_UNICODE_ICU_H" => "UnicodeICU_h", |
| "WTF_UNICODE_QT4_H" => "UnicodeQt4_h", |
| "UnicodeIcu" => "UnicodeICU", |
| |
| "m_invertibleCTM" => "m_transformIsInvertible", |
| |
| "NativeFunctionWrapper_h" => "JSHostFunction_h", |
| "NativeFunctionWrapper" => "JSHostFunction", |
| "nativeFunctionThunk" => "hostFunctionThunk", |
| "nativeFunction" => "hostFunction", |
| "NativeFunction" => "HostFunction", |
| ); |
| |
| # rename files |
| |
| my %newFile; |
| for my $file (sort @paths) { |
| my $f = $file; |
| $f = "$1$renames{$2}$3" if $f =~ /^(.*\/)(\w+)(\.\w+)$/ && $renames{$2}; |
| if ($f ne $file) { |
| $newFile{$file} = $f; |
| } |
| } |
| |
| |
| my $isGit = isGit(); |
| |
| for my $file (sort @paths) { |
| if ($newFile{$file}) { |
| my $newFile = $newFile{$file}; |
| print "Renaming $file to $newFile\n"; |
| if ($isGit) { |
| system "git mv $file $newFile"; |
| } else { |
| system "svn move $file $newFile"; |
| } |
| } |
| } |
| |
| # change all file contents |
| |
| for my $file (sort @paths) { |
| $file = $newFile{$file} if $newFile{$file}; |
| my $contents; |
| { |
| local $/; |
| open FILE, $file or die; |
| $contents = <FILE>; |
| close FILE; |
| } |
| my $newContents = $contents; |
| |
| if ($isDOMTypeRename) { |
| for my $from (keys %renames) { |
| $newContents =~ s/\b$from/$renames{$from}/g; |
| } |
| } else { |
| for my $from (keys %renames) { |
| $newContents =~ s/\b$from(?!["\w])/$renames{$from}/g; # this " unconfuses Xcode syntax highlighting |
| } |
| } |
| |
| if ($newContents ne $contents) { |
| open FILE, ">", $file or die; |
| print FILE $newContents; |
| close FILE; |
| } |
| } |