
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Lets you generate directory structures from a template, optionally processing paths (variables in the path) and contents (e.g., render ERB templates).
gem install directory_template
The examples given below are working examples. The templates are part of the gem and can be found in the directory 'examples'.
Create a template from an existing structure and materialize it (create directories & files):
require 'directory_template'
variables = {
namespace: 'Namespace',
version: '1.2.3',
gem_name: 'gem-name',
require_name: 'require_name',
description: "The description",
summary: "The summary"
}
template = DirectoryTemplate.directory('examples/dir_gem_template')
template.materialize('new_project', variables: variables)
Create a template from a YAML file:
require 'directory_template'
variables = {
namespace: 'Namespace',
version: '1.2.3',
gem_name: 'gem-name',
require_name: 'require_name',
description: "The description",
summary: "The summary"
}
template = DirectoryTemplate.yaml_file('examples/yaml_gem_template.yaml')
template.materialize('new_project', variables: variables)
DirectoryTemplate is a library which lets you generate directory structures and files from a template structure. The template structure can be a real directory structure on the filesystem, or it can be stored in a yaml file. Take a look at the examples directory in the gem to get an idea, how a template can look.
When generating a new directory structure from a template, DirectoryTemplate will process
the pathname of each directory and file using the DirectoryTemplate#path_processor.
It will also process the contents of each file with all processors that apply to a given
file.
The standard path processor allows you to use %{variables}
in pathnames. The gem comes
with a .erb (renders ERB templates) and .html.markdown processor (renders markdown to
html).
You can use the existing processors or define your own ones.
Also take a look at the {file:documentation/ContentProcessors.markdown Content Processors Guide} and the {file:documentation/ContentProcessors.markdown Path Processors Guide}.
You can use this code under the {file:LICENSE.txt BSD-2-Clause License}, free of charge. If you need a different license, please ask the author.
FAQs
Unknown package
We found that directory_template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.