Skip to content
Snippets Groups Projects
Select Git revision
  • d76c3822b53fc125c00ad958df332055abbd76dc
  • master default protected
  • gitkeep
  • Sprint/2022-01
  • dev protected
  • Topic/570-gitVersion
  • Product/499-gtiVersion
  • Product/94-conventions
  • Topic/100-conventions
  • v1.7.3 protected
  • v1.7.2 protected
  • v1.7.1 protected
  • v1.7.0 protected
  • v1.6.2 protected
  • v1.6.1 protected
  • v1.6.0 protected
  • v1.5.9 protected
  • v1.5.8 protected
  • v1.5.7 protected
  • v1.5.6 protected
  • v1.5.5 protected
  • v1.5.4 protected
  • v1.5.3 protected
  • v1.5.2 protected
  • v1.5.1 protected
  • v1.5.0 protected
  • v1.4.9 protected
  • v1.4.8 protected
  • v1.4.7 protected
29 results

AssemblyInfo.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    getMostRecentVersion.php 1.64 KiB
    #!/usr/bin/php
    <?php
    
    if ($argc < 2) {
    	echo "Please call with the name of the module you want to load, such as 'cmake'".PHP_EOL;
    	exit(2);
    }
    
    $tool = $argv[1];
    switch ($tool) {
    	case 'boost':
    		printMostRecentVersion('/usr/local_rwth/modules/modulefiles/linux/x86-64/LIBRARIES/boost', $tool);
    		break;
    	case 'clang':
    		printMostRecentVersion('/usr/local_rwth/modules/modulefiles/linux/x86-64/DEVELOP/clang', $tool);
    		break;
    	case 'cmake':
    		printMostRecentVersion('/usr/local_rwth/modules/modulefiles/linux/x86-64/DEVELOP/cmake', $tool);
    		break;
    	case 'gcc':
    		printMostRecentVersion('/usr/local_rwth/modules/modulefiles/linux/x86-64/DEVELOP/gcc', $tool);
    		break;
    	case 'gurobi':
    		printMostRecentVersion('/usr/local_rwth/modules/modulefiles/linux/x86-64/MATH/gurobi', $tool);
    		break;
    	default:
    		echo "Error: Unhandled module '".$tool."' requested!".PHP_EOL;
    		exit(3);
    }
    
    exit(0);
    
    function printMostRecentVersion($path, $tool) {
    	$versions = scanFolderForVersions($path);
    	if (count($versions) == 0) {
    		echo "Error: The requested module '".$tool."' has NO versions available!".PHP_EOL;
    		exit(4);
    	}
    	
    	echo selectVersion($versions);
    }
    
    function scanFolderForVersions($folder) {
    	$files = scandir($folder);
    	$versions = array();
    	foreach ($files as $item) {
    		if ($item == '.' || $item == '..') {
    			continue;
    		} else if ($item == '.version' || $item == 'system-default') {
    			continue;
    		} else if (is_dir($folder.DIRECTORY_SEPARATOR.$item)) {
    			continue;
    		} else {
    			$versions[] = $item;
    		}
    	}
    	
    	return $versions;
    }
    
    function selectVersion($versions) {
    	if (count($versions) == 1) {
    		return $versions[0];
    	} else {
    		rsort($versions);
    		return $versions[0];
    	}
    }