Skip to content

Commit

Permalink
Allow personal overrides to psqlrc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
geoffharcourt authored and mike-burns committed Jul 30, 2014
1 parent 49a4597 commit 9a2cb78
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
18 changes: 12 additions & 6 deletions README.md
Expand Up @@ -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:

Expand All @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
5 changes: 5 additions & 0 deletions psqlrc
Expand Up @@ -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

0 comments on commit 9a2cb78

Please sign in to comment.