36 lines
		
	
	
		
			840 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			840 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
namespace nur\tools\compctl;
 | 
						|
 | 
						|
use nur\msg;
 | 
						|
 | 
						|
class UpdateAppsFile {
 | 
						|
  function sync(ConfigFile $config, string $branch, bool $inplace=false): bool {
 | 
						|
    if ($inplace) return false;
 | 
						|
    [$deps, $isUrls, $notFoundUrls,
 | 
						|
    ] = $config->getDeps($branch);
 | 
						|
    if ($deps !== null) {
 | 
						|
      $apps = [];
 | 
						|
      foreach (range(1, count($deps)) as $index) {
 | 
						|
        $apps[] = "req$index";
 | 
						|
      }
 | 
						|
      msg::info("A reporter dans update-apps.conf");
 | 
						|
      echo "APPS=(\n    ".implode(" ", $apps)."\n)\n";
 | 
						|
      $index = 1;
 | 
						|
      foreach ($deps as $dep) {
 | 
						|
        echo <<<EOT
 | 
						|
 | 
						|
req${index}_URL=https://git.univ-reunion.fr/sda-php/$dep[projname].git
 | 
						|
req${index}_BRANCH=$dep[branch]
 | 
						|
req${index}_TYPE=none
 | 
						|
req${index}_DEST=web/b
 | 
						|
req${index}_NAME=$dep[projname]
 | 
						|
req${index}_AFTER_UPDATE=()
 | 
						|
 | 
						|
EOT;
 | 
						|
        $index++;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
}
 |