function _drush_make_generate_makefile_body

8.0.x generate.contents.make.inc _drush_make_generate_makefile_body($projects, $output = array())
6.x generate.make.inc _drush_make_generate_makefile_body($projects, $output = array())
7.x generate.contents.make.inc _drush_make_generate_makefile_body($projects, $output = array())
5.x generate.make.inc _drush_make_generate_makefile_body($projects, $output = array())
master generate.contents.make.inc _drush_make_generate_makefile_body($projects, $output = array())
1 call to _drush_make_generate_makefile_body()
_drush_make_generate_makefile_contents in commands/make/generate.contents.make.inc
Generate the actual contents of the .make file.

File

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

Code

function _drush_make_generate_makefile_body($projects, $output = array()) {
  $custom = FALSE;
  $previous_type = 'core';
  if (isset($projects)) {
    foreach ($projects as $name => $project) {
      $type = (isset($project['type']) && ($project['type'] == 'library')) ? 'libraries' : 'projects';
      if ($previous_type != $project['_type']) {
        $previous_type = $project['_type'];
        $output[] = '; ' . ucfirst($previous_type) . 's';
      }
      unset($project['_type']);
      if (!$project && is_string($name)) {
        $output[] = $type . '[] = "' . $name . '"';
        continue;
      }
      $base = $type . '[' . $name . ']';
      if (isset($project['custom_download'])) {
        $custom = TRUE;
        $output[] = '; Please fill the following out. Type may be one of get, git, bzr or svn,';
        $output[] = '; and url is the url of the download.';
        $output[$base . '[download][type]'] = '""';
        $output[$base . '[download][url]'] = '""';
        unset($project['custom_download']);
      }

      $output = array_merge($output, _drush_make_generate_lines($base, $project));
      $output[] = '';
    }
  }
  $string = '';
  foreach ($output as $k => $v) {
    if (!is_numeric($k)) {
      $string .= $k . ' = ' . $v;
    }
    else {
      $string .= $v;
    }
    $string .= "\n";
  }
  if ($custom) {
    drush_log(dt('Some of the properties in your makefile will have to be manually edited. Please do that now.'), LogLevel::WARNING);
  }
  return $string;
}