function make_generate_print

8.0.x generate.contents.make.inc make_generate_print($contents, $file = NULL)
7.x generate.contents.make.inc make_generate_print($contents, $file = NULL)
master generate.contents.make.inc make_generate_print($contents, $file = NULL)

Print the generated makefile to the terminal, or write it to a file.

Parameters

$contents: The formatted contents of a makefile.

$file: (optional) The path to write the makefile.

2 calls to make_generate_print()
drush_make_generate in commands/make/generate.make.inc
Drush callback; generate makefile from the current build.
make_generate_from_makefile in commands/make/generate.contents.make.inc
Write a makefile based on data parsed from a previous makefile.

File

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

Code

function make_generate_print($contents, $file = NULL) {
  if (!$file) {
    drush_print($contents);
  }
  elseif (file_put_contents($file, $contents)) {
    drush_log(dt("Wrote .make file @file", array('@file' => $file)), LogLevel::OK);
  }
  else {
    make_error('FILE_ERROR', dt("Unable to write .make file !file", array('!file' => $file)));
  }
}