Skip to content

Commit

Permalink
Merge pull request #85 from MartiUK/gitcleanup
Browse files Browse the repository at this point in the history
Git exe Cleanup + some bonuses
  • Loading branch information
samvasko committed Dec 24, 2013
2 parents 72aac17 + 804126c commit 67bdd93
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion bin/Readme.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion config/Readme.md
Original file line number Diff line number Diff line change
@@ -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 changes: 24 additions & 0 deletions gitcleanup.py
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions gitcleanup.rb
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion vendor/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Vendor

Software from third parties + init sctipt
Third parties software & init script.

0 comments on commit 67bdd93

Please sign in to comment.