-
Notifications
You must be signed in to change notification settings - Fork 10
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
Replacing ConvertTo-Expression
with content from iRon7's repo
#57
base: master
Are you sure you want to change the base?
Replacing ConvertTo-Expression
with content from iRon7's repo
#57
Conversation
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
=====================================
- Coverage 35% 9% -27%
=====================================
Files 5 5
Lines 445 314 -131
=====================================
- Hits 160 31 -129
+ Misses 285 283 -2
|
@johlju, I have lowered the code coverage bar. But I would rather exclude the external code from code coverage than lowering the bar. I did not find a way to exclude that particular module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 8 files reviewed, all discussions resolved
build.yaml
line 66 at r1 (raw file):
OutputFormat: NUnitXML ExcludeFromCodeCoverage: - Modules/DscResource.Common
Exclude the module here. This is relative to built module folder.
Code quote:
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
I wonder if we can use PSDepend to download the dependency by adding:
But even better if we can pin the specific commit like
See https://github.com/RamblingCookieMonster/PSDepend#simple-syntax and the example. After that I think we can use |
Thanks, @johlju, I did not know that PSDepend can also handle Git repo content. I am closing this PR and create a new one as the new change will not be even similar to this one. |
@johlju, I have reopened this PR and did some changes regarding the dependency resolution. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! I think we can improve the build workflow to something even better, see my comments a let me know what you think. 🙂
Reviewed 5 of 8 files at r1, 7 of 7 files at r2, all commit messages.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @raandree)
build.yaml
line 65 at r2 (raw file):
ExcludeFromCodeCoverage: - Modules/DscResource.Common - Modules/ConvertToExpression
Should not be needed it we download to output folder. See other comment.
build.yaml
line 82 at r2 (raw file):
ExcludeSourceFile: - output - Modules/ConvertToExpression
Should not be needed it we download to output folder. See other comment.
build.yaml
line 85 at r2 (raw file):
ExcludeModuleFile: - Modules/DscResource.Common - Modules/ConvertToExpression
Should not be needed it we download to output folder. See other comment.
RequiredModules.psd1
line 28 at r2 (raw file):
DependencyType = 'FileDownload' Source = 'https://raw.githubusercontent.com/iRon7/ConvertTo-Expression/93cd563fb9a1dd5b6fc9c73d6f3b95f6f2ebeca8/ConvertTo-Expression.ps1' Target = 'source\Modules\ConvertToExpression\ConvertToExpression.psm1'
I think we should download this to output\RequiredScripts
instead (RequiredModules seemed inappropriate in this case). That will prevent git from seeing a diff after building.
.build/FixConvertToExpressionContent.ps1
line 3 at r2 (raw file):
task FixConvertToExpressionContent { $filePath = Join-Path -Path $SourcePath -ChildPath 'Modules\ConvertToExpression\ConvertToExpression.psm1'
- Should get the content from the output folder. See other comment.
- This task should write the transformed resulting module file (from step 1) directly to the builtmodule's Modules folder.
- We could add a module manifest to the module folder to simplify importing the module in the class files? (see other comment)
.build/FixConvertToExpressionContent.ps1
line 16 at r2 (raw file):
$fileContent | Set-Content -Path $filePath -Encoding UTF8
We should remove the blank line.
source/Classes/005.RoleCapabilitiesUtility.ps1
line 12 at r2 (raw file):
Import-Module -Name (Join-Path -Path $modulePath -ChildPath ConvertToExpression) Import-Module -Name (Join-Path -Path $modulePath -ChildPath (Join-Path -Path ConvertToExpression -ChildPath ConvertToExpression.psm1))
If we create a module manifest in the new task this line could be removed?
source/Modules/ConvertToExpression/.gitkeep
line 0 at r2 (raw file):
This file should not be necessary if the new task buidl the resulting module file from output folder directly to the built module folder.
Pull Request (PR) description
This PR removes the copied code of
ConvertTo-Expression
fromJeaDsc.Common
module and the related tests. Instead there is the new taskInjectScriptCode
which downloads the code ofConvertTo-Expression
from iRon7's repo ConvertTo-Expression and writes it into the moduleConvertToExpression
that is just a placeholder for that code.Unfortunately,
ConvertTo-Expression
is not available as a module, just as a script file. We do not have a way to define dependencies on scripts, that's why I have chosen this unusual way. Duplicating the code, adapting it to the DSC Community's coding style and also the tests does not scale.This Pull Request (PR) fixes the following issues
None
Task list
Entry should say what was changed and how that affects users (if applicable), and
reference the issue being resolved (if applicable).
This change is