function drush_make_convert

8.0.x make.drush.inc drush_make_convert($makefile)
7.x make.drush.inc drush_make_convert($makefile)
master make.drush.inc drush_make_convert($source)

Command callback; convert ini makefile to YAML.

File

commands/make/make.drush.inc, line 377
Drush Make commands.

Code

function drush_make_convert($makefile) {

  drush_log(dt('Beginning to convert !makefile.', array('!makefile' => $makefile)), LogLevel::OK);

  $file = $makefile . '.yml';
  $info = make_parse_info_file($makefile);
  // Remove incorrect value.
  unset($info['format']);

  $dumper = drush_load_engine('outputformat', 'yaml');
  $yaml = $dumper->format($info, array());

  if (file_put_contents($file, $yaml)) {
    drush_log(dt("Wrote make file @file", array('@file' => $file)), LogLevel::OK);
    return $file;
  }
  else {
    make_error('FILE_ERROR', dt("Unable to write file !file", array('!file' => $file)));
  }
}