Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add install-nightly tool #1104

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ BGInfo clone built using Universal Dashboard to display computer metrics.

Clock implementation built using SVG and Universal Dashboard.

## Nightly Builds

To install nightly builds, you can use the `./tools/install-nightly.ps1` script.

### Installing Community Edition

```
./tools/install-nightly.ps1
```

### Installing Enterprise Edition

```
./tools/install-nightly.ps1 -Enterprise
```

### Installing into the PowerShell Core Module Path

```
./tools/install-nightly.ps1 -Enterprise -Core
```

## Contribution Rules

Contributions are always welcome! Please follow the below rules.
Expand Down
88 changes: 0 additions & 88 deletions tools/control-laboratory.ps1

This file was deleted.

53 changes: 0 additions & 53 deletions tools/control-laboratory/control-laboratory.ps1

This file was deleted.

131 changes: 0 additions & 131 deletions tools/control-laboratory/control-laboratory.psm1

This file was deleted.

67 changes: 67 additions & 0 deletions tools/install-nightly.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
param(
[switch]$Enterprise,
[switch]$Force,
[switch]$Core
)

$Url = "https://api.github.com/repos/ironmansoftware/universal-dashboard"
if ($Enterprise)
{
$Url = "https://api.github.com/repos/ironmansoftware/universal-dashboard-enterprise"
}

$Url += "/releases"

$Release = (Invoke-RestMethod $Url) | Select-Object -First 1
$Asset = (Invoke-RestMethod $Release.assets_url) | Select-Object -First 1

$Zip = (Join-Path ([IO.Path]::GetTempPath()) "UniversalDashboard.zip")

Invoke-WebRequest $Asset.browser_download_url -OutFile $Zip

$ModuleName = "UniversalDashboard.Community"

if ($Enterprise)
{
$ModuleName = "UniversalDashboard"
}

$TempPath = (Join-Path ([IO.Path]::GetTempPath()) $ModuleName)
if (Test-Path $TempPath)
{
Remove-Item $TempPath -Force -Recurse
}

Expand-Archive $Zip $TempPath

$Manifest = Get-Content (Join-Path $TempPath "$ModuleName.psd1") -Raw

$UdManifest = Invoke-Expression $Manifest

$Version = $UdManifest.ModuleVersion

if ($Core)
{
$ModulePath = [IO.Path]::Combine("$env:USERPROFILE/Documents/PowerShell/Modules", $ModuleName, $Version)
}
else
{
$ModulePath = [IO.Path]::Combine("$env:USERPROFILE/Documents/WindowsPowerShell/Modules", $ModuleName, $Version)
}

if ($Force -and (Test-Path $ModulePath))
{
Remove-Item $ModulePath -Force -Recurse
}

Copy-Item $TempPath $ModulePath -Recurse

if (Test-Path $Zip)
{
Remove-Item $Zip -Force -Recurse
}

if (Test-Path $TempPath)
{
Remove-Item $TempPath -Force -Recurse
}