Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
c82d39f8
Commit
c82d39f8
authored
6 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Use Push-Location / Pop-Location instead of temporary variables
parent
22b8af9d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Scripts/Install-NewestPackage.ps1
+7
-2
7 additions, 2 deletions
Scripts/Install-NewestPackage.ps1
Scripts/Prepare-Build.ps1
+2
-3
2 additions, 3 deletions
Scripts/Prepare-Build.ps1
Scripts/Uninstall-Service.ps1
+2
-4
2 additions, 4 deletions
Scripts/Uninstall-Service.ps1
with
11 additions
and
9 deletions
Scripts/Install-NewestPackage.ps1
+
7
−
2
View file @
c82d39f8
# Make sure to run from the directory containing the script itself:
$BaseDir
=
$
(
Split-Path
$MyInvocation
.
MyCommand
.
Path
)
Push-Location
$BaseDir
$PackageDir
=
Get-ChildItem
-Directory
-Name
|
$PackageDir
=
Get-ChildItem
-Directory
-Name
|
Where-Object
{
$_
-match
'build_[0-9]{4}-[0-9]{2}-[0-9]{2}_'
}
|
Where-Object
{
$_
-match
'build_[0-9]{4}-[0-9]{2}-[0-9]{2}_'
}
|
Sort-Object
|
Sort-Object
|
Select-Object
-Last
1
Select-Object
-Last
1
$CurDir
=
Get-Location
Write-Host
-NoNewLine
"Installing package ["
Write-Host
-NoNewLine
"Installing package ["
Write-Host
-NoNewLine
$PackageDir
-Fore
Green
Write-Host
-NoNewLine
$PackageDir
-Fore
Green
...
@@ -13,4 +17,5 @@ Write-Host ""
...
@@ -13,4 +17,5 @@ Write-Host ""
cd
$PackageDir
cd
$PackageDir
.
/Install-Service.ps1
.
/Install-Service.ps1
cd
$CurDir
# Return to the original location before the script was called:
\ No newline at end of file
Pop-Location
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Scripts/Prepare-Build.ps1
+
2
−
3
View file @
c82d39f8
...
@@ -79,8 +79,7 @@ function Parse-GitDescribe([string]$CommitName) {
...
@@ -79,8 +79,7 @@ function Parse-GitDescribe([string]$CommitName) {
$Error
ActionPreference
=
"Stop"
$Error
ActionPreference
=
"Stop"
$OldLocation
=
Get-Location
Push-Location
$SolutionDir
-ErrorAction
Stop
Set-Location
$SolutionDir
-ErrorAction
Stop
$BCommit
=
"
$(
$SolutionDir
)
\Resources\BuildCommit.txt"
$BCommit
=
"
$(
$SolutionDir
)
\Resources\BuildCommit.txt"
$BuildDate
=
"
$(
$SolutionDir
)
\Resources\BuildDate.txt"
$BuildDate
=
"
$(
$SolutionDir
)
\Resources\BuildDate.txt"
...
@@ -141,4 +140,4 @@ Write-Output $(
...
@@ -141,4 +140,4 @@ Write-Output $(
Write-BuildDetails
$BuildDetailsCS
$DescItems
$GitBranch
$DateShort
Write-BuildDetails
$BuildDetailsCS
$DescItems
$GitBranch
$DateShort
Set-Location
$OldLocation
Pop-Location
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Scripts/Uninstall-Service.ps1
+
2
−
4
View file @
c82d39f8
...
@@ -9,11 +9,9 @@ Write-Host "Loaded configuration '$LocalConfiguration'." -Fore Green
...
@@ -9,11 +9,9 @@ Write-Host "Loaded configuration '$LocalConfiguration'." -Fore Green
Write-Host
$ServiceDir
Write-Host
$ServiceDir
Write-Host
$SourceDir
Write-Host
$SourceDir
$CurDir
=
Get-Location
Push-Location
"C:\Windows\Microsoft.NET\Framework\v4.0.30319"
Set-Location
"C:\Windows\Microsoft.NET\Framework\v4.0.30319"
$ServiceExe
=
$ServiceDir
+
"\"
+
$ServiceName
+
".exe"
$ServiceExe
=
$ServiceDir
+
"\"
+
$ServiceName
+
".exe"
.
\InstallUtil.exe
-u
$ServiceExe
.
\InstallUtil.exe
-u
$ServiceExe
Set-Location
$CurDir
Pop-Location
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment