Created
September 16, 2015 08:21
-
-
Save grenade/13dc02c5a2b63ef305c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Install-BundleClone { | |
| param ( | |
| [string] $url = 'https://hg.mozilla.org/hgcustom/version-control-tools/raw-file/default/hgext/bundleclone/__init__.py', | |
| [string] $path = 'C:\mozilla-build\hg', | |
| [string] $filename = 'bundleclone.py', | |
| [string] $hgrc = 'C:\Users\cltbld\.hgrc' | |
| ) | |
| if (Test-Path $path) { | |
| $target = ('{0}\{1}' -f $path, $filename) | |
| if (Test-Path $target) { | |
| Remove-Item -path $target -force | |
| } | |
| Write-Log -message ('installing latest bundleclone to: {0}' -f $target) -severity 'INFO' | |
| (New-Object Net.WebClient).DownloadFile($url, $target) | |
| Enable-BundleClone | |
| } | |
| } | |
| function Enable-BundleClone { | |
| param ( | |
| [string] $hgrc = 'C:\Users\cltbld\.hgrc', | |
| [string] $path = 'C:/mozilla-build/hg/bundleclone.py' | |
| ) | |
| if (Test-Path $hgrc) { | |
| Write-Log -message "enabling bundleclone" -severity 'INFO' | |
| (Get-Content $hgrc) | Foreach-Object { $_ -replace "#bundleclone(\s*)?=.*$", "bundleclone=$path" } | Set-Content $hgrc | |
| } | |
| } | |
| function Disable-BundleClone { | |
| param ( | |
| [string] $hgrc = 'C:\Users\cltbld\.hgrc' | |
| ) | |
| if (Test-Path $hgrc) { | |
| Write-Log -message "disabling bundleclone" -severity 'INFO' | |
| (Get-Content $hgrc) | Foreach-Object { $_ -replace "^bundleclone(\s*)?=", "#bundleclone=" } | Set-Content $hgrc | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment