Table of Contents
Need documantation for template in English. Japanese
$ ros template
Usage: ros template [subcommand]
init Create new template
deinit Remove a template
list List the installed templates
checkout Checkout default template to edit.
add Add files to template.
cat Show file contents
edit Edit file contents
rm Remove (delete) files from template.
delete Remove (delete) files from template.
type Set template type for a file.
chmod Set mode for a file.
rewrite Set path rewrite rule for a file
export Export template to directory
import Import template
help Print usage and subcommands description
Creating a simple template
$ ros template checkout
current default is "default"
candidates:
default
$ ros template init sample
$ ros template checkout
current default is "default"
candidates:
default
sample
$ ros template checkout sample
$ ros template checkout
current default is "sample"
candidates:
default
sample
$ echo "Hello Template!!" > test
$ ros template add test
$ ros template list
copy test
$ ros template cat test
Hello Template!!
$ mkdir example
$ cd example/
$ ros init sample some-project
$ ls
test
$ cat test
Hello Template!!
Using Djula template variables
Set of variables available by default:
- name: project name (specified when you instantiate a template with
ros init <template> <name>) - author: obtained from
git configor$(whoami) - email: obtained from
git configor$(whoami)@$(hostname) - get_universal_time: obtained from get-universal-time`
First, let's try the filename rewriting rule.
$ ros template rewrite test "{{ name }}.txt"
$ ros template list
copy test -> "{{ name }}.txt"
$ ros init sample sample-project
$ ls
sample-project.txt
$ cat sample-project.txt
Hello Template!!
Next, we prepare a file for testing the rewriting rules applied to file contents.
$ cat<<EOF > test
Hello {{ sample }}!!
name: {{ name }}
author: {{ author }}
email: {{ email }}
universal time: {{ universal_time }}
EOF
$ ros template add test # overwrite test
$ ros template cat test
Hello {{ sample }}!!
name: {{ name }}
author: {{ author }}
email: {{ email }}
universal time: {{ universal_time }}
To process the variables in a file using djula, we must set the template type of the file to djula from copy (the default).
$ ros template type djula test
$ ros template list
djula test -> "{{ name }}.txt"
User-defined variables can be specified as a command line option (--sample here).
$ ros init sample some-project --sample Ikaruga
$ ros template cat test
Hello Ikaruga!!
name: some-project
author: eshamster
email: hamgoostar@gmail.com
universal time: 3727259379
When operated without the second argument, ros template type updates the default processing type.
When operated with no argument, ros template type shows the current default processing type.
$ ros template type
current default type is "copy"
$ ros template type djula
$ ros template type
current default type is "djula"
import / export
ros template export will dump the template files into the current directory.
The result contains a special .asd file that contains its metadata.
ros template import will update the current template (available ros template checkout)
using the metadata (.asd file) in the current directory.
Home
Getting started / Tutorials
- Installation
- Initial Recommended Setup
- Roswell as a Scripting Environment
- ros template
- Set up guide for Anaconda virtual env
Advanced Installation
Roswell as a scripting environment
- Roswell as a Scripting Environment
- Advanced scripting
- Reducing Startup Time
- List of Roswell Installable Scripts
- Practical Usecases
- Building images and executables
Roswell as an implementation manager
Roswell as a Testing Environment
- Roswell as a Testing Environment
- Travis CI
- Circle CI
- GitHub Actions
- Coveralls
- Roswell in Virtual Environments