Class: Texas::Build::Task::RunMasterTemplate

Inherits:
Base
  • Object
show all
Defined in:
lib/texas/build/task/run_master_template.rb

Overview

This build task finds and runs the master template.

Instance Attribute Summary

Attributes inherited from Base

#build

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from OutputHelper

#trace, #verbose, #warning

Constructor Details

This class inherits a constructor from Texas::Build::Task::Base

Instance Method Details

#find_master_template(possible_templates) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/texas/build/task/run_master_template.rb', line 8

def find_master_template(possible_templates)
  regexes = Template.handlers.keys
  valid_master_templates = possible_templates.select do |f| 
    regexes.any? { |regex| f =~ regex }
  end
  valid_master_templates.first
end

#runObject



16
17
18
19
20
# File 'lib/texas/build/task/run_master_template.rb', line 16

def run
  filename = find_master_template Dir[build.master_file+'*']
  master_template = Template.create(filename, build)
  master_template.write
end