Class: Texas::Build::Task::CopyContentsToBuildPath

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

Overview

This build task copies all the templates in the current project's contents directory to the build directory.

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


13
14
15
# File 'lib/texas/build/task/copy_contents_to_build_path.rb', line 13

def build_path
  build.__path__
end

#contents_dirObject


17
18
19
# File 'lib/texas/build/task/copy_contents_to_build_path.rb', line 17

def contents_dir
  build.contents_dir
end

#copy_to_build_pathObject


26
27
28
29
# File 'lib/texas/build/task/copy_contents_to_build_path.rb', line 26

def copy_to_build_path
  FileUtils.rm_r build_path
  FileUtils.cp_r contents_dir, build_path
end

#ensure_build_path_existsObject


21
22
23
24
# File 'lib/texas/build/task/copy_contents_to_build_path.rb', line 21

def ensure_build_path_exists
  FileUtils.mkdir_p build_path
  rescue
end

#runObject


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

def run
  ensure_build_path_exists
  copy_to_build_path
end