mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
added cleanup script for git directory
This commit is contained in:
parent
2c8364ce58
commit
d0e383e5c0
25
git_cleanup.rb
Normal file
25
git_cleanup.rb
Normal file
@ -0,0 +1,25 @@
|
||||
def main()
|
||||
git_dir = '\\vendor\\msysgit\\libexec\\git-core\\'
|
||||
working_dir = Dir.pwd
|
||||
Dir.chdir(working_dir + git_dir)
|
||||
Dir.entries(working_dir + git_dir).each do |file|
|
||||
if file == 'git.exe' or file == 'mergetools' or file.end_with?('.bat') then
|
||||
next
|
||||
end
|
||||
if file.end_with?('.exe') then
|
||||
File.open(File.basename(file, '.*') + '.bat', "w") do |new_file|
|
||||
new_file.write('@ECHO OFF\n' + File.basename(file, '.*').gsub('-',' ') + ' $*')
|
||||
end
|
||||
File.delete(file)
|
||||
next
|
||||
elsif file.end_with?('.bat') then
|
||||
File.open(file + '.bat', "w") do |new_file|
|
||||
new_file.write('@ECHO OFF\n' + file.gsub('-', ' ') + ' $*')
|
||||
end
|
||||
File.delete(file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
main
|
||||
|
Loading…
Reference in New Issue
Block a user