Skip to content

Instantly share code, notes, and snippets.

@andrewgross
Created April 26, 2013 02:34
Show Gist options
  • Save andrewgross/5464750 to your computer and use it in GitHub Desktop.
Save andrewgross/5464750 to your computer and use it in GitHub Desktop.
Sampling of some Chef Glue
function download_cookbook() {
cookbook=${1}
if _check_input ${cookbook}
then
_clone_cookbook ${cookbook}
_link_cookbook_files ${cookbook}
cd ${CHEF_PATH}/cookbooks/${cookbook}
make install
else
return 1
fi
}
function create_cookbook() {
cookbook=${1}
if _check_input ${cookbook}
then
_clone_cookbook ${cookbook} clean
rm -rf ${CHEF_PATH}/cookbooks/${cookbook}/.git
git init ${CHEF_PATH}/cookbooks/${cookbook}
_link_cookbook_files ${cookbook}
cd ${CHEF_PATH}/cookbooks/${cookbook}
make install
find . -type f -exec sed -i '' "s/cookbook_base/$cookbook/g" {} \;
git add .
git commit -m "Initial Commit" --no-verify
git remote add origin git@github.com:yipit-cookbooks/${cookbook}.git
else
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment