insanum/nostalgic — pull request #1 by ahamid (2013-04-08 22:07:32+00:00)
Title: add support for non-dotfiles/executables

Hi, i was searching for something to manage bash scripts and found nostalgic was 99% what I wanted, except that it was intended for dot files, and therefore changes file names.

This patch adds a few things:

* config file flag, can override vars here. turned out i didn't actually end up needing this because of features below i implemented. still, could be handy
* modes: there are now two "modes". each mode has distinct repo paths and dests. the default is "dot" which behaves exactly (i believe) as current nostalgic does. the other mode is binary. binary mode does a few things:
1. change default repo path (so that ALL operations don't do the wrong thing to the wrong repos) and dest (`$HOME/bin`)
1. don't rename files with dot prefix
1. only symlink executables. the last isn't critical but i figure there is a chance of mixed content in repos, and you only really want to symlink executables into bin
* flags to select mode or enable executable mode.
* change default repos dir to `~/.nostalgic/dots` and `~/.nostalgic/bins`

example:
```
[aaron@laptop ~]$ nostalgic -x clone $HOME/git-repos/binfiles
repos dir '/home/aaron/.nostalgic/bins' does not exist (creating)
--> cloning [/home/aaron/.nostalgic/bins/binfiles]
Cloning into '/home/aaron/.nostalgic/bins/binfiles'...
done.
[aaron@laptop ~]$ nostalgic -x symlink ALL
--> symlinking repo [/home/aaron/.nostalgic/bins/binfiles]
--> symlinked [foo]
--> [helloexecutable] already symlinked
--> [hellononexe] skipping non-executable file
--> symlinked [newexe]
--> [nonexecutable] skipping non-executable file
[aaron@laptop ~]$ ls -l bin/foo
lrwxrwxrwx. 1 aaron aaron 40 Apr 8 18:00 bin/foo -> /home/aaron/.nostalgic/bins/binfiles/foo
[aaron@laptop ~]$ newexe
hello new
[aaron@laptop ~]$ nonexecutable
bash: nonexecutable: command not found...
[aaron@laptop ~]$ echo "echo \"new script\"" > bin/newscript
[aaron@laptop ~]$ chmod a+x bin/newscript
[aaron@laptop ~]$ nostalgic -x track bin/newscript binfiles
--> adding [/home/aaron/.nostalgic/bins/binfiles/newscript] to repo [/home/aaron/.nostalgic/bins/binfiles]
--> symlinked [/home/aaron/.nostalgic/bins/binfiles/newscript] to [bin/newscript]
--> git status for repo [/home/aaron/.nostalgic/bins/binfiles]
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
#	new file: newscript
#
[aaron@laptop ~]$ # dotfiles still work
[aaron@laptop ~]$ nostalgic clone $HOME/git-repos/dotfiles
repos dir '/home/aaron/.nostalgic/dots' does not exist (creating)
--> cloning [/home/aaron/.nostalgic/dots/dotfiles]
Cloning into '/home/aaron/.nostalgic/dots/dotfiles'...
done.
[aaron@laptop ~]$ nostalgic symlink ALL
--> symlinking repo [/home/aaron/.nostalgic/dots/dotfiles]
--> symlinked [rspec]
--> symlinked [whatever]
[aaron@laptop ~]$ echo "abcd" > .newdotfile
[aaron@laptop ~]$ nostalgic track .newdotfile dotfiles
--> adding [/home/aaron/.nostalgic/dots/dotfiles/newdotfile] to repo [/home/aaron/.nostalgic/dots/dotfiles]
--> symlinked [/home/aaron/.nostalgic/dots/dotfiles/newdotfile] to [.newdotfile]
--> git status for repo [/home/aaron/.nostalgic/dots/dotfiles]
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
#	new file: newdotfile
#
```

let me know what you think