From 9a2cb782b151428711921dd6693da4365ce8c9c1 Mon Sep 17 00:00:00 2001 From: Geoff Harcourt Date: Thu, 24 Jul 2014 11:15:23 -0400 Subject: [PATCH] Allow personal overrides to psqlrc I wanted to add my own customizations after reading @mike-burns' post on [`psqlrc`](http://robots.thoughtbot.com/an-explained-psqlrc). As a result of this change, `.psqlrc` requires that a `.psqlrc.local` exist in the home folder because `psql` cannot do conditional sourcing of files in the style that we use in other foundation dotfiles. Touching the file to ensure it exists (even if blank) prevents `psql` from exiting with an error if the user does not provide their own custom configuration. Additional changes: * Updating the documentation with regard to which files get excluded. --- README.md | 18 ++++++++++++------ hooks/post-up | 2 ++ psqlrc | 5 +++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 32abd3ab5e..f05c966549 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,18 @@ Install [rcm](https://github.com/thoughtbot/rcm): brew bundle dotfiles/Brewfile -Install: +Install the dotfiles: - rcup -d dotfiles -x README.md -x LICENSE -x Brewfile + env RCRC=$HOME/dotfiles/rcrc rcup -This will create symlinks for config files in your home directory. The `-x` -options, which exclude the `README.md`, `LICENSE`, and `Brewfile` files, are -needed during installation but can be skipped once the `.rcrc` configuration -file is symlinked in. +This command will create symlinks for config files in your home directory. +Setting the `RCRC` environment variable tells `rcup` to use standard +configuration options: + +* Exclude the `README.md`, `LICENSE`, and `Brewfile` files, which are part of + the `dotfiles` repository but do not need to be symlinked in. +* Give precedence to personal overrides which by default are placed in + `~/dotfiles-local` You can safely run `rcup` multiple times to update: @@ -43,6 +47,8 @@ Put your customizations in dotfiles appended with `.local`: * `~/.aliases.local` * `~/.gitconfig.local` * `~/.gvimrc.local` +* `~/.psqlrc.local` (we supply a blank `.psqlrc.local` to prevent `psql` from + throwing an error, but you should overwrite the file with your own copy) * `~/.tmux.conf.local` * `~/.vimrc.local` * `~/.vimrc.bundles.local` diff --git a/hooks/post-up b/hooks/post-up index 7315c017ea..0713f8f31c 100755 --- a/hooks/post-up +++ b/hooks/post-up @@ -1,5 +1,7 @@ #!/bin/sh +touch $HOME/.psqlrc.local + if [ ! -e $HOME/.vim/bundle/Vundle.vim ]; then git clone https://github.com/gmarik/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim fi diff --git a/psqlrc b/psqlrc index 095c261a71..39d3f3d2f4 100644 --- a/psqlrc +++ b/psqlrc @@ -21,3 +21,8 @@ \set HISTCONTROL ignoredups \set COMP_KEYWORD_CASE upper \unset quiet + +-- psql can't check for a file's existence, so we'll provide an empty local +-- file that users can override with their custom dotfiles. To set your own +-- personal settings, place your own file in ~/.psqlrc.local +\i ~/.psqlrc.local