Skip to content

Commit

Permalink
First import after refactor directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Mötz Jensen authored and Mötz Jensen committed Sep 20, 2018
1 parent 9fc8345 commit 5859cd9
Show file tree
Hide file tree
Showing 194 changed files with 3,752 additions and 265 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# ignore the settings folder and files for VSCode and PSS
.vscode/*
*.psproj
*TempPoint*

# Ignore staging info from Visual Studio
library/d365fo.tools/.vs/*
library/d365fo.tools/d365fo.tools/bin/*
library/d365fo.tools/d365fo.tools/obj/*

# ignore PowerShell Studio MetaData
d365fo.tools/d365fo.tools.psproj
d365fo.tools/d365fo.tools.psproj.bak
d365fo.tools/d365fo.tools.psprojs
d365fo.tools/d365fo.tools.psproj

# ignore the TestResults
TestResults/*

# ignore the publishing Directory
publish/*
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 d365collaborative
Copyright (c) 2018 Motz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
7 changes: 7 additions & 0 deletions build/filesAfter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# List all files that are loaded in the preimport.ps1
# In the order they are loaded during preimport

internal\configurations\*.ps1
internal\tepp\*.tepp.ps1
internal\tepp\assignment.ps1
internal\scripts\license.ps1
2 changes: 2 additions & 0 deletions build/filesBefore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# List all files that are loaded in the postimport.ps1
# In the order they are loaded during postimport
65 changes: 65 additions & 0 deletions build/vsts-build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<#
This script publishes the module to the gallery.
It expects as input an ApiKey authorized to publish the module.
Insert any build steps you may need to take before publishing it here.
#>
param (
$ApiKey
)

# Prepare publish folder
Write-PSFMessage -Level Important -Message "Creating and populating publishing directory"
$publishDir = New-Item -Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY -Name publish -ItemType Directory
Copy-Item -Path "$($env:SYSTEM_DEFAULTWORKINGDIRECTORY)\d365fo.tools" -Destination $publishDir.FullName -Recurse -Force

# Create commands.ps1
$text = @()
Get-ChildItem -Path "$($publishDir.FullName)\d365fo.tools\internal\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object {
$text += [System.IO.File]::ReadAllText($_.FullName)
}
Get-ChildItem -Path "$($publishDir.FullName)\d365fo.tools\functions\" -Recurse -File -Filter "*.ps1" | ForEach-Object {
$text += [System.IO.File]::ReadAllText($_.FullName)
}
$text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\commands.ps1"

# Create resourcesBefore.ps1
$processed = @()
$text = @()
foreach ($line in (Get-Content "$($PSScriptRoot)\filesBefore.txt" | Where-Object { $_ -notlike "#*" }))
{
if ([string]::IsNullOrWhiteSpace($line)) { continue }

$basePath = Join-Path "$($publishDir.FullName)\d365fo.tools" $line
foreach ($entry in (Resolve-PSFPath -Path $basePath))
{
$item = Get-Item $entry
if ($item.PSIsContainer) { continue }
if ($item.FullName -in $processed) { continue }
$text += [System.IO.File]::ReadAllText($item.FullName)
$processed += $item.FullName
}
}
if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\resourcesBefore.ps1" }

# Create resourcesAfter.ps1
$processed = @()
$text = @()
foreach ($line in (Get-Content "$($PSScriptRoot)\filesAfter.txt" | Where-Object { $_ -notlike "#*" }))
{
if ([string]::IsNullOrWhiteSpace($line)) { continue }

$basePath = Join-Path "$($publishDir.FullName)\d365fo.tools" $line
foreach ($entry in (Resolve-PSFPath -Path $basePath))
{
$item = Get-Item $entry
if ($item.PSIsContainer) { continue }
if ($item.FullName -in $processed) { continue }
$text += [System.IO.File]::ReadAllText($item.FullName)
$processed += $item.FullName
}
}
if ($text) { $text -join "`n`n" | Set-Content -Path "$($publishDir.FullName)\d365fo.tools\resourcesAfter.ps1" }

# Publish to Gallery
Publish-Module -Path "$($publishDir.FullName)\d365fo.tools" -NuGetApiKey $ApiKey -Force
10 changes: 10 additions & 0 deletions build/vsts-prerequisites.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Write-Host "Installing Pester" -ForegroundColor Cyan
Install-Module Pester -Force -SkipPublisherCheck
Write-Host "Installing PSFramework" -ForegroundColor Cyan
Install-Module PSFramework -Force -SkipPublisherCheck
Write-Host "Installing PSScriptAnalyzer" -ForegroundColor Cyan
Install-Module PSScriptAnalyzer -Force -SkipPublisherCheck
Write-Host "Installing Azure.Storage" -ForegroundColor Cyan
Install-Module Azure.Storage -Force -SkipPublisherCheck
Write-Host "Installing AzureAd" -ForegroundColor Cyan
Install-Module AzureAd -Force -SkipPublisherCheck
7 changes: 7 additions & 0 deletions build/vsts-validate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Guide for available variables and working with secrets:
# https://docs.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/variables?tabs=powershell

# Needs to ensure things are Done Right and only legal commits to master get built

# Run internal pester tests
& "$PSScriptRoot\..\d365fo.tools\tests\pester.ps1"
231 changes: 0 additions & 231 deletions d365fo.tools.psd1

This file was deleted.

7 changes: 7 additions & 0 deletions d365fo.tools/bin/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# bin folder

The bin folder exists to store binary data. And scripts related to the type system.

This may include your own C#-based library, third party libraries you want to include (watch the license!), or a script declaring type accelerators (effectively aliases for .NET types)

For more information on Type Accelerators, see the help on Set-PSFTypeAlias
Loading

0 comments on commit 5859cd9

Please sign in to comment.