Class: Texas::Build::Task::AddDefaultTemplatesToBuildPath

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

Overview

This build task copies those templates from Texas’ own template directory that are still missing in the current project’s build directory (e.g. the preambel partial)

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

#build_pathObject



9
10
11
# File 'lib/texas/build/task/add_default_templates_to_build_path.rb', line 9

def build_path
  build.__path__
end

#runObject



13
14
15
16
17
18
19
20
21
# File 'lib/texas/build/task/add_default_templates_to_build_path.rb', line 13

def run
  glob = File.join(Texas.texas_dir, Texas.contents_subdir_name, '*.*')
  Dir[glob].each do |filename|
    dest = File.join(build_path, File.basename(filename))
    unless File.exists?(dest)
      FileUtils.cp filename, build_path
    end
  end
end