function _drush_generate_track_version

8.0.x generate.make.inc _drush_generate_track_version($project, $version_options)
6.x generate.make.inc _drush_generate_track_version($project, $version_options)
7.x generate.make.inc _drush_generate_track_version($project, $version_options)
5.x generate.make.inc _drush_generate_track_version($project, $version_options)
master generate.make.inc _drush_generate_track_version($project, $version_options)

Helper function to determine if a given project is to have its version tracked.

2 calls to _drush_generate_track_version()
_drush_generate_custom_project in commands/make/generate.make.inc
Create a project record for an extension not downloaded from drupal.org
_drush_make_generate_projects in commands/make/generate.make.inc
Generate the $projects makefile array for the current site.

File

commands/make/generate.make.inc, line 264
Functions for the generate makefile command.

Code

function _drush_generate_track_version($project, $version_options) {
  // A. If --exclude-versions has been specified:
  // A.a. if it's a boolean, check the --include-versions option.
  if ($version_options["exclude"] === TRUE) {
    // A.a.1 if --include-versions has been specified, ensure it's an array.
    if (is_array($version_options["include"])) {
      return in_array($project, $version_options["include"]);
    }
    // A.a.2 If no include array, then we're excluding versions for ALL
    // projects.
    return FALSE;
  }
  // A.b. if --exclude-versions is an array with items, check this project is in
  // it: if so, then return FALSE.
  elseif (is_array($version_options["exclude"]) && count($version_options["exclude"])) {
    return !in_array($project, $version_options["exclude"]);
  }

  // B. If by now no --exclude-versions, but --include-versions is an array,
  // examine it for this project.
  if (is_array($version_options["include"]) && count($version_options["include"])) {
    return in_array($project, $version_options["include"]);
  }

  // If none of the above conditions match, include version number by default.
  return TRUE;
}