class Generamba::TemplateHelper

Provides a number of helper methods for manipulating Generamba template files

Public Class Methods

obtain_path(template_name) click to toggle source

Returns a file path for a specific template folder @param template_name [String] The Generamba template name

@return [Pathname]

# File lib/generamba/helpers/template_helper.rb, line 19
def self.obtain_path(template_name)
  path = Pathname.new(Dir.getwd)
                 .join(TEMPLATES_FOLDER)
                 .join(template_name)

  error_description = "Cannot find template named #{template_name}! Add it to the Rambafile and run *generamba template install*".red
  raise StandardError, error_description unless path.exist?

  path
end
obtain_spec(template_name) click to toggle source

Returns a file path for a specific template .rambaspec file @param template_name [String] The Generamba template name

@return [Pathname]

# File lib/generamba/helpers/template_helper.rb, line 8
def self.obtain_spec(template_name)
  template_path = self.obtain_path(template_name)
  spec_path = template_path.join(template_name + RAMBASPEC_EXTENSION)

  spec_path
end