These are my versioned configuration files for bash, git, and etc.
This repository attempts to support:
- OS X
- Linux (primarily Debian / CentOS)
- Unix
- Windows XP (using Cygwin; minimal support)
bin/
- executables available via $PATHdocs/
- help files, tutorials, cheatsheets, etc.functions/
- autoloaded global functionsmodules/
- autoloaded config files grouped by library/feature/packageinit.sh
- main script that loads all functions and modules
All files and directories ending with .symlink
will get automatically
symlinked into the $HOME
directory when you run the dotfiles
installer.
The dotfiles
installer is safe in that it will never destroy existing files,
it can run multiple times with the same outcome (i.e. idempotent), and you can
undo all changes with the uninstaller. You'll only need to run the dotfiles
installer once.
After running the dotfiles
installer, your $HOME
folder will look something
like:
$ ls -l `find ~ -maxdepth 1 -type l -print`
lrwxr-xr-x 1 myuser staff 57 Aug 11 11:28 /Users/myuser/.bash_profile@ -> /Users/myuser/.dotfiles/modules/bash/bash_profile.symlink
lrwxr-xr-x 1 myuser staff 51 Aug 11 11:28 /Users/myuser/.bashrc@ -> /Users/myuser/.dotfiles/modules/bash/bashrc.symlink
lrwxr-xr-x 1 myuser staff 51 Aug 11 11:28 /Users/myuser/.bundle@ -> /Users/myuser/.dotfiles/modules/ruby/bundle.symlink
lrwxr-xr-x 1 myuser staff 50 Aug 11 11:28 /Users/myuser/.gemrc@ -> /Users/myuser/.dotfiles/modules/ruby/gemrc.symlink
lrwxr-xr-x 1 myuser staff 53 Aug 11 11:28 /Users/myuser/.gitignore@ -> /Users/myuser/.dotfiles/modules/git/gitignore.symlink
lrwxr-xr-x 1 myuser staff 52 Aug 11 11:28 /Users/myuser/.inputrc@ -> /Users/myuser/.dotfiles/modules/bash/inputrc.symlink
...
NOTE: The symlinked source files should never begin with a .
dot. The symlink
installer will automatically add a preceeding dot to the symlink destination files.
For example, ~/.bashrc -> ~/.dotfiles/bash/bashrc.symlink
.
The init.sh
file is the one and only main bootstrapper script that loads
global shell variables, loads globally available functions, and autoloads
module scripts.
The init.sh
script is sourced by very thin .bashrc
and .bash_profile
which
get symlinked into your $HOME directory via the dotfiles
installer. These
files can be found within the modules/bash/
directory.
The init.sh
loader will first source
functions before any modules so all
global functions are available within each module.
Functions will load in alphabetic order of their filename. Ideally, each file should contain a single function or a group of tightly knit functions.
After loading functions, the init.sh
bootstrapper will find all files appended
with .autoload.sh
and load them using the built-in source
command. The
bootstrap loader will take multiple passes to load bash files:
- first loading files ending in
.autoload.first.sh
- then
.autoload.sh
- and finally
.autoload.last.sh
During each pass, files will load in alphabetical order of directory name
followed by filename. Autoloaded files are typically found within the modules/
directory.
Files or directories ending with .template
will get copied into the $HOME
directory when you run the dotfiles installer.
NOTE: This functionality is not supported yet.
The bin commands will be made available by adding the bin/
directory to
$PATH
from within the bash
module.
dotfiles
- install, uninstall, and morereload
- reloads the shell without exiting
git clone https://github.com/benlinton/dotfiles.git ~/.dotfiles
Finds dotfiles ending with .symlink
and symlinks them in $HOME
:
~/.dotfiles/bin/dotfiles --install
Some files require templates (instead of symlinks) because they contain sensitive data.
~/.dotfiles/modules/git/gitconfig-restore
NOTE: Eventually we'll use the dotfiles
command for these tasks.
Update ~/.gitconfig
with your secret credentials:
git config --global user.name "Firstname Lastname"
git config --global user.email "[email protected]"
git config --global github.user "your_github_username"
git config --global github.token "1234567890abcdefghijklmnop"
~/.dotfiles/modules/sublime/sublime-install
~/.dotfiles/modules/sublime/sublime-restore
~/.dotfiles/modules/iterm2/iterm2-restore
~/.dotfiles/modules/osx/defaults.sh
dotfiles --uninstall
rm -rf ~/.dotfiles
Tests are written with bats.
Assuming OS X with homebrew installed (otherwise see the bats documentation):
brew install bats
bats $DOTFILES_HOME/bin/tests