Development Foo – using vim and sshfs to propel development

Ahoy, mateys!

I hack on Crowbar a lot. And here’s how I run my show:

1) dev/build box running ubuntu-12.04
2) Crowbar Admin box running whatever latest stuff i just built – and mostly works
3) a test node box, where I used Crowbar to deploy whatever I’m working on
4) another test node box, where I’ve used crowbar to deploy what I’ve been working on.

I’m a commandline guy. I *love* vim. I hack code in vim with NERDtree for a left hand column filebrowser, the git extentions, etc.

Here they are:

nerdtree - the nerd tree of life
vim-fugitive - git extentions, joy!
vim-nerdtree-tabs - open files into tabs from the tree

But none of the aforementioned awesomeness is what I have in store for you.  It’s this process of deploying the code I’m working on to my test admin server (box 2, above) and properly restarting processes properly, but AUTOMATICALLY that is really fun.

To do it, first mount your admin box onto your development box in the easiest way possible:  SSHFS

apt-get install sshfs
mkdir /mnt/admin
sshfs crowbar@192.168.124.10:/ /mnt/admin

Then alter your dev box’s ~/.vimrc to save files you opened on your dev box to that mount.  It uses a regex to munge the path.  I use a regex, so you know it works BUG FREE! 🙂

autocmd BufWritePost /home/judd/crowbar/barclamps/* !cp :p :p:s|/home/judd/crowbar/|/mnt/admin/opt/dell/|

The above saves the file you were just editing (as long as it was under /home/judd/crowbar/barclamps/) onto the sshfs mount of the admin server.

Now head on over to the Admin server and upload the cookbook again to the chef server, then run chef-client and enjoy your copious output!

Oh, by the way, if you’re still reading and you like NERDtree, have a look at the following settings.  They’ve made my life a bit easier.

let NERDTreeShowBookmarks=1
let NERDTreeWinSize=20
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
set mouse=a
autocmd VimEnter * NERDTree | wincmd p

One thought on “Development Foo – using vim and sshfs to propel development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s