diff --git a/youngjin.han/dot-cdist/manifest/init b/youngjin.han/dot-cdist/manifest/init index 1645f89..2bca0b6 100644 --- a/youngjin.han/dot-cdist/manifest/init +++ b/youngjin.han/dot-cdist/manifest/init @@ -4,6 +4,12 @@ case "$__target_host" in localhost) __motd __timezone Asia/Seoul +# __my_computer + __colourful_file --colour yellow + ;; + jafo.laptop) + __motd + __timezone Asia/Seoul __my_computer ;; esac 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