Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Fixed issue flofreud#2
Browse files Browse the repository at this point in the history
  • Loading branch information
flofreud committed May 26, 2014
1 parent 5534b15 commit 5d9403e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Commands.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function gvm([string]$Command, [string]$Candidate, [string]$Version, [string]$InstallPath, [switch]$Verbose, [switch]$Force) {
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
if ($Verbose) { $VerbosePreference = 'Continue' }

if ( !( Test-Path $Global:PGVM_DIR ) ) {
Expand All @@ -14,7 +14,7 @@
}

Init-Candidate-Cache

Write-Verbose "Command: $Command"
try {
switch -regex ($Command) {
Expand All @@ -24,7 +24,7 @@
'^u(se)?$' { Use-Candidate-Version $Candidate $Version }
'^d(efault)?$' { Set-Default-Version $Candidate $Version }
'^c(urrent)?$' { Show-Current-Version $Candidate }
'^v(ersion)?$' { Show-Posh-Gvm-Version }
'^v(ersion)?$' { Show-Posh-Gvm-Version }
'^b(roadcast)?$' { Show-Broadcast-Message }
'^h(elp)?$' { Show-Help }
'^offline$' { Set-Offline-Mode $Candidate }
Expand Down Expand Up @@ -53,14 +53,14 @@ function Install-Candidate-Version($Candidate, $Version, $InstallPath) {
$Version = Check-Candidate-Version-Available $Candidate $Version
} catch {
$localInstallation = $true
}
}
if ( !($localInstallation) ) {
throw 'Stop! Local installation for $Candidate $Version not possible. It exists remote already.'
}
} else {
$Version = Check-Candidate-Version-Available $Candidate $Version
}

if ( Is-Candidate-Version-Locally-Available $Candidate $Version ) {
throw "Stop! $Candidate $Version is already installed."
}
Expand All @@ -73,7 +73,7 @@ function Install-Candidate-Version($Candidate, $Version, $InstallPath) {

$default = $false
if ( !$Global:PGVM_AUTO_ANSWER ) {
$default = (Read-Host -Prompt "Do you want $Candidate $Version to be set as default? (Y/n): ") -match 'y'
$default = (Read-Host -Prompt "Do you want $Candidate $Version to be set as default? (Y/n)") -match '(y|\A\z)'
} else {
$default = $true
}
Expand Down Expand Up @@ -184,29 +184,29 @@ function Set-Offline-Mode($Flag) {
function Flush-Cache($DataType) {
Write-Verbose 'Perform Flush-Cache'
switch ($DataType) {
'candidates' {
'candidates' {
if ( Test-Path $Script:PGVM_CANDIDATES_PATH ) {
Remove-Item $Script:PGVM_CANDIDATES_PATH
Write-Output 'Candidates have been flushed.'
} else {
Write-Warning 'No candidate list found so not flushed.'
}
} else {
Write-Warning 'No candidate list found so not flushed.'
}
}
'broadcast' {
'broadcast' {
if ( Test-Path $Script:PGVM_BROADCAST_PATH ) {
Remove-Item $Script:PGVM_BROADCAST_PATH
Write-Output 'Broadcast have been flushed.'
} else {
} else {
Write-Warning 'No prior broadcast found so not flushed.'
}
}
}
'version' {
'version' {
if ( Test-Path $Script:PGVM_VERSION_PATH ) {
Remove-Item $Script:PGVM_VERSION_PATH
Write-Output 'Version Token have been flushed.'
} else {
} else {
Write-Warning 'No prior Remote Version found so not flushed.'
}
}
}
'archives' { Cleanup-Directory $Script:PGVM_ARCHIVES_PATH }
'temp' { Cleanup-Directory $Script:PGVM_TEMP_PATH }
Expand Down Expand Up @@ -234,7 +234,7 @@ Usage: gvm <command> <candidate> [version]
selfupdate [-Force]
flush <candidates|broadcast|archives|temp>
candidate : $($Script:GVM_CANDIDATES -join ', ')
version : where optional, defaults to latest stable if not provided
eg: gvm install groovy
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ Requirements:
2. Execute `Import-Module posh-gvm`(best add it to your profile.ps1)
3. Execute `gvm help` to get started!

## Update

The autoupdate-function currently only get newly added candidates from GVM-API. To get a update of posh-gvm you have to do it manually. How to update depends on how you installed posh-gvm.

There is currently now mechanism which can tell you that there is an update available.

### With PsGet

Update-Module posh-gvm

### Via short Script

(new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/flofreud/posh-gvm/master/GetPoshGvm.ps1') | iex

### Classic way
Go to the checkout location and pull the repository.

## Usage

For a general overview of the feature please the [GVM Project Page](http://gvmtool.net) because posh-gvm is designed to work like the original BASH client.
Expand Down

0 comments on commit 5d9403e

Please sign in to comment.