Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #13 from jhochwald/develop
Browse files Browse the repository at this point in the history
1.0.8 - 2019-01-19
  • Loading branch information
jhochwald committed Jan 19, 2019
2 parents 447439b + ed4d473 commit 1bd4621
Show file tree
Hide file tree
Showing 101 changed files with 12,461 additions and 388 deletions.
166 changes: 134 additions & 32 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,136 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${relativeFile}: the current opened file relative to workspaceRoot
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that invokes Pester to run all Pester tests under the
// current workspace folder.
// NOTE: This Test task runner requires an updated version of Pester (>=4.0.3)
// in order for the problemMatcher to find failed test information (message, line, file).
// If you don't have that version, you can update Pester from the PowerShell Gallery
// with this command:
//
// PS C:\> Update-Module Pester
//
// If that gives an error like:
// "Module 'Pester' was not installed by using Install-Module, so it cannot be updated."
// then execute:
//
// PS C:\> Install-Module Pester -Scope CurrentUser -Force
//
// NOTE: The Clean, Build and Publish tasks require PSake. PSake can be installed
// from the PowerShell Gallery with this command:
//
// PS C:\> Install-Module PSake -Scope CurrentUser -Force
//
// Available variables which can be used inside of strings:
// ${workspaceFolder} the path of the workspace folder that contains the tasks.json file
// ${workspaceFolderBasename} the name of the workspace folder that contains the tasks.json file without any slashes (/)
// ${file} the current opened file
// ${relativeFile} the current opened file relative to the workspace folder containing the file
// ${fileBasename} the current opened file's basename
// ${fileBasenameNoExtension} the current opened file's basename without the extension
// ${fileDirname} the current opened file's dirname
// ${fileExtname} the current opened file's extension
// ${cwd} the task runner's current working directory on startup
// ${lineNumber} the current selected line number in the active file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
// Start PowerShell
"windows": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass"
]
},
"linux": {
"command": "/usr/bin/pwsh",
"args": [
"-NoProfile"
]
},
"osx": {
"command": "/usr/local/bin/pwsh",
"args": [
"-NoProfile"
]
}
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
},
"linux": {
"options": {
"shell": {
"executable": "/usr/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"osx": {
"options": {
"shell": {
"executable": "/usr/local/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"tasks": [
{
"label": "Clean",
"type": "shell",
"command": "${cwd}/../build.ps1 -Project 'UniFiTooling' -Task 'Clean'",
"presentation": {
"reveal": "never",
"panel": "shared",
"clear": true,
"focus": false
}
},
{
"label": "Build",
"type": "shell",
"command": "${cwd}/../build.ps1 -Project 'UniFiTooling' -Task 'Build'",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "never",
"clear": true,
"focus": false
}
},
{
"label": "Test",
"type": "shell",
"command": "${cwd}/../build.ps1 -Project 'UniFiTooling' -Task 'Build 'Test'",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "silent",
"panel": "shared",
"clear": true,
"focus": false
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Publish",
"type": "shell",
"command": "${cwd}/../build.ps1 -Project 'UniFiTooling' -Task 'Publish'",
"presentation": {
"reveal": "silent",
"panel": "shared",
"clear": true,
"focus": false
}
},
{
"label": "Release",
"type": "shell",
"command": "${cwd}/../build.ps1 -Project 'UniFiTooling' -Task 'Release'",
"presentation": {
"reveal": "silent",
"panel": "shared",
"clear": true
}
}
]
}
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@ All notable changes to the **UniFiTooling** project will be documented in this f

---

### 1.0.7 - [Unreleased]
### 1.0.8 - 2019-01-19

Mainly a bugfix and refactoring release

#### Added

- `Get-UniFiIsAlive` - Use a simple API call to see if the session is alive (internal not exported function)
- `ConvertTo-UnixTimeStamp` - ConvertTo-UnixTimeStamp (Helper)
- `ConvertFrom-UnixTimeStamp` - Converts a Timestamp (Epochdate) into Datetime (Helper)
- `Get-HostsFile` - Print the HOSTS File in a more clean format (Helper)
- `Remove-HostsEntry` - Removes a single Hosts Entry from the HOSTS File (Helper)
- `Add-HostsEntry` - Add a single Hosts Entry to the HOSTS File (Helper)
- `Get-UnifiSpeedTestResult` - Get the UniFi Security Gateway (USG) Speed Test results

#### Changed

- `Get-UnifiSpeedTestResult` has now filtering and returns values human readable
- All commands now use `Get-UniFiIsAlive` internally. That should make it easier for new users.
- Refactored some of the code that handles all errors.

### 1.0.7 - 2019-01-14

Mainly a bugfix and refactoring release
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND AN

#### BSD-3-Clause

This is the **BSD-3-Clause** license.
BSD 3-Clause "New" or "Revised" License. - [Online](https://github.com/jhochwald/UniFiTooling/wiki/License)

### Your Name

Expand Down
27 changes: 11 additions & 16 deletions Install.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#
.SYNOPSIS
Basic Installer for the UniFiTooling PowerShell Module
.DESCRIPTION
Basic Installer for the enabling Technology UniFiTooling PowerShell Module
Expand All @@ -15,7 +15,7 @@
Install the module for the All Users with PowerShellGet directly from the Powershell Gallery, Preferred method.
Run this in an administrative PowerShell prompt (Elevated).
.EXAMPLE
PS C:\> .\Install.ps1
Expand Down Expand Up @@ -49,28 +49,28 @@ process
# Download and install the module
$webclient = (New-Object System.Net.WebClient)
$file = "$($env:TEMP)\$($ModuleName).zip"

Write-Output -InputObject ('Downloading latest version of {0} from {1}' -f $ModuleName, $DownloadURL)

$webclient.DownloadFile($DownloadURL, $file)

Write-Output -InputObject ('File saved to {0}' -f $file)

$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules\$($ModuleName)"
$null = (New-Item -ItemType Directory -Force -Path $targetondisk)
$shell_app = (New-Object -ComObject shell.application)
$zip_file = $shell_app.namespace($file)

Write-Output -InputObject ('Uncompressing the Zip file to {0}' -f $targetondisk)

$destination = $shell_app.namespace($targetondisk)
$destination.Copyhere($zip_file.items(), 0x10)
}
catch
{
# get error record
[Management.Automation.ErrorRecord]$e = $_

# retrieve information about runtime error
$info = [PSCustomObject]@{
Exception = $e.Exception.Message
Expand All @@ -80,10 +80,10 @@ process
Line = $e.InvocationInfo.ScriptLineNumber
Column = $e.InvocationInfo.OffsetInLine
}

# output information. Post-process collected info, and log info (optional)
Write-Verbose -Message $info

Write-Error -Message ($info.Exception) -TargetObject ($info.Target) -ErrorAction Stop
break
}
Expand All @@ -94,8 +94,3 @@ end
Write-Output -InputObject 'Module has been installed!'
Write-Output -InputObject ('You can now import the module with: Import-Module -Name {0}' -f $ModuleName)
}





36 changes: 18 additions & 18 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
SAMPLE:
Severity = @(
'Error',
'Error',
'Warning'
)
Use IncludeRules when you want to run only a subset of the default rule set.
SAMPLE:
IncludeRules = @(
'PSAvoidDefaultValueSwitchParameter',
'PSMissingModuleManifestField',
'PSReservedCmdletChar',
'PSReservedParams',
'PSShouldProcess',
'PSUseApprovedVerbs',
'PSUseDeclaredVarsMoreThanAssigments',
'PSAvoidDefaultValueSwitchParameter',
'PSMissingModuleManifestField',
'PSReservedCmdletChar',
'PSReservedParams',
'PSShouldProcess',
'PSUseApprovedVerbs',
'PSUseDeclaredVarsMoreThanAssigments',
'PSUseCompatibleCmdlets'
)
Expand All @@ -29,7 +29,7 @@
SAMPLE:
ExcludeRules = @(
'PSAvoidTrailingWhitespace',
'PSAvoidTrailingWhitespace',
'PSUseDeclaredVarsMoreThanAssignments'
)
Expand All @@ -49,23 +49,23 @@

@{
Severity = @(
'Error',
'Error',
'Warning'
)
ExcludeRules = @(
'PSAvoidUsingUserNameAndPassWordParams',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidTrailingWhitespace',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseSingularNouns',
'PSAvoidUsingUserNameAndPassWordParams',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidTrailingWhitespace',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUseSingularNouns',
'PSAvoidGlobalVars'
)
Rules = @{
PSUseCompatibleCmdlets = @{
Compatibility = @(
'core-6.0.2-alpha-linux',
'core-6.0.2-alpha-windows',
'core-6.0.2-alpha-osx',
'core-6.0.2-alpha-linux',
'core-6.0.2-alpha-windows',
'core-6.0.2-alpha-osx',
'desktop-5.1.17763.134-windows'
)
}
Expand Down

0 comments on commit 1bd4621

Please sign in to comment.