Merge pull request #85 from MartiUK/gitcleanup

Git exe Cleanup + some bonuses
This commit is contained in:
Samuel Vasko 2013-12-24 05:38:49 -08:00
commit 67bdd93c3e
6 changed files with 54 additions and 4 deletions

View File

@ -8,7 +8,7 @@ Cmder is a **software package** created out of pure frustration over absence of
## Why use it
The main advantage of Cmder is portability. It is designed to be totally self-contained with no external dependencies. That makes it great for **USB Sticks** or **Dropbox**. So you can carry your console, aliases and binaries (like wget, curl and git) with you anywhere.
The main advantage of Cmder is portability. It is designed to be totally self-contained with no external dependencies, that is makes it great for **USB Sticks** or **Dropbox**. So you can carry your console, aliases and binaries (like wget, curl and git) with you anywhere.
## Installation

View File

@ -1,3 +1,3 @@
## Bin
This folder will be injected into path at runtime
This folder will be injected into the PATH environment variable at runtime.

View File

@ -1,3 +1,3 @@
## Config
All config files must be in this folder, if there is no option to set the folder directly, it has to be hardlinked.
All config files must be in this folder. If there is no option to set this folder directly, it has to be hardlinked.

24
gitcleanup.py Normal file
View File

@ -0,0 +1,24 @@
import os
def main():
cwd = os.getcwd()
os.chdir(cwd + '\\vendor\\msysgit\\libexec\\git-core\\')
for file_ in os.listdir(cwd + '\\vendor\\msysgit\\libexec\\git-core\\'):
if file_ == 'git.exe' or file_ == 'mergetools' or file_.endswith('.bat'):
continue # Ignore main git exe, mergetools folder and already created batch files.
if file_.endswith('.exe'):
with open(os.path.splitext(file_)[0] + '.bat', 'w') as out:
out.write('@ECHO OFF\n' + os.path.splitext(file_)[0].replace('-',' ') + ' $*')
os.remove(file_)
# print 'Cleaned out ' + file_
continue
else:
with open(file_ + '.bat', 'w') as out:
out.write('@ECHO OFF\n' + file_.replace('-', ' ') + ' $*')
os.remove(file_)
# print 'Cleaned out ' + file_
continue
pass
if __name__ == '__main__':
main()

26
gitcleanup.rb Normal file
View File

@ -0,0 +1,26 @@
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)
next
end
end
end
main

2
vendor/Readme.md vendored
View File

@ -1,3 +1,3 @@
## Vendor
Software from third parties + init sctipt
Third parties software & init script.