Module: AppArchetype
- Defined in:
- lib/app_archetype.rb,
lib/app_archetype/cli.rb,
lib/app_archetype/logger.rb,
lib/app_archetype/version.rb,
lib/app_archetype/commands.rb,
lib/app_archetype/renderer.rb,
lib/app_archetype/template.rb,
lib/app_archetype/generators.rb,
lib/app_archetype/template/plan.rb,
lib/app_archetype/template/source.rb,
lib/app_archetype/template/helpers.rb,
lib/app_archetype/template_manager.rb,
lib/app_archetype/template/manifest.rb,
lib/app_archetype/template/variable.rb,
lib/app_archetype/commands/print_path.rb,
lib/app_archetype/commands/new_template.rb,
lib/app_archetype/commands/open_manifest.rb,
lib/app_archetype/commands/print_version.rb,
lib/app_archetype/commands/find_templates.rb,
lib/app_archetype/commands/list_templates.rb,
lib/app_archetype/commands/delete_template.rb,
lib/app_archetype/commands/render_template.rb,
lib/app_archetype/template/variable_manager.rb,
lib/app_archetype/commands/print_template_variables.rb
Overview
AppArchetype is the namespace for app_archetype
Defined Under Namespace
Modules: Commands, Generators, Logger, Template Classes: CLI, Renderer, TemplateManager
Constant Summary collapse
- VERSION =
AppArchetype version
'1.5.4'.freeze
Class Method Summary collapse
-
.render_template(collection_dir: ENV.fetch('ARCHETYPE_TEMPLATE_DIR'), template_name: '', destination_path: '', overwrite: false, variables: nil) ⇒ AppArchetype::Template::Manifest
Self contained template render method.
Class Method Details
.render_template(collection_dir: ENV.fetch('ARCHETYPE_TEMPLATE_DIR'), template_name: '', destination_path: '', overwrite: false, variables: nil) ⇒ AppArchetype::Template::Manifest
Self contained template render method
Takes collection directory and template name to load a new manager and find the desired template
Then executes a render template command with the found template
Returns the manifest rendered. Target can optionally be set to overwrite
This method is to be used for self contained rendering# scripts.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/app_archetype.rb', line 37 def self.render_template( collection_dir: ENV.fetch('ARCHETYPE_TEMPLATE_DIR'), template_name: '', destination_path: '', overwrite: false, variables: nil ) manager = AppArchetype::TemplateManager.new(collection_dir) manager.load manifest = manager.find_by_name(template_name) manifest.variables = variables unless variables.nil? template = manifest.template template.load = Hashie::Mash.new( name: template_name, overwrite: overwrite ) command = AppArchetype::Commands::RenderTemplate.new( manager, destination_path, ) command.run manifest end |