robbyrussell/oh-my-zsh — pull request #1682 by maplebed (2013-04-01 20:48:52+00:00)
Title: Allow you to customize the path to knife config files

The path to knife.rb is currently harcoded to $HOME/.chef/knife.rb. Mine lives elsewhere.
Set KNIFE_CONF_PATH in your .zshrc to override $HOME/.chef/knife.rb. Not setting that variable leaves it as it behaved before.
The plugin attempts to get the path to the cookbooks from the knife.rb conf file. However, the knife.rb conf allows ruby in the cookbook_path definition (in my case cookbook_path is "#{current_dir}/../cookbooks"). Since zsh is not using ruby to parse the conf file, it fails to expand variables like #{current_dir}. Rather than try and use ruby to interpret knife.rb (which is scary), I added an override for the cookbook directory. Set KNIFE_COOKBOOK_PATH in your .zshrc to skip examining knife.rb for the cookbook_path.