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

Move Cmdlets to root folder #42

Merged
merged 6 commits into from
Oct 4, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
$ProgressPreference = 'SilentlyContinue'
$ErrorActionPreference = 'Stop'
Install-Module -Name PSScriptAnalyzer -SkipPublisherCheck -Scope CurrentUser -MinimumVersion 1.19.1 -Force -Verbose
Invoke-ScriptAnalyzer -Path $env:GITHUB_WORKSPACE -Recurse -Settings (Join-Path -Path $env:GITHUB_WORKSPACE/Linters -ChildPath 'PSScriptAnalyzer.psd1') -ReportSummary -EnableExit
Invoke-ScriptAnalyzer -Path $env:GITHUB_WORKSPACE -Recurse -Settings (Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'Linters\PSScriptAnalyzer.psd1') -ReportSummary -EnableExit
# Run tests
- name: Run tests (via Pester)
shell: pwsh
Expand All @@ -46,4 +46,4 @@ jobs:
$ProgressPreference = 'SilentlyContinue'
$ErrorActionPreference = 'Stop'
Install-Module -Name platyPS, BuildHelpers -SkipPublisherCheck -Scope CurrentUser -Force
& $env:GITHUB_WORKSPACE/Build/New-Package.ps1 -Verbose
& (Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'Build\New-Package.ps1') -Verbose
33 changes: 0 additions & 33 deletions .github/workflows/publish_testing.yml

This file was deleted.

86 changes: 33 additions & 53 deletions Build/New-Package.ps1
Original file line number Diff line number Diff line change
@@ -1,74 +1,54 @@
#requires -Modules platyPS, BuildHelpers
#requires -Modules BuildHelpers, platyPS

param(
[Parameter()]
[string]
$BuildOutputPath = "$(Resolve-Path "$PSScriptRoot/..")/Build/Output"
[string]$Build_OutputPath = "$(Resolve-Path "$PSScriptRoot\..")\Build\Output"
)

$repoPath = Resolve-Path "$PSScriptRoot/.."
$Repo_RootPath = Resolve-Path -Path "$PSScriptRoot\.."
$Repo_CmdletPath = Resolve-Path -Path "$PSScriptRoot\..\Cmdlets"

