Class: Generamba::TemplateHelper
- Inherits:
-
Object
- Object
- Generamba::TemplateHelper
- Defined in:
- lib/generamba/helpers/template_helper.rb
Overview
Provides a number of helper methods for manipulating Generamba template files
Class Method Summary collapse
-
.obtain_path(template_name) ⇒ Pathname
Returns a file path for a specific template folder.
-
.obtain_spec(template_name) ⇒ Pathname
Returns a file path for a specific template .rambaspec file.
Class Method Details
.obtain_path(template_name) ⇒ Pathname
Returns a file path for a specific template folder
19 20 21 22 23 24 25 26 27 28 |
# 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) ⇒ Pathname
Returns a file path for a specific template .rambaspec file
8 9 10 11 12 13 |
# 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 |