Skip to content

Instantly share code, notes, and snippets.

@EugenMayer
Created February 5, 2012 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EugenMayer/1747142 to your computer and use it in GitHub Desktop.
Save EugenMayer/1747142 to your computer and use it in GitHub Desktop.
/**
* Write packaging information for a release.
*/
function write_package_info($tag, $exclude_mask = array('.', '..', 'CVS')) {
if (isset($this->backend)) {
$fserver_url = url("fserver", array('purl' => array('disabled' => TRUE), 'absolute' => TRUE));
$packaging = array();
$packaging[] = "; Information added by fserver";
$packaging[] = "core = \"{$tag['core']}\"";
$packaging[] = "datestamp = \"{$tag['timestamp']}\"";
$packaging[] = "project = \"{$this->name}\"";
$packaging[] = "project status url = \"{$fserver_url}\"";
$packaging[] = "version = \"{$tag['version']}\"";
$packaging = "\n" . implode("\n", $packaging);
$files = file_scan_directory($this->backend->path, '.info$', $exclude_mask);
foreach ($files as $path => $file) {
// @TODO: Parse the info file or not?
$info_file = file_get_contents($file->filename);
$info_file .= $packaging;
file_put_contents($file->filename, $info_file);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment