From 5096abeface9f35846406d2e06d2c67ad34a1720 Mon Sep 17 00:00:00 2001 From: Bruno Tavares Date: Sun, 23 Feb 2014 13:23:25 -0300 Subject: [PATCH] Support for loading recipes and roles from modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modules are located under `modules` folder. They will be copied on deploy as well. An example structure: ``` sample ├── files ├── install.sh ├── modules │   └── another │   ├── files │   ├── install.sh │   ├── README.md │   ├── recipes │   └── roles │   └── web.sh ├── README.md ├── recipes └── roles ``` Roles and recipes will be available for your project to access it with the commited functions --- docs/kickstart/module/apply_recipe.md | 11 +++++++++++ docs/kickstart/module/apply_role.md | 11 +++++++++++ kickstart/recipes/kickstart/module.sh | 14 ++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 docs/kickstart/module/apply_recipe.md create mode 100644 docs/kickstart/module/apply_role.md create mode 100644 kickstart/recipes/kickstart/module.sh diff --git a/docs/kickstart/module/apply_recipe.md b/docs/kickstart/module/apply_recipe.md new file mode 100644 index 0000000..430bed1 --- /dev/null +++ b/docs/kickstart/module/apply_recipe.md @@ -0,0 +1,11 @@ +# kickstart.module.apply_recipe module_name recipe_name + +Apply `recipe_name` from `module_name`. +`module_name` is the name of the module under the `modules` folder. +`recipe_name` is the name of the recipe under the `modules/module_name/recipes/recipe_name.sh`, without the .sh + +### Example + +```bash +$ kickstart.module.apply_recipe kickstart-baseline gcc +``` diff --git a/docs/kickstart/module/apply_role.md b/docs/kickstart/module/apply_role.md new file mode 100644 index 0000000..2da0432 --- /dev/null +++ b/docs/kickstart/module/apply_role.md @@ -0,0 +1,11 @@ +# kickstart.module.apply_role module_name role_name + +Apply `role_name` from `module_name`. +`module_name` is the name of the module under the `modules` folder. +`role_name` is the name of the role under the `modules/module_name/roles/role_name.sh`, without the .sh + +### Example + +```bash +$ kickstart.module.apply_role kickstart-baseline haskell +``` diff --git a/kickstart/recipes/kickstart/module.sh b/kickstart/recipes/kickstart/module.sh new file mode 100644 index 0000000..0f74d0b --- /dev/null +++ b/kickstart/recipes/kickstart/module.sh @@ -0,0 +1,14 @@ +kickstart.module.apply_role() { + kickstart.module.apply_ $1 $2 roles +} + +kickstart.module.apply_recipe() { + kickstart.module.apply_ $1 $2 recipes +} + +kickstart.module.apply_() { + local cur_dir=`pwd`; + cd modules/$1 + source $3/$2.sh + cd $cur_dir +}