From 44f72d34f842e1b9f13000a3ee986457e03028cc Mon Sep 17 00:00:00 2001 From: Youngjin Han Date: Sat, 9 May 2020 00:25:57 +0900 Subject: [PATCH] Learning Circle : cdist #3 initial commit --- .../type/__colourful_file/file/colourful | 9 ++++++++ .../dot-cdist/type/__colourful_file/manifest | 14 +++++++++++++ .../type/__colourful_file/parameter/optional | 1 + .../dot-cdist/type/__colourful_file/singleton | 0 youngjin.han/learning-node02-2020.org | 21 +++++++++++++++++++ 5 files changed, 45 insertions(+) create mode 100644 youngjin.han/dot-cdist/type/__colourful_file/file/colourful create mode 100644 youngjin.han/dot-cdist/type/__colourful_file/manifest create mode 100644 youngjin.han/dot-cdist/type/__colourful_file/parameter/optional create mode 100644 youngjin.han/dot-cdist/type/__colourful_file/singleton diff --git a/youngjin.han/dot-cdist/type/__colourful_file/file/colourful b/youngjin.han/dot-cdist/type/__colourful_file/file/colourful new file mode 100644 index 0000000..79fda42 --- /dev/null +++ b/youngjin.han/dot-cdist/type/__colourful_file/file/colourful @@ -0,0 +1,9 @@ +colour=\ +yellow\ +black\ +white\ +grey\ +puple\ +green\ +red\ +blue \ No newline at end of file diff --git a/youngjin.han/dot-cdist/type/__colourful_file/manifest b/youngjin.han/dot-cdist/type/__colourful_file/manifest new file mode 100644 index 0000000..7248b48 --- /dev/null +++ b/youngjin.han/dot-cdist/type/__colourful_file/manifest @@ -0,0 +1,14 @@ +#!/bin/sh -e + +__file ~/colourful +printf "colour=" > ~/colourful + +# parameter with multiple values +if [ -f "$__object/parameter/colour" ]; then + colour="$(cat "$__object/parameter/colour")" + echo $colour >> ~/colourful +# for alias in $(cat "$__object/parameter/colour"); do +# echo $alias >> ~/colourful +# done +fi + diff --git a/youngjin.han/dot-cdist/type/__colourful_file/parameter/optional b/youngjin.han/dot-cdist/type/__colourful_file/parameter/optional new file mode 100644 index 0000000..b0d95fa --- /dev/null +++ b/youngjin.han/dot-cdist/type/__colourful_file/parameter/optional @@ -0,0 +1 @@ +colour diff --git a/youngjin.han/dot-cdist/type/__colourful_file/singleton b/youngjin.han/dot-cdist/type/__colourful_file/singleton new file mode 100644 index 0000000..e69de29 diff --git a/youngjin.han/learning-node02-2020.org b/youngjin.han/learning-node02-2020.org index 1fb6d2c..fa69ac2 100644 --- a/youngjin.han/learning-node02-2020.org +++ b/youngjin.han/learning-node02-2020.org @@ -1,3 +1,24 @@ +* 2020-05-08 +*** cdist #3: type parameters +**** Lecture content +***** TODO Create a new type named *__colourful_file* +****** TODO The objective is to create a type that creates colourful file +****** TODO The content of the file should be "colour=...", where "..." is a colour specified by a parameter +****** TODO Add an *optional parameter* named *colour* +****** TODO Use the **__file** type inside your type to create a file +****** TODO Use the *$__object_id* variable inside your type +***** TODO Extend your type to be more colourful +****** TODO Modify the *optional parameter* to be able to be specified *multiple times* +****** TODO For each time it is specified, add a line "colour=..." to the file +***** TODO Create a new type *__my_dotfiles* +****** TODO Objective is to manage the dotfiles in your home directory +****** TODO Make it a *singleton* type +****** TODO Create a sub directory *files* in the type +****** TODO Add your .emacs config to the files folder +****** TODO Add a *for* loop to your type to deploy .[A-z]* to your home directory +****** TODO Add a .bashrc or .zshrc to the files folder (depending on your shell) +****** TODO In the initial manifest, add __my_dotfiles when the target host is localhost +***** TODO As usual commit all changes to your ungleich-learning-circle repo * 2020-05-06 ** cdist #2: Your first cdist type **** Lecture content