MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
445 stars 155 forks source link

Move classes from PowerShell to C# #350

Closed DarqueWarrior closed 3 years ago

DarqueWarrior commented 4 years ago

PR Summary

This is a major architecture update. All the classes have been moved from PowerShell to a C# class library.

This changed the build because it has to build both a .NET Core class lib and the PowerShell parts.

I also added a few new functions to keep the Cache code consistent.

I also reviewed every function to make sure the code is consistent across the module.

PR Checklist

SebastianSchuetze commented 4 years ago

Is this change also making the module cross-platform ready or not? There was one dependency I cannot remember anymore that was making it not.

DarqueWarrior commented 4 years ago

Is this change also making the module cross-platform ready or not? There was one dependency I cannot remember anymore that was making it not.

So far I have tested on all three platforms and everything is working.

SebastianSchuetze commented 3 years ago

not really approving but wanted to check what is changing for myself.

SebastianSchuetze commented 3 years ago

@DarqueWarrior, Regarding our conversation about the HelpUri I tried to create a script to maybe control it to add it via a build script automatically.

I created the following:

$cmdlet = [System.Management.Automation.Language.Parser]::ParseFile('.\Source\Public\Add-VSTeam.ps1', [ref]$null, [ref]$Null)

$cdmletBinding = $cmdlet.FindAll( {
      param(
         [System.Management.Automation.Language.Ast] $ast
      )
      $ast -is [System.Management.Automation.Language.AttributeAst] -and
      $ast.TypeName.Name -eq "CmdletBinding"

   }, $true)

$hasHelpUri = ($cdmletBinding[0].NamedArguments | Where-Object { $_.ArgumentName -eq "HelpUri" }).Count -gt 0

if(!$hasHelpUri){

}

This at least checks if the CmdletBinding attribute exists (e.g. [CmdletBinding(HelpUri="www.google.de")]). We could use this with PSScriptAnalyzer and create a custom rule or just add a new script checking every file for that.

But I found it harder to properly add a HelpUri automatically. AST is made for checking code but not changing it. We would need to edit the file directly probably via string and Set-Content functions. At least I don't know another way.

SebastianSchuetze commented 3 years ago

@DarqueWarrior site is now pushed: https://methodsandpractices.github.io/vsteam-docs/

maybe you want to add this URL to the VSTeam repo metadata so users can directly access it from the repo homepage.

DarqueWarrior commented 3 years ago

@DarqueWarrior site is now pushed: https://methodsandpractices.github.io/vsteam-docs/

maybe you want to add this URL to the VSTeam repo metadata so users can directly access it from the repo homepage.

The links still don't work. site = https://methodsandpractices.github.io/vsteam-docs/docs/modules/vsteam/commands/Add-VSTeam functions = https://methodsandpractices.github.io/vsteam-docs/docs/modules/vsteam/Add-VSTeam

There is a new commands part. I can change all the links. I just need to know which is going to be the final URLs.