Permalink
Browse files

Added templates to apidoc

  • Loading branch information...
1 parent ff80ced commit 583a79bc889d9a2b2f506d0a0430245b8aed9874 @lnguyen lnguyen committed Jan 24, 2012
Showing with 87 additions and 0 deletions.
  1. +15 −0 bin/templates/exists
  2. +49 −0 bin/templates/install
  3. +20 −0 bin/templates/seed
  4. +3 −0 templates/README.template
View
@@ -1 +1,16 @@
#!/bin/sh
+
+set -v # Turn on verbose logging, so that the following will present a tutorial.
+
+# templates module api is loaded with the line 'api/templates' in the shell/includes.
+
+# Templates exist is to check if template exist
+
+# See that template exist
+if templates exist "apidoc/README"
+then
+ log "The README template exist"
+else
+ log "The README template does not exist"
+fi
+
View
@@ -1 +1,50 @@
#!/bin/sh
+
+set -v # Turn on verbose logging, so that the following will present a tutorial.
+
+# templates module api is loaded with the line 'api/templates' in the shell/includes.
+
+# Templates install api can be used in following 4 ways
+# 1) Install templates with no variables passed in
+# 2) Install templates with variables passed in
+# 3) Install templates with ownership passed in
+# 4) Install templates with variables and ownership
+# The variables that can be passed in are defined as {{variable}} in the template
+# Ownership types are mode, owner, group
+# Note: namespace is required to use templates such as 'apidoc/README'
+
+
+# Install the template README with no variables passed in
+templates install "apidoc/README" to /tmp/README
+
+# View template created
+cat /tmp/README
+
+
+# Install the template README and set app name
+templates install "apidoc/README" to /tmp/README \
+ app_name "Test App name"
+
+# View template created
+cat /tmp/README
+
+# Install the template README and set ownership
+templates install "apidoc/README" to /tmp/README \
+ mode 0776 owner "${user}"
+
+# View ownership
+ls -lh /tmp/README
+
+# Install the template README and set app name and variable
+templates install "apidoc/README" to /tmp/README \
+ mode 0666 owner "${user}" \
+ app_name "Test App name"
+
+# View ownership
+ls -lh /tmp/README
+
+# View template created
+cat /tmp/README
+
+# Clean up
+file remove /tmp/README
View
@@ -1 +1,21 @@
#!/bin/sh
+
+set -v # Turn on verbose logging, so that the following will present a tutorial.
+
+# templates module api is loaded with the line 'api/templates' in the shell/includes.
+
+# Templates seed is used to set variables after template has been created
+
+# Setup initial template
+
+templates install 'apidoc/README' to /tmp/README
+
+# View initial template created
+cat /tmp/README
+
+# Set variable with templates seed
+templates seed /tmp/README \
+ app_name "My template seed"
+
+# Clean up
+file remove /tmp/README
@@ -0,0 +1,3 @@
+# This is an example template README file
+
+export app_name="{{app_name}}"

0 comments on commit 583a79b

Please sign in to comment.