if (!array_key_exists($mod, $full_tar_balls)) { continue; } $tar_ball = "{$tmp_dir_base}/{$mod}-full-{$release}.tar.bz2"; $created_tarballs[$mod][$mod . ' Full'] = $tar_ball; $cmd = "cd {$tmp_dir} && tar -cj --exclude=.bzr* -f {$tar_ball} " . $full_tar_balls[$mod]; I2CE::raiseError("Creating {$tar_ball}"); exec($cmd); } $tar_ball = "{$tmp_dir_base}/ihris-suite-{$release}.tar.bz2"; $created_tarballs['I2CE'][] = $tar_ball; I2CE::raiseError("Creating {$tar_ball}"); $cmd = "cd {$tmp_dir} && tar -cj {$excludes} -f {$tar_ball} " . implode(" ", array_keys($top_mod_dirs)); exec($cmd); } if ($ask_upload && simple_prompt("Upload tarballs to launchpad?")) { $do_upload = null; foreach ($created_tarballs as $top_mod => $tar_balls) { $project = strtolower($top_mod); if ($do_versioning) { $version = $last_release[$mod]['next_release']; } else { $version = $last_release[$top_mod]['release']; } $series = implode(".", array_slice(explode(".", $version), 0, 2)); if (!createRelease($project, $series, $version)) { continue; } foreach ($tar_balls as $base => $tar_ball) { if (!prompt("Upload tarball to launchpad ({$tar_ball})?", $do_upload)) { continue;
} $changed_text = false; $has_trans = false; $already_changed = null; for ($i = 0; $i < $results->length; $i++) { $node = $results->item($i); $text = trim($node->textContent); $key = false; if ($node->tagName == 'value' && $node->parentNode->getAttribute('type') == 'delimited') { list($key, $text) = explode(':', $text); } $trans = translate($text); if ($trans === false) { continue; } if (!$already_changed && !simple_prompt("Update the config file {$config_file} with the new source text?")) { $changed_text = false; break; } $already_changed = true; //we have a translation. first make sure we can do a version bump on a value node if ($node->tagName == 'value') { $pNode = $node->parentNode; $ver_results = $xpath->query('version', $pNode); if ($ver_results->length == 1) { //we have an existing version $verNode = $ver_results->item(0); while ($versNode->hasChildNodes()) { $versNode->removeChild($versNode->firstChild); } $versNode->appendChild($dom->createTextNode($bump_module_version));
<?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "CLI.php"; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "base.php"; $base_vers = false; if (simple_prompt("Is this a minor version bump (e.g. 4.0.5.X -> 4.0.6.0)?")) { $bump_type = 2; $base_vers = ask("What is the target minor version (e.g. 4.0.6)?"); } else { if (simple_prompt("Is this a major version bump (4.0.X -> 4.1.0)?")) { $bump_type = 1; $base_vers = ask("What is the target major version (e.g. 4.1)?"); } else { if (simple_prompt("Is this a fanastic version bump (4.X -> 5.0)?")) { $bump_type = 0; $base_vers = ask("What is the target fantastic version (e.g. 5)?"); } else { die("I don't know what you want to do\n"); } } } $base_vers = trim($base_vers); $base_vers_comps = explode('.', $base_vers); if (count($base_vers_comps) != $bump_type + 1) { die("Invalid target version ({$base_vers})\n"); } $check_vers_comps = $base_vers_comps; $check_vers_comps[$bump_type]--; $check_vers = implode('.', $check_vers_comps); $check_short_vers = implode('.', array_slice($base_vers_comps, 0, $bump_type)); $new_vers_comps = $base_vers_comps;
break; } } } } $deb_src_dir = $tmp_dir_base . '/debs'; if (!is_dir($deb_src_dir)) { if (!$booleans['prompt'] || simple_prompt("Create {$deb_src_dir}?")) { exec("mkdir -p {$deb_src_dir}"); } else { die("No place to store stuff"); } } $branches_dir = $tmp_dir_base . DIRECTORY_SEPARATOR . 'branch'; if (!is_dir($branches_dir)) { if (!$booleans['prompt'] || simple_prompt("Create {$branches_dir}?")) { exec("mkdir -p {$branches_dir}"); } else { die("No place to store branches"); } } $uncommitted = null; if (count($arg_files) == 0) { $t_dirs = glob("*", GLOB_ONLYDIR); } else { $t_dirs = $arg_files; } I2CE::raiseError("Searching:\n\t" . implode("\n\t", $t_dirs)); $top_dirs = array(); foreach ($t_dirs as $i => $dir) { $ret = 0;
function getFormObjByFields($form, $fields, $create = false, $parent = false, $id = '0') { global $always_create; if (!is_array($fields) || count($fields) == 0) { I2CE::raiseError("No fields to lookup form {$form} on"); return false; } $where = array('operator' => 'AND', 'operand' => array()); foreach ($fields as $field => $val) { if ($field == 'name') { $where['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => $field, 'style' => 'lowerlike', 'data' => array('value' => $val)); } else { $where['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => $field, 'style' => 'equals', 'data' => array('value' => $val)); } } $formObj = getFormObjByWhere($form, $where); if ($formObj instanceof I2CE_Form) { return $formObj; } if (is_string($create)) { $str = "Create the form `{$form}` with the fields:\n"; foreach ($fields as $f => $v) { $str .= "\t{$f} => '{$v}'\n"; } if ($create == 'simple_prompt') { $create = simple_prompt($str); } else { if ($create == 'prompt') { if (!array_key_exists($form, $always_create)) { $always_create[$form] = null; } $create = prompt($str, $always_create[$form]); } else { I2CE::raiseError("Unrecognized creation", E_USER_ERROR); return false; } } } if (!$create) { return null; } $formObj = createFormWithFields($form, $fields, $parent, $id); if (!$formObj instanceof I2CE_Form) { return null; } //try to create the object return $formObj; }
$is_dev = true; $title_append = wikiGetVersionedTitleAppend('Development'); $create_redirects = false; $versions = array('i2ce' => $main_version, 'manage' => $main_version, 'common' => $main_version, 'qualify' => $main_version, 'textlayout' => $main_version); foreach ($versions as $pkg => $vers) { $vers = substr($vers, 0, strrpos($vers, '.')); $versions[$pkg] = $vers . '-dev'; $packages[$pkg]['bzr'] = 'https://launchpad.net/' . $packages[$pkg]['pkg_name']; $packages[$pkg]['bzr_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-dev/files/head:"; $packages[$pkg]['bzr_annotate_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-dev/annotate/head:"; $packages[$pkg]['bzr_translate'] = "http://translations.launchpad.net/" . $packages[$pkg]['pkg_name'] . "/trunk/+pots/"; } } else { $is_dev = false; $title_append = wikiGetVersionedTitleAppend($main_version); $create_redirects = simple_prompt("Redirect all pages to this version?"); $versions = array('i2ce' => $main_version, 'manage' => $main_version, 'common' => $main_version, 'qualify' => $main_version, 'textlayout' => $main_version); foreach ($versions as $pkg => $vers) { $versions[$pkg] = $vers . '-release'; $packages[$pkg]['bzr'] = 'https://launchpad.net/' . $packages[$pkg]['pkg_name']; $packages[$pkg]['bzr_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-release/files/head:"; $packages[$pkg]['bzr_annotate_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-release/annotate/head:"; $packages[$pkg]['bzr_translate'] = "http://translations.launchpad.net/" . $packages[$pkg]['pkg_name'] . "/trunk/+pots/"; } } /************************************* * * processing of modules * *******************************************/ $found_modules = getAvailableModules();
} foreach ($cout as $class => &$text) { $text = preg_replace_callback('/{\\s*@link\\s+(\\$?[0-9a-z_]+)\\s*(.*?)\\s*}/i', 'possibleInternalReferenceLink', $text); $text = preg_replace_callback('/{{SHOWFORMFIELDS:(.*?)}}/', 'replaceFormFields', $text); $text = preg_replace_callback('/{{SHOWINHERITENCE:(.*?):(.*?)}}/', 'replaceInheritence', $text); $text = preg_replace_callback('/{{MAYBECLASS:.*?}}/', 'replaceMaybeClass', $text); } unset($text); /****************************** * Upload the articles we craeted to the wiki *******************************/ if ($do_wiki_class) { while ($class = trim(ask("Enter a class to preview (blank for none)"))) { if (array_key_exists($class, $cout)) { echo $cout[$class] . "\n"; if (simple_prompt("Would you like to upload this to the wiki?")) { if (!wikiUploadVersioned($cout[$class])) { I2CE::raiseError("Could not upload {$class}"); } else { I2CE::raiseError("Uploaded {$class}"); } } } else { echo "No such class ({$class})\n"; } } } $upload = null; if ($do_wiki_translation && prompt("Upload translation lists to wiki?", $upload)) { foreach ($pot_wikis as $pkg => $pot_wiki) { if (!wikiUploadVersioned($pot_wiki)) {
/** * reads all the column headers from the CSV file * @returns array */ public function getHeaders() { $this->in_file_sep = false; fseek($this->fp, 0); foreach (array("\t", ",", ";") as $sep) { $headers = fgetcsv($this->fp, 4000, $sep); if ($headers === FALSE || count($headers) < 2 || !simple_prompt("Do these look like the correct headers?\n" . print_r($headers, true))) { fseek($this->fp, 0); continue; } $this->in_file_sep = $sep; break; } if (!$this->in_file_sep) { die("Could not get headers\n"); } foreach ($headers as &$header) { $header = trim($header); } unset($header); return $headers; }