function _drush_pm_generate_info_yaml_metadata

8.0.x pm.drush.inc _drush_pm_generate_info_yaml_metadata($version, $project_name)
7.x pm.drush.inc _drush_pm_generate_info_yaml_metadata($version, $project_name)
master pm.drush.inc _drush_pm_generate_info_yaml_metadata($version, $project_name, $datestamp)

Generate version information for `.info` files in YAML format.

1 call to _drush_pm_generate_info_yaml_metadata()
drush_pm_inject_info_file_metadata in commands/pm/pm.drush.inc
Inject metadata into all .info files for a given project.

File

commands/pm/pm.drush.inc, line 2267
The drush Project Manager

Code

function _drush_pm_generate_info_yaml_metadata($version, $project_name) {
  $matches = array();
  $extra = '';
  if (preg_match('/^((\d+)\.x)-.*/', $version, $matches) && $matches[2] >= 6) {
    $extra .= "\ncore: '$matches[1]'";
  }
  if (!drush_get_option('no-gitprojectinfo', FALSE)) {
    $extra = "\nproject: '$project_name'";
  }
  $time = time();
  $date = date('Y-m-d');
  $info = <<<METADATA

# Information added by drush on {$date}
version: '{$version}'{$extra}
datestamp: {$time}
METADATA;
  return $info;
}