Sha256: b0cf3728892f0efba18165da9aed3584782947c0aff1f2d2c264ba1c40a50809
Contents?: true
Size: 897 Bytes
Versions: 4
Compression:
Stored size: 897 Bytes
Contents
require 'thor' require 'forwardable' module Hanami module Generators class Generator extend Forwardable def_delegators :@processor, :run, :behavior=, :inject_into_file, :append_to_file, :prepend_to_file class Processor < Thor include Thor::Actions end def initialize(template_source_path, target_path) @template_source_path = template_source_path @target_path = target_path @template_mappings = [] @processor = Processor.new @processor.class.source_root(@template_source_path) end def add_mapping(source, target) @template_mappings << [source, target] end def process_templates(options = {}) @template_mappings.each do |src, dst| @processor.template(@template_source_path.join(src), @target_path.join(dst), options) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems