mirror of
https://github.com/boostorg/website.git
synced 2026-01-29 20:12:14 +00:00
Make free functions static members for autoloading.
This commit is contained in:
@@ -14,7 +14,7 @@ class BoostSuperProject {
|
||||
|
||||
public function parse_config_file($path) {
|
||||
if ($this->git_branch) {
|
||||
if (git_version() >= array(1,8,4,0)) {
|
||||
if (self::git_version() >= array(1,8,4,0)) {
|
||||
$blob = $this->run_git("ls-tree {$this->git_branch} \"{$path}\"");
|
||||
$blob = preg_split("@[\t ]@", $blob[0])[2];
|
||||
return $this->run_git("config -l --blob {$blob}");
|
||||
@@ -52,32 +52,35 @@ class BoostSuperProject {
|
||||
}
|
||||
|
||||
public function run_git($command) {
|
||||
return run_process("git -C \"{$this->location}\" {$command}");
|
||||
}
|
||||
}
|
||||
|
||||
function git_version() {
|
||||
$output = run_process("git --version");
|
||||
$match = null;
|
||||
|
||||
if (count($output) == 1
|
||||
&& preg_match('@^git version ([0-9.]+)$@', $output[0], $match))
|
||||
{
|
||||
return array_pad(explode('.', $match[1]), 4, 0);
|
||||
}
|
||||
else {
|
||||
return array(0,0,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
function run_process($command) {
|
||||
exec($command, $output, $return_var);
|
||||
|
||||
if ($return_var != 0) {
|
||||
throw new ProcessError($return_var);
|
||||
return self::run_process("git -C \"{$this->location}\" {$command}");
|
||||
}
|
||||
|
||||
return $output;
|
||||
// A couple of utility functions that don't really fit, so might move
|
||||
// later.
|
||||
|
||||
static function git_version() {
|
||||
$output = self::run_process("git --version");
|
||||
$match = null;
|
||||
|
||||
if (count($output) == 1
|
||||
&& preg_match('@^git version ([0-9.]+)$@', $output[0], $match))
|
||||
{
|
||||
return array_pad(explode('.', $match[1]), 4, 0);
|
||||
}
|
||||
else {
|
||||
return array(0,0,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
static function run_process($command) {
|
||||
exec($command, $output, $return_var);
|
||||
|
||||
if ($return_var != 0) {
|
||||
throw new ProcessError($return_var);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
class ProcessError extends RuntimeException {
|
||||
|
||||
@@ -35,7 +35,7 @@ function main() {
|
||||
|
||||
$location = $real_location;
|
||||
|
||||
if (get_bool_from_array(run_process(
|
||||
if (get_bool_from_array(BoostSuperProject::run_process(
|
||||
"cd '${location}' && git rev-parse --is-bare-repository")))
|
||||
{
|
||||
if ($version) {
|
||||
@@ -108,7 +108,7 @@ function update_from_git($libs, $location, $version) {
|
||||
$module_location = "{$location}/{$module['url']}";
|
||||
$module_command = "cd '{$module_location}' && git";
|
||||
|
||||
foreach(run_process("{$module_command} ls-tree {$module['hash']} "
|
||||
foreach(BoostSuperProject::run_process("{$module_command} ls-tree {$module['hash']} "
|
||||
."meta/libraries.xml meta/libraries.json") as $entry)
|
||||
{
|
||||
try {
|
||||
@@ -116,7 +116,7 @@ function update_from_git($libs, $location, $version) {
|
||||
if (preg_match("@^100644 blob ([a-zA-Z0-9]+)\t(.*)$@", $entry, $matches)) {
|
||||
$hash = $matches[1];
|
||||
$filename = $matches[2];
|
||||
$text = implode("\n", (run_process("{$module_command} show {$hash}")));
|
||||
$text = implode("\n", (BoostSuperProject::run_process("{$module_command} show {$hash}")));
|
||||
$libs->update(load_from_text($text, $filename, $branch), $name, $module['path']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user