class AppArchetype::Template::Source

Source is an in memory representation of a template source

Attributes

files[R]
path[R]

Public Class Methods

new(path) click to toggle source

Creates a templatte source from path and initializes file array.

@param [String] path

# File lib/app_archetype/template/source.rb, line 12
def initialize(path)
  @path = path
  @files = []
end

Public Instance Methods

exist?() click to toggle source

Evaluates whether template source still exists.

@return [Boolean]

# File lib/app_archetype/template/source.rb, line 34
def exist?
  File.exist?(@path)
end
load() click to toggle source

Loads template files into memory. Will raise a RuntimeError if by the time we're loading the source no longer exists.

# File lib/app_archetype/template/source.rb, line 21
def load
  raise 'template source does not exist' unless exist?

  Dir.glob(File.join(@path, '**', '*')).each do |file|
    @files << file
  end
end