Browse Source

add install script w/ curl|bash support

Kyle P Davis 10 years ago
parent
commit
f6cb5e2750
3 changed files with 47 additions and 24 deletions
  1. 5 7
      .profile
  2. 11 17
      README.md
  3. 31 0
      install.sh

+ 5 - 7
.profile

@@ -70,18 +70,16 @@ fi
 
 
 # bash completion FTW
 # bash completion FTW
 if [ "$OS" = "Darwin" ]; then
 if [ "$OS" = "Darwin" ]; then
-	! [ -f "$BREW_PREFIX/etc/bash_completion" ]  ||  . "$BREW_PREFIX/etc/bash_completion"
+	F="$BREW_PREFIX/etc/bash_completion";  ! [ -f "$F" ]  ||  . "$F"
+	F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash";  ! [ -f "$F" ]  ||  . "$F"
 else
 else
-	! [ -f "/etc/bash_completion" ]  ||  . "/etc/bash_completion"
+	F="/etc/bash_completion";  ! [ -f "$F" ]  ||  . "$F"
 fi
 fi
 
 
-# Git shell aliases
-F="/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash";  ! [ -f "$F" ]  ||  . "$F"
-
 # Liquid Prompt
 # Liquid Prompt
-F="$HOME/.liquidprompt/liquidprompt";  ! [ "$PS1" -a -f "$F" ]  ||  . "$F"
+F="$HOME/.liquidprompt/liquidprompt";  ! [ -f "$F" ]  ||  . "$F"
 
 
 # gimme gimme
 # gimme gimme
 [ -d "$HOME/.gimme" ]  ||  curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
 [ -d "$HOME/.gimme" ]  ||  curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
-! [ -f "$HOME/.gimme/gimme" ]  ||  . "$HOME/.gimme/gimme"
+F="$HOME/.gimme/gimme";  ! [ -f "$F" ]  ||  . "$F"
 
 

+ 11 - 17
README.md

@@ -1,5 +1,4 @@
-dotfiles
-========
+# dotfiles
 
 
 My obligatory dotfiles repository to track and share my personal config files.
 My obligatory dotfiles repository to track and share my personal config files.
 
 
@@ -9,44 +8,39 @@ This also serves as a tool for getting new Mac OS X systems setup in a hurry.
 
 
 
 
 
 
-Highlights
-==========
+## Highlights
 
 
 * `.profile`
 * `.profile`
-  - a handful of integrated `_install_*` functions to make setup easier
+  - uses [gimme][gimme] to simplify installation (to wrap `apt-get`, [brew][brew], etc)
   - uses [liquidprompt][liquidprompt] for awesome shell prompts
   - uses [liquidprompt][liquidprompt] for awesome shell prompts
-  - uses [homebrew][homebrew] for integration with common tools
+  - colors for less,
 * `.vimrc`
 * `.vimrc`
   - uses [Vim-Plug][vim-plug] to automatically install and load plugins
   - uses [Vim-Plug][vim-plug] to automatically install and load plugins
   - tweaks colors and tabs
   - tweaks colors and tabs
   - syntax checking
   - syntax checking
   - JavaScript and CoffeeScript support
   - JavaScript and CoffeeScript support
   - inline colors for CSS
   - inline colors for CSS
-  - gutter for VCS changes
+  - gutter for VCS/SCM changes (e.g., git)
 * [Atom][atom] editor scripts
 * [Atom][atom] editor scripts
   - an install script for the plugins that I use
   - an install script for the plugins that I use
 
 
 
 
 
 
-Installation
-============
+## Installation
 
 
-Clone it
---------
+### Clone it
 ```bash
 ```bash
-git clone https://github.com/KylePDavis/dotfiles.git
+git clone "https://github.com/KylePDavis/dotfiles" "$HOME/.dotfiles"
 ```
 ```
 
 
-Symlink things
---------------
+### Automated
 ```bash
 ```bash
-ln -s dotfiles/.vimrc ~/.vimrc
-ln -s dotfiles/.profile ~/.profile
+"$HOME/.dotfiles/.install.sh"
 ```
 ```
 
 
 
 
 
 
 [liquidprompt]: https://github.com/nojhan/liquidprompt
 [liquidprompt]: https://github.com/nojhan/liquidprompt
-[homebrew]: http://brew.sh
+[brew]: http://brew.sh
 [atom]: https://atom.io
 [atom]: https://atom.io
 [vim-plug]: https://github.com/junegunn/vim-plug
 [vim-plug]: https://github.com/junegunn/vim-plug

+ 31 - 0
install.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+set -o errexit -o pipefail
+
+# support curl|bash
+if [[ "$0" =~ [-]?bash ]] && ! [[ "$BASH_SOURCE" ]]; then
+	git clone "https://github.com/KylePDavis/dotfiles" "$HOME/.dotfiles"
+	exec "$HOME/.dotfiles/install.sh"
+fi
+
+CMD_DIR=$(cd "${BASH_SOURCE%/*}"; echo "$PWD")
+
+link() {
+	local SRC=$1
+	local DST=$2
+	if [[ -f "$DST" ]]; then
+		if ! [[ -L "$DST" ]]; then
+			mkdir -p "${DST%/*}"
+			mv -vi "$DST" "$DST.bak"
+			ln -sfv "$SRC" "$DST"
+		fi
+	fi
+}
+
+link "$CMD_DIR/.profile" "$HOME/.profile"
+link "$CMD_DIR/.profile" "$HOME/.bashrc"
+
+link "$CMD_DIR/.vimrc" "$HOME/.vimrc"
+
+link "$CMD_DIR/.jshintrc" "$HOME/.jshintrc"
+link "$CMD_DIR/.jscsrc" "$HOME/.jscsrc"
+link "$CMD_DIR/.node-inspectorrc" "$HOME/.node-inspectorrc"