Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'fileutils'
- # Problem: ActionScript class files named without following capitalized convention
- # cannot be simply renamed to the correct convention and commit to version control.
- # This is caused by case-insensitive file systems not recognizing the casing changes.
- # Solution: Create a temp copy of the original, incorrectly cased file. Remove the original from version control.
- # Rename the temp to the correct name and add to version control. Commit.
- # Rename and copy temporarily
- Dir['*.as'].each do |as_file|
- # if the filename is not uppercased
- if as_file[0..0] != (cap = as_file[0..0].upcase)
- # make tmp copy of the file with correct capitalization
- # ie. foo.as gets copied to Foo.as.tmp
- FileUtils.cp(as_file, "#{cap}#{as_file[1..as_file.size]}.tmp")
- # remove the original file from SVN
- `svn rm #{as_file}`
- end
- end
- # Rename temp files to corrected name and add to SVN
- Dir['*.as.tmp'].each do |tmp_file|
- final = tmp_file.sub(/\.tmp$/, '')
- FileUtils.mv tmp_file, final
- `svn add #{final}`
- end
- # Double check and commit.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement