function DrushMakeProject::processGitInfoFiles

8.0.x make.project.inc DrushMakeProject::processGitInfoFiles()
6.x make.project.inc DrushMakeProject::processGitInfoFiles()
7.x make.project.inc DrushMakeProject::processGitInfoFiles()
5.x make.project.inc DrushMakeProject::processGitInfoFiles()
master make.project.inc DrushMakeProject::processGitInfoFiles()

Process info files when downloading things from git.

1 call to DrushMakeProject::processGitInfoFiles()
DrushMakeProject::make in commands/make/make.project.inc
Build a project.

File

commands/make/make.project.inc, line 344
Drush Make processing classes.

Class

DrushMakeProject
The base project class.

Code

function processGitInfoFiles() {
  // Bail out if this isn't hosted on Drupal.org (unless --force-gitinfofile option was specified).
  if (!drush_get_option('force-gitinfofile', FALSE) && isset($this->download['url']) && strpos($this->download['url'], 'drupal.org') === FALSE) {
    return;
  }

  // Figure out the proper version string to use based on the .make file.
  // Best case is the .make file author told us directly.
  if (!empty($this->download['full_version'])) {
    $full_version = $this->download['full_version'];
  }
  // Next best is if we have a tag, since those are identical to versions.
  elseif (!empty($this->download['tag'])) {
    $full_version = $this->download['tag'];
  }
  // If we have a branch, append '-dev'.
  elseif (!empty($this->download['branch'])) {
    $full_version = $this->download['branch'] . '-dev';
  }
  // Ugh. Not sure what else we can do in this case.
  elseif (!empty($this->download['revision'])) {
    $full_version = $this->download['revision'];
  }
  // Probably can never reach this case.
  else {
    $full_version = 'unknown';
  }

  // If the version string ends in '.x-dev' do the Git magic to figure out
  // the appropriate 'rebuild version' string, e.g. '7.x-1.2+7-dev'.
  $matches = array();
  if (preg_match('/^(.+).x-dev$/', $full_version, $matches)) {
    require_once dirname(__FILE__) . '/../pm/package_handler/git_drupalorg.inc';
    $rebuild_version = drush_pm_git_drupalorg_compute_rebuild_version($this->download_location, $matches[1]);
    if ($rebuild_version) {
      $full_version = $rebuild_version;
    }
  }
  require_once dirname(__FILE__) . '/../pm/pm.drush.inc';
  if (drush_shell_cd_and_exec($this->download_location, 'git log -1 --pretty=format:%ct')) {
    $output = drush_shell_exec_output();
    $datestamp = $output[0];
  }
  else {
    $datestamp = time();
  }
  drush_pm_inject_info_file_metadata($this->download_location, $this->name, $full_version, $datestamp);
}