summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorp4bl0 <pablo@rauzy.name>2010-09-24 15:12:41 +0200
committerp4bl0 <pablo@rauzy.name>2010-09-24 15:12:41 +0200
commit65ffc98b8781d2f13505c78098f5fe7499eec979 (patch)
tree62025878490de5da38f1d4460a60dd1c512fd599 /install.sh
parentfc7302f193d932f67f56d67d277dd626a7fec807 (diff)
added an install-config options to be used in pair with --install-hooks to transform any repos into a fugitive repos
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh46
1 files changed, 26 insertions, 20 deletions
diff --git a/install.sh b/install.sh
index 7a2401c..3d54d24 100644
--- a/install.sh
+++ b/install.sh
@@ -35,20 +35,9 @@ EOF
echo "done."
}
-fugitive_install() {
- DIR="."
- if [ "$1" != "" ]; then DIR="$1"; fi
- if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi
- cd "$DIR"
- if [ -d ".git" ]; then
- echo "There's already a git repository here, aborting install."
- exit 1
- fi
- echo -n "Creating new git repository... "
- git init >/dev/null
- echo "done."
- echo -n "Adding default settings to git config... "
- if [ "$2" = "remote" ]; then
+fugitive_install_config() {
+ echo -n "Adding default fugitive settings to git config... "
+ if [ "$1" = "remote" ]; then
git config --add receive.denyCurrentBranch "ignore"
fi
git config --add fugitive.blog-url ""
@@ -57,7 +46,19 @@ fugitive_install() {
git config --add fugitive.public-dir "_public"
git config --add fugitive.preproc ""
echo "done."
- fugitive_install_hooks
+
+}
+
+fugitive_install() {
+ if [ -d ".git" ]; then
+ echo "There's already a git repository here, aborting install."
+ exit 1
+ fi
+ echo -n "Creating new git repository... "
+ git init >/dev/null
+ echo "done."
+ fugitive_install_config
+ fugitive_install_hooks "$1"
echo -n "Preventing git to track temporary and generated files... "
cat >> .git/info/exclude <<EOF
*~
@@ -66,7 +67,7 @@ _public/archives.html
_public/feed.xml
EOF
echo "done."
- if [ "$2" = "local" ]; then
+ if [ "$1" = "local" ]; then
echo -n "Creating default directory tree... "
mkdir -p _drafts _articles _templates _public
echo "done."
@@ -110,7 +111,6 @@ EOF
fi
echo "Installation complete, please set your blog url using"
echo '`git config fugitive.blog-url "<url>"`.'
- cd - >/dev/null
}
fugitive_usage() {
@@ -131,10 +131,16 @@ fugitive_help() {
fugitive_usage
}
+DIR="."
+if [ "$2" != "" ]; then DIR="$2"; fi
+if [ ! -d "$DIR" ]; then mkdir -p "$DIR"; fi
+cd "$DIR"
case "$1" in
"--help"|"-h") fugitive_help >&2;;
- "--install"|"--install-local") fugitive_install "$2" "local";;
- "--install-remote") fugitive_install "$2" "remote";;
- "--install-hooks") fugitive_install_hooks;;
+ "--install"|"--install-local") fugitive_install "local";;
+ "--install-remote") fugitive_install "remote";;
+ "--install-hooks") fugitive_install_hooks ;;
+ "--install-config") fugitive_install_config "local";;
*) fugitive_usage >&2;;
esac
+cd - >/dev/null