Skip to content

Commit

Permalink
[FEATURE] added the luchizzation of git config
Browse files Browse the repository at this point in the history
- new desktop packages added
- refactored the file open structure
  • Loading branch information
lucagiove committed Aug 28, 2015
1 parent e70acbc commit 24bf8c9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
10 changes: 10 additions & 0 deletions files/git_config_commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
git config --global color.ui auto
git config --global push.default current
git config --global core.autocrlf input
git config --global core.safecrlf true
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.br branch
git config --global alias.log "log --pretty --decorate"
git config --global alias.hist "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.histdiff "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -p"
26 changes: 19 additions & 7 deletions luchizz.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def set_authentication_keys():
ssh_path = os.path.join(os.getenv('HOME'), '.ssh/')
ids_ssh = glob('{}id*.pub'.format(ssh_path))
for id_ssh in ids_ssh:
f = open(id_ssh, 'r')
# reading the public key for anything after the key to get name and
# address that normally follow the key
id_ssh_file = f.read()
with open(id_ssh, 'r') as f:
# reading the public key for anything after the key to get name and
# address that normally follow the key
id_ssh_file = f.read()
id_ssh_name = ' '.join(id_ssh_file.split()[2:])
if query_yes_no("CONFIGURE {}'s ssh key for "
"authentication?".format(id_ssh_name), 'yes'):
Expand All @@ -146,6 +146,14 @@ def set_gitconfig():
put(gitconfig_path, '$HOME/.gitconfig', use_sudo=True)


def luchizz_gitconfig():
"""Setup aliases and gitconfig useful default configurations"""
with open(os.path.join(LUCHIZZ_DIR, 'files/git_config_commands')) as f:
git_commands = f.read().split('\n')
for command in git_commands:
run(command)


def set_disable_backports():
# FIXME avoid multiple # to be added if executed multiple times
comment('/etc/apt/sources.list', '.+-backports', use_sudo=True)
Expand All @@ -166,9 +174,8 @@ def luchizz_shell():
global LUCHIZZ_DIR
luchizz_profile = os.path.join(LUCHIZZ_DIR,
'files/profile/luchizz-profile.sh')
f = open(luchizz_profile, 'r')
luchizz_profile = f.read()
f.close()
with open(luchizz_profile, 'r') as f:
luchizz_profile = f.read()

# Installing default bash changes for newly created users
# FIXME for what the hell is used this folder?
Expand Down Expand Up @@ -375,6 +382,11 @@ def main():
with quiet():
set_gitconfig()

if query_yes_no("CONFIGURE do you want to luchizz the gitconfig for"
"local user?", 'yes'):
with quiet():
luchizz_gitconfig()

# Disable backports
if query_yes_no("DISABLE backports repositories?", 'yes'):
with quiet():
Expand Down
2 changes: 2 additions & 0 deletions packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ desktop:
- remmina
- indicator-multiload
- network-manager-openvpn
- ipython
- python-pip

0 comments on commit 24bf8c9

Please sign in to comment.