if (Test-Path $BuildOutputPath) {
Write-Verbose 'Removing existing build output directory'
Remove-Item $BuildOutputPath -Recurse -ErrorAction SilentlyContinue
if (Test-Path -Path $Build_OutputPath) {
Write-Verbose 'Removing existing build output directory...'
Remove-Item -Path $Build_OutputPath -Recurse -ErrorAction SilentlyContinue
}
Write-Verbose 'Creating build output directories.'
New-Item -Type Directory $BuildOutputPath | Out-Null

Write-Verbose 'Creating build output directories...'
New-Item -Type Directory $Build_OutputPath | Out-Null

# Compile all functions into a single psm file
$targetFile = "$BuildOutputPath/TeamViewerPS.psm1"
Write-Verbose 'Compiling single-file TeamViewer module.'
$ModuleTypes = @(Get-ChildItem -Path "$repoPath/Docs/TeamViewerPS.Types.ps1")
$PrivateFunctions = @(Get-ChildItem `
-Path "$repoPath/Docs/Cmdlets/Private/*.ps1" `
-ErrorAction SilentlyContinue)
$Build_ModulePath = (Join-Path -Path $Repo_CmdletPath -ChildPath 'TeamViewerPS.psm1')

Write-Verbose 'Compiling single-file TeamViewer module...'
$ModuleTypes = @(Get-ChildItem -Path (Join-Path -Path $Repo_CmdletPath -ChildPath 'TeamViewerPS.Types.ps1'))

$PrivateFunctions = @(Get-ChildItem -Path (Join-Path -Path $Repo_CmdletPath -ChildPath 'Private\*.ps1') -ErrorAction SilentlyContinue)
Write-Verbose "Found $($PrivateFunctions.Count) private function files."
$PublicFunctions = @(Get-ChildItem `
-Path "$repoPath/Docs/Cmdlets/Public/*.ps1" `
-ErrorAction SilentlyContinue)

$PublicFunctions = @(Get-ChildItem -Path (Join-Path -Path $Repo_CmdletPath -ChildPath 'Public\*.ps1') -ErrorAction SilentlyContinue)
Write-Verbose "Found $($PublicFunctions.Count) public function files."
@($ModuleTypes + $PrivateFunctions + $PublicFunctions) | `
Get-Content -Raw | `
ForEach-Object { $_; "`r`n" } | `
Set-Content -Path $targetFile -Encoding UTF8

@($ModuleTypes + $PrivateFunctions + $PublicFunctions) | Get-Content -Raw | ForEach-Object { $_; "`r`n" } | Set-Content -Path $Build_ModulePath -Encoding UTF8

# Create help from markdown
Write-Verbose 'Building help from Markdown'
New-ExternalHelp `
-Path "$repoPath/Docs" `
-OutputPath "$BuildOutputPath/en-US" | `
Out-Null
New-ExternalHelp `
-Path "$repoPath/Docs/Cmdlets_help" `
-OutputPath "$BuildOutputPath/en-US" | `
Out-Null
Write-Verbose 'Building help from Markdown...'
New-ExternalHelp -Path (Join-Path -Path $Repo_RootPath -ChildPath 'Docs') -OutputPath (Join-Path -Path $Build_OutputPath -ChildPath 'en-US') | Out-Null
New-ExternalHelp -Path (Join-Path -Path $Repo_RootPath -ChildPath 'Docs\Help') -OutputPath (Join-Path -Path $Build_OutputPath -ChildPath 'en-US') | Out-Null

# Create module manifest
Write-Verbose 'Creating module manifest'
Copy-Item `
-Path "$repoPath/Docs/TeamViewerPS.psd1" `
-Destination "$BuildOutputPath/"
Copy-Item `
-Path "$repoPath/Docs/*.format.ps1xml" `
-Destination "$BuildOutputPath/"
Update-Metadata `
-Path "$BuildOutputPath/TeamViewerPS.psd1" `
-PropertyName 'FunctionsToExport' `
-Value $PublicFunctions.BaseName
Write-Verbose 'Creating module manifest...'
Copy-Item -Path (Join-Path -Path $Repo_CmdletPath -ChildPath 'TeamViewerPS.psd1') -Destination $Build_OutputPath
Copy-Item -Path (Join-Path -Path $Repo_CmdletPath -ChildPath '*.format.ps1xml') -Destination $Build_OutputPath

Update-Metadata -Path (Join-Path -Path $Repo_CmdletPath -ChildPath 'TeamViewerPS.psd1') -PropertyName 'FunctionsToExport' -Value $PublicFunctions.BaseName

# Copy additional package files
Write-Verbose 'Copying additional files into the package'
Copy-Item `
-Path `
"$repoPath/LICENSE.md", `
"$repoPath/CHANGELOG.md", `
"$repoPath/README.md"`
-Destination "$BuildOutputPath/"
Write-Verbose 'Copying additional files into the package...'
Copy-Item -Path (Join-Path -Path $Repo_RootPath -ChildPath 'CHANGELOG.md') -Destination "$Build_OutputPath"
Copy-Item -Path (Join-Path -Path $Repo_RootPath -ChildPath 'LICENSE.md') -Destination "$Build_OutputPath"
Copy-Item -Path (Join-Path -Path $Repo_RootPath -ChildPath 'README.md') -Destination "$Build_OutputPath"

Write-Verbose 'Listing package files:'
Push-Location $BuildOutputPath
Get-ChildItem -Recurse "$BuildOutputPath/" | `
Sort-Object -Property FullName | `
Resolve-Path -Relative
Push-Location -Path $Build_OutputPath
Get-ChildItem -Path "$Build_OutputPath\" -Recurse | Sort-Object -Property FullName | Resolve-Path -Relative
Pop-Location
26 changes: 13 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

### Added

-Added 'Set-TeamViewerApiURi' to use TeamViewer test API.
-Added user role commands to remotely manage user roles of a TeamViewer company.
-Added `Add-TeamViewerAssignment` and `Remove-TeamViewerAssignment` commands to assign and unassign a device from a TeamViewer company.
-Added `Add-TeamViewerCustomization` and `Remove-TeamViewerCustomization` commands to apply and remove customization.
-Added `Export-TeamViewerSystemInformation` to create zip file for support.
-Added `Set-TeamViewerPSProxy` and `Remove-TeamViewerPSProxy` to set proxy to access WebAPI.
-Added `Get-TeamViewerInstallationDirectory` to return installation directory.
-Added `Remove-TeamViewerPolicyFromManagedDevice` to remove policies from managed devices.
- Added 'Set-TeamViewerApiURi' to use TeamViewer test API.
- Added commands to remotely manage user roles of a TeamViewer company.
- Added `Add-TeamViewerAssignment` and `Remove-TeamViewerAssignment` commands to assign and unassign a device from a TeamViewer company.
- Added `Add-TeamViewerCustomization` and `Remove-TeamViewerCustomization` commands to apply and remove customization.
- Added `Export-TeamViewerSystemInformation` to create zip file for support.
- Added `Set-TeamViewerPSProxy` and `Remove-TeamViewerPSProxy` to set proxy to access WebAPI.
- Added `Get-TeamViewerInstallationDirectory` to return installation directory.
- Added `Remove-TeamViewerPolicyFromManagedDevice` to remove policies from managed devices.

### Changed

-Extended `Invoke-TeamViewerPackageDownload` with MSI package type.
-Folder structure modified.
-`-RemovePolicy` switch removed from `Set-TeamViewerManagedDevice`.
- Extended `Invoke-TeamViewerPackageDownload` with MSI package type.
- `-RemovePolicy` switch removed from `Set-TeamViewerManagedDevice`.
- Optimized folder structure.

### Fixed

-Fixed `Get-TeamViewerLinuxGlobalConfig` to handle null values.
- Fixed `Get-TeamViewerLinuxGlobalConfig` to handle null values.

## 1.5.2 (2023-09-18)

Expand All @@ -37,7 +37,7 @@
### Added

- Added `Remove-TeamViewerUser` cmdlet to remove user from TeamViewer company. (Thanks @OtterKring)
- Added `Remove-TeamViewerManagedDeviceManagement` to unmanage a device.
- Added `Remove-TeamViewerManagedDeviceManagement` to un-manage a device.

### Changed

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/TeamViewerPS.psd1 → Cmdlets/TeamViewerPS.psd1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
@{
# Script module or binary module file associated with this manifest.
RootModule = 'TeamViewerPS.psm1'

Expand All @@ -18,7 +18,7 @@
CompanyName = 'TeamViewer Germany GmbH'

# Copyright statement for this module.
Copyright = '(c) 2021-2022 TeamViewer Germany GmbH. All rights reserved.'
Copyright = '(c) 2021-2023 TeamViewer Germany GmbH. All rights reserved.'

# Description of the functionality provided by this module.
Description = 'TeamViewerPS allows to interact with the TeamViewer Web API as well as a locally installed TeamViewer client.'
Expand Down Expand Up @@ -60,7 +60,7 @@
# NestedModules = @()

# Functions to export from this module.
FunctionsToExport = '*'
FunctionsToExport = @('Add-TeamViewerAssignment','Add-TeamViewerCustomization','Add-TeamViewerManagedDevice','Add-TeamViewerManager','Add-TeamViewerRoleToAccount','Add-TeamViewerRoleToUserGroup','Add-TeamViewerSsoExclusion','Add-TeamViewerUserGroupMember','Connect-TeamViewerApi','Disconnect-TeamViewerApi','Export-TeamViewerSystemInformation','Get-TeamViewerAccount','Get-TeamViewerConnectionReport','Get-TeamViewerContact','Get-TeamViewerCustomModuleId','Get-TeamViewerDevice','Get-TeamViewerEventLog','Get-TeamViewerGroup','Get-TeamViewerId','Get-TeamViewerInstallationDirectory','Get-TeamViewerLogFilePath','Get-TeamViewerManagedDevice','Get-TeamViewerManagedGroup','Get-TeamViewerManagementId','Get-TeamViewerManager','Get-TeamViewerPolicy','Get-TeamViewerRoleAssignmentToAccount','Get-TeamViewerRoleAssignmentToUserGroup','Get-TeamViewerService','Get-TeamViewerSsoDomain','Get-TeamViewerSsoExclusion','Get-TeamViewerUser','Get-TeamViewerUserGroup','Get-TeamViewerUserGroupMember','Get-TeamViewerUserRole','Get-TeamViewerVersion','Invoke-TeamViewerPackageDownload','Invoke-TeamViewerPing','New-TeamViewerContact','New-TeamViewerDevice','New-TeamViewerGroup','New-TeamViewerManagedGroup','New-TeamViewerPolicy','New-TeamViewerUser','New-TeamViewerUserGroup','New-TeamViewerUserRole','Publish-TeamViewerGroup','Remove-TeamViewerAssignment','Remove-TeamViewerContact','Remove-TeamViewerCustomization','Remove-TeamViewerDevice','Remove-TeamViewerGroup','Remove-TeamViewerManagedDevice','Remove-TeamViewerManagedDeviceManagement','Remove-TeamViewerManagedGroup','Remove-TeamViewerManager','Remove-TeamViewerPolicy','Remove-TeamViewerPolicyFromManagedDevice','Remove-TeamViewerPSProxy','Remove-TeamViewerRoleFromAccount','Remove-TeamViewerRoleFromUserGroup','Remove-TeamViewerSsoExclusion','Remove-TeamViewerUser','Remove-TeamViewerUserGroup','Remove-TeamViewerUserGroupMember','Remove-TeamViewerUserRole','Restart-TeamViewerService','Set-TeamViewerAccount','Set-TeamViewerAPIUri','Set-TeamViewerDevice','Set-TeamViewerGroup','Set-TeamViewerManagedDevice','Set-TeamViewerManagedGroup','Set-TeamViewerManager','Set-TeamViewerPolicy','Set-TeamViewerPSProxy','Set-TeamViewerUser','Set-TeamViewerUserGroup','Set-TeamViewerUserRole','Start-TeamViewerService','Stop-TeamViewerService','Test-TeamViewerConnectivity','Test-TeamViewerInstallation','Unpublish-TeamViewerGroup')

# Cmdlets to export from this module.
CmdletsToExport = @()
Expand Down
Loading
Loading