Permalink
Browse files

rewrite install script in bash

  • Loading branch information...
1 parent 01f4aef commit e58e854963442669c3814de887281600d13c7e92 @mislav committed May 29, 2012
Showing with 30 additions and 17 deletions.
  1. +14 −0 install
  2. +0 −17 install.rb
  3. +16 −0 readme.md
View
14 install
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+set -e
+
+here="$(dirname "$0")"
+here="$(cd "$here"; pwd)"
+
+for file in "$here"/*; do
+ name="$(basename "$file" .md)"
+ [[ $name = bin ]] && dotname="$name" || dotname=".${name}"
+
+ if [[ !( "install readme" =~ $name || -e ~/$dotname || -d $file/.git ) ]]; then
+ ln -sfhv ${file#$HOME/} "${HOME}/${dotname}"
+ fi
+done
View
@@ -1,17 +0,0 @@
-#!/usr/bin/env ruby
-# from http://errtheblog.com/posts/89-huba-huba
-
-home = ENV['HOME']
-
-Dir.chdir File.dirname(__FILE__) do
- dotfiles_dir = Dir.pwd.sub(home + '/', '')
-
- Dir['*'].each do |file|
- next if File.directory?(File.join(file, '.git')) or '.rb' == File.extname(file)
- target_name = file == 'bin' ? file : ".#{file}"
- target = File.join(home, target_name)
- unless File.exist? target
- system %[ln -vsf #{File.join(dotfiles_dir, file)} #{target}]
- end
- end
-end
View
@@ -0,0 +1,16 @@
+# dotfiles
+
+Mislav's configuration files for bash, zsh, git, ruby, and more.
+
+## Installation
+
+Clone somewhere, then run the `install` script:
+
+~~~ sh
+$ git clone git://github.com/mislav/dotfiles.git ~/dotfiles
+$ ~/dotfiles/install
+~~~
+
+It won't touch your existing dotfiles, but will symlink the ones that don't
+exist. Optionally, move your existing dotfiles to a backup location before
+running `install` if you want to completely switch.

0 comments on commit e58e854

Please sign in to comment.