puppetlabs/packaging — pull request #261 by MosesMendoza (2014-02-11 01:04:17+00:00)
Title: (RE-998) Enable pre-tasks

We created a system for allowing you to specify a task defined in a project to
run prior to the tarball creation task ("package:tar"). However, this isn't
versatile enough to handle all of the potential use cases for task inserting
dependencies. We may want to define project-specific tasks at other points in
the dependency chain, and conditionally depending on the build target. The
specific use case is our apple packaging. We would like to specify in puppet
and facter a task to execute prior to the "package:apple" task - namely the
retrieval of vendored software like 'rgen' or 'CFPropertyList'. To support
this, we need to create a new system that allows you to name tasks and insert
them as dependencies of tasks you name. That is what this commit tries to do.
It adds a new set of utilities for interacting with Rake::Task objects,
including searching for and adding dependencies. It enables usage of this via
a new 'pre_tasks' parameter of the Pkg::Config object. Usage should be
via build_defaults.yaml or project_data.yaml, in the form:

pre_tasks:
'dependency_task':'depender_task'

or for our use facter case (assuming a task to retrieve CFPropertyList named
'retrieve_cfp'):

pre_tasks:
'retrieve_cfp': 'package:apple'

Signed-off-by: Moses Mendoza