poshbotio / PoshBot

Powershell-based bot framework
MIT License
540 stars 108 forks source link

Update module build process #22

Closed devblackops closed 7 years ago

devblackops commented 7 years ago

Description

Sorry for the monster PR :)

@michaeltlombardi If you don't mind, can you pull this version of the repo down and give it a whirl? It addresses the issues you raised regarding psake.

This PR changes the build process for the module dramatically.

Essentially it is no longer possible to manually import the module from the \PoshBot subfolder. The module must be built by running .\build.ps1 -task build. That task will create an \out folder with the newly created module in it. The build task will merge all separate function and class files into the module psm1 as well as create the module help XML file. I'm doing this mainly so PSScriptAnalyzer can properly analyze the project and setup for better Pester testing down the road. Currently PSScriptAnalyzer chokes on the separate class files because many of them have dependencies defined in other class files and PSScriptAnalyzer only does static checking on a per-file basis.

This PR also adds some builtin commands (issue #5) to create adhoc permissions assigned to plugins and the ability to attach those permissions to loaded commands. These adhoc permissions are stored in plugins.psd1 in the bot configuration folder. In my testing, running this version of the module against a bot configuration from a previous version did not produce any issues. When plugins.psd1 needs to be modified for any reason (new plugin, enable/disable plugin, etc) the file will be updated to the new format.

Pester tests to check for module manifest validity and populated module help have also been included.

Related Issue

21

20

5

Motivation and Context

How Has This Been Tested?

Manually... but this sets us up for better testing with Pester going forward.

Types of changes

Checklist:

michaeltlombardi commented 7 years ago

Just saw this, will pull and test today. :)

Thanks for the awesome batch of improvements, I'll look to dig through those in the near future, too!

michaeltlombardi commented 7 years ago

Just pulled, erroring out on an invalid variable name in BuildHelpers, should be resolved by RamblingCookieMonster/BuildHelpers#29 and on the Gallery shortly.

michaeltlombardi commented 7 years ago

Other than that change, everything seems to be functional. My existing PoshBot came right back online with the updated plugins!

devblackops commented 7 years ago

Thanks @michaeltlombardi. I enabled AppVeyor testing and fixed a few minor issues with the build/test process but other then that, I think this is ready to ship.

:shipit: