Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

template resource now writes to a file

  • Loading branch information...
commit e50d1b99e1d3c590451010bf3fd0414fb9e46d4d 1 parent 4ae4123
Tom Bombadil authored
Showing with 14 additions and 2 deletions.
  1. +1 −0  .gitignore
  2. +4 −0 lib/_attributes
  3. +5 −1 lib/_template
  4. +4 −1 recipes/meh
View
1  .gitignore
@@ -0,0 +1 @@
+/tmp
View
4 lib/_attributes
@@ -40,4 +40,8 @@ attr_accessor mode
attr_accessor owner
attr_accessor group
attr_accessor path
+attr_accessor create_if_missing
+attr_accessor backup 5
+attr_accessor cookbook
attr_accessor sauce
+attr_accessor variables
View
6 lib/_template
@@ -16,9 +16,13 @@ function do_template_create {
local _dollar='$'
local pth_source="${_poop_sauce}"
- eval "cat <<EOF
+ local tmp_template="$(mktemp -t XXXXXXXXX)"
+ eval "cat > $tmp_template <<EOF
$(cat "${pth_source}" | perl -pe 's{\$\{(\w+)\}}{!!!/$1/!!!}g;
s{\$}{\${_dollar}}g;
s{!!!/(\w+)/!!!}{\${$1}}g;')
EOF"
+
+ install -v $(install_options)"$tmp_template" "${_poop_path}"
+ rm -f "$tmp_template"
}
View
5 recipes/meh
@@ -23,7 +23,10 @@ directory "meh"
action delete
end
+directory "tmp"
+end
+
name="David"
-template "hello.txt"
+template "tmp/hello.txt"
sauce "templates/feh"
end
Please sign in to comment.
Something went wrong with that request. Please try again.