Skip to content

Commit

Permalink
Merge pull request #3 from jabbera/Tokenization
Browse files Browse the repository at this point in the history
Create a tokenized artifact for easier deployment
  • Loading branch information
jabbera authored Dec 21, 2016
2 parents c027928 + 8b9fe47 commit 80f17c7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
web-user-tokenized.config

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
26 changes: 26 additions & 0 deletions GenerateTokenizedConfig.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function XmlDocTransform($xml, $xdt)
{
if (!$xml -or !(Test-Path -path $xml -PathType Leaf)) {
throw "File not found. $xml";
}
if (!$xdt -or !(Test-Path -path $xdt -PathType Leaf)) {
throw "File not found. $xdt";
}

Add-Type -LiteralPath "$PSScriptRoot\Microsoft.Web.XmlTransform.dll"

$xmldoc = New-Object Microsoft.Web.XmlTransform.XmlTransformableDocument;
$xmldoc.PreserveWhitespace = $true
$xmldoc.Load($xml);

$transf = New-Object Microsoft.Web.XmlTransform.XmlTransformation($xdt);
if ($transf.Apply($xmldoc) -eq $false)
{
throw "Transformation failed."
}
$xmldoc.Save($xml);
}

Copy-Item "$PSScriptRoot\web-user.config" "$PSScriptRoot\web-user-tokenized.config" -Force

XmlDocTransform "$PSScriptRoot\web-user-tokenized.config" "$PSScriptRoot\web-user-transform.xml"
Binary file added Microsoft.Web.XmlTransform.dll
Binary file not shown.
5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ environment:

before_build:
- ps: .\CopySonarTarget.ps1
- ps: .\GenerateTokenizedConfig.ps1
- nuget restore
- cmd: if defined SonarToken (SonarQubeScanner\SonarQube.Scanner.MSBuild.exe begin /k:"IisRemoteUserTokenAuthentication" /v:0.4 /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=%SonarToken%" /d:"sonar.verbose=true")

Expand Down Expand Up @@ -50,11 +51,15 @@ after_test:
- cmd: copy "%APPVEYOR_BUILD_FOLDER%\web-scanner.config" "%APPVEYOR_BUILD_FOLDER%\Staging\inetpub-scanner\web.config"
- cmd: copy "%APPVEYOR_BUILD_FOLDER%\ConfigureServer.ps1" "%APPVEYOR_BUILD_FOLDER%\Staging\ConfigureServer.ps1"
- 7z a RutaHttpModule.zip "%APPVEYOR_BUILD_FOLDER%\Staging\"
- cmd: copy "%APPVEYOR_BUILD_FOLDER%\web-user-tokenized.config" "%APPVEYOR_BUILD_FOLDER%\Staging\inetpub-user\web.config"
- 7z a RutaHttpModule-Tokenized.zip "%APPVEYOR_BUILD_FOLDER%\Staging\"
- cmd: if defined SonarToken (SonarQubeScanner\SonarQube.Scanner.MSBuild.exe end /d:"sonar.login=%SonarToken%")

artifacts:
- path: RutaHttpModule.zip
name: RutaHttpModule
- path: RutaHttpModule-Tokenized.zip
name: RutaHttpModule-Tokenized

deploy:
release: $(APPVEYOR_REPO_TAG_NAME)
Expand Down
21 changes: 21 additions & 0 deletions web-user-transform.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<applicationSettings>
<RutaHttpModule.Properties.Settings>
<setting name="DowncaseGroups" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
<value>__DowncaseGroups__</value>
</setting>
<setting name="AppendString" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
<value>__AppendString__</value>
</setting>
<setting name="AdUserBaseDn" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
<value>__AdUserBaseDn__</value>
</setting>
<setting name="AdGroupBaseDn" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
<value>__AdGroupBaseDn__</value>
</setting>
</RutaHttpModule.Properties.Settings>
</applicationSettings>
</configuration>

0 comments on commit 80f17c7

Please sign in to comment.