Class: BuildpackSupport::Rake::DependencyCacheTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- BuildpackSupport::Rake::DependencyCacheTask
- Defined in:
- lib/buildpack_support/rake/dependency_cache_task.rb
Overview
A task generator for tasks that download and cache buildpack dependencies
Instance Attribute Summary collapse
-
#build_dir ⇒ String
The directory to caching log file into.
-
#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) ⇒ DependencyCacheTask
constructor
A new instance of DependencyCacheTask.
-
#run_task(target, verbose) ⇒ void
Runs the task.
Constructor Details
#initialize(&task_block) ⇒ DependencyCacheTask
Returns a new instance of DependencyCacheTask.
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 48 def initialize(&task_block) @verbose = true task_block.call(*[self].slice(0, task_block.arity)) if task_block abort 'build_dir must be configured' unless build_dir abort 'package_name must be configured' unless package_name abort 'staging_dir must be configured' unless staging_dir BuildpackSupport::Logging::LoggerFactory.instance.setup "#{build_dir}/" @cache = BuildpackSupport::Cache::DownloadCache.new(Pathname.new("#{staging_dir}/resources/cache")) create_cache_tasks package_name, verbose end |
Instance Attribute Details
#build_dir ⇒ String
Returns the directory to caching log file into.
34 35 36 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 34 def build_dir @build_dir end |
#package_name ⇒ String
Returns the name of the package.
38 39 40 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 38 def package_name @package_name end |
#staging_dir ⇒ String
Returns the directory to zip the contents of.
42 43 44 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 42 def staging_dir @staging_dir end |
#verbose ⇒ Boolean
Returns the verbosity of the task. Defaults to false
.
46 47 48 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 46 def verbose @verbose end |
Instance Method Details
#run_task(target, verbose) ⇒ void
This method returns an undefined value.
Runs the task
67 68 69 70 |
# File 'lib/buildpack_support/rake/dependency_cache_task.rb', line 67 def run_task(target, verbose) "Caching #{target}" if verbose @cache.get(target) {} end |