Class: BuildpackSupport::Rake::BuildpackStageTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- BuildpackSupport::Rake::BuildpackStageTask
- Defined in:
- lib/buildpack_support/rake/buildpack_stage_task.rb
Overview
A task generator for the tasks that copy files to the staging directory
Instance Attribute Summary collapse
-
#files ⇒ Array<String>
The files to copy to the
staging_dir
. -
#package_name ⇒ String
The name of the package.
-
#staging_dir ⇒ String
The directory to zip the contents of.
-
#verbose ⇒ Boolean
The verbosity of the task.
Instance Method Summary collapse
-
#initialize(&task_block) ⇒ BuildpackStageTask
constructor
Creates an instance.
-
#run_task(source, target, verbose) ⇒ void
Runs the task.
Constructor Details
#initialize(&task_block) ⇒ BuildpackStageTask
Creates an instance
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 44 def initialize(&task_block) @verbose = false task_block.call(*[self].slice(0, task_block.arity)) if task_block abort 'files must be configured' unless files abort 'package_name must be configured' unless package_name abort 'staging_dir must be configured' unless staging_dir create_copy_tasks files, package_name, staging_dir, verbose end |
Instance Attribute Details
#files ⇒ Array<String>
Returns the files to copy to the staging_dir
.
29 30 31 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 29 def files @files end |
#package_name ⇒ String
Returns the name of the package.
33 34 35 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 33 def package_name @package_name end |
#staging_dir ⇒ String
Returns the directory to zip the contents of.
37 38 39 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 37 def staging_dir @staging_dir end |
#verbose ⇒ Boolean
Returns the verbosity of the task. Defaults to false
.
41 42 43 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 41 def verbose @verbose end |
Instance Method Details
#run_task(source, target, verbose) ⇒ void
This method returns an undefined value.
Runs the task
61 62 63 64 65 66 |
# File 'lib/buildpack_support/rake/buildpack_stage_task.rb', line 61 def run_task(source, target, verbose) RakeFileUtils.verbose(verbose) do mkdir_p File.dirname(target) cp source, target end end |