mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-22 01:48:20 +02:00
Add build-repo.ps1
This commit is contained in:
parent
980a169bfc
commit
f9a479b0f9
@ -1,5 +1,6 @@
|
|||||||
Script,Description
|
Script,Description
|
||||||
add-firewall-rules.ps1, adds firewall rules to the given executables (needs admin rights)
|
add-firewall-rules.ps1, adds firewall rules to the given executables (needs admin rights)
|
||||||
|
build-repo.ps1, builds the current/given Git repository
|
||||||
check-cpu-temp.ps1, checks the CPU temperature
|
check-cpu-temp.ps1, checks the CPU temperature
|
||||||
check-dns-resolution.ps1, checks the DNS resolution with frequently used domain names
|
check-dns-resolution.ps1, checks the DNS resolution with frequently used domain names
|
||||||
check-drive-space.ps1, checks the given drive for free space left
|
check-drive-space.ps1, checks the given drive for free space left
|
||||||
|
|
@ -120,6 +120,7 @@ Mega Collection of PowerShell Scripts
|
|||||||
|
|
||||||
📝 PowerShell Scripts for Git
|
📝 PowerShell Scripts for Git
|
||||||
------------------------------
|
------------------------------
|
||||||
|
* [build-repo.ps1](Scripts/build-repo.ps1) - builds the current/given Git repository
|
||||||
* [cherry-picker.ps1](Scripts/cherry-picker.ps1) - cherry-picks a Git commit into multiple branches
|
* [cherry-picker.ps1](Scripts/cherry-picker.ps1) - cherry-picks a Git commit into multiple branches
|
||||||
* [clean-repo.ps1](Scripts/clean-repo.ps1) - cleans the current/given Git repository from untracked files (including submodules)
|
* [clean-repo.ps1](Scripts/clean-repo.ps1) - cleans the current/given Git repository from untracked files (including submodules)
|
||||||
* [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories
|
* [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories
|
||||||
|
31
Scripts/build-repo.ps1
Executable file
31
Scripts/build-repo.ps1
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/pwsh
|
||||||
|
<#
|
||||||
|
.SYNTAX build-repo.ps1 [<repo-dir>]
|
||||||
|
.DESCRIPTION builds the current/given Git repository
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
param($RepoDir = "$PWD")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (test-path CMakeLists.txt) {
|
||||||
|
"Building $RepoDir using CMakeLists.txt..."
|
||||||
|
& cmake .
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'cmake .'" }
|
||||||
|
|
||||||
|
& make
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'make .'" }
|
||||||
|
} elseif (test-path Makefile) {
|
||||||
|
"Building $RepoDir using Makefile..."
|
||||||
|
& make
|
||||||
|
if ($lastExitCode -ne "0") { throw "Can't execute 'make .'" }
|
||||||
|
} else {
|
||||||
|
write-warning "Sorry, no clue how to build $RepoDir"
|
||||||
|
}
|
||||||
|
write-host -foregroundColor green "OK - built Git repository $RepoDir"
|
||||||
|
exit 0
|
||||||
|
} catch {
|
||||||
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
exit 1
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
param($ParentDir = "$PWD")
|
param($ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
"Fetching updates for Git repositories under $ParentDir ..."
|
"Fetching updates for Git repositories under $($ParentDir)..."
|
||||||
$StartTime = get-date
|
$StartTime = get-date
|
||||||
|
|
||||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||||
@ -20,7 +20,7 @@ try {
|
|||||||
|
|
||||||
[int]$Count = 0
|
[int]$Count = 0
|
||||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||||
"Fetching Git repository $($_.FullName) ..."
|
"Fetching updates for $($_.FullName)..."
|
||||||
set-location $_.FullName
|
set-location $_.FullName
|
||||||
|
|
||||||
& git fetch --all --recurse-submodules
|
& git fetch --all --recurse-submodules
|
||||||
|
Loading…
Reference in New Issue
Block a user