Merge branch 'master' of github.com:yagu0/valse
[valse.git] / initialize.sh
1 #!/bin/sh
2
3 #initialize submodules, set-up .git/config and .gitattributes, and pre-push hook
4 git submodule init && git submodule update --merge
5
6 #filter for git-fat
7 printf \
8 '*.pdf filter=fat
9 *.tar.xz filter=fat
10 *.png filter=fat
11 *.jpg filter=fat
12 *.ps filter=fat\n' > .gitattributes
13
14 #filter for Jupyter
15 python .nbstripout/nbstripout.py --install --attributes .gitattributes
16
17 #pre-commit and pre-push hooks: indentation, git fat push, submodules update
18 cp hooks/* .git/hooks/
19
20 #install formatR
21 echo 'if (! "formatR" %in% rownames(installed.packages()))
22 install.packages("formatR",repos="https://cloud.r-project.org")' | R --slave
23
24 #.gitfat file with remote on gitfat@auder.net
25 printf '[rsync]\nremote = gitfat@auder.net:~/files/valse\n' > .gitfat
26
27 #manual git-fat init: with relative path to binary
28 #1] remove filter if exists http://stackoverflow.com/a/12179641/4640434
29 sed -i '1N;$!N;s/\[filter "fat"\]\n.*\n.*//;P;D' .git/config
30 #2] place new filter
31 printf \
32 '[filter "fat"]
33 clean = ./.git-fat/git-fat filter-clean
34 smudge = ./.git-fat/git-fat filter-smudge\n' >> .git/config