Skip to content

Commit

Permalink
* Readme updates
Browse files Browse the repository at this point in the history
Adding banner image and example
  • Loading branch information
Cameron Wills committed Nov 10, 2015
1 parent dd91950 commit 6a34a9e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 18 deletions.
95 changes: 77 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,99 @@
FatAntelope
===========
A tool for generating an XDT transform (Micrsoft XML Document Transform) from two .config files.
# FatAntelope

A tool for generating an XDT transform (Microsoft XML Document Transform) from two .config files.
Useful for creating transforms for existing production web.config or app.config files.

How it works
============
![FatAntelope](banner.jpg)

## How it works

FatAntelope parses the two config (xml) files into two trees and performs an unordered diff / comparison to identify nodes
that have been updated, inserted or deleted. And then generates a XDT transform from the difference.

The XML diff / comparison algorithm is a C# port of the 'XDiff' algorithm described here:
http://pages.cs.wisc.edu/~yuanwang/xdiff.html

Download
============
## Download

Download the command-line tool in [releases](https://github.com/CameronWills/FatAntelope/releases)

Usage
=====
## Usage

Following build, you can use reference the FatAntelope library directly or otherwise run the command-line tool

Command Line
------------
### Command Line Syntax

```
FatAntelope source-file target-file output-file [transformed-file]
source-file : (input) original config file path. E.g. the development web.config
target-file : (input) final config file path. E.g. the production web.config
output-file : (output) file path to save the generated patch. E.g. web.release.config
transformed-file : (output, optional) file path to save the result from applying the output-file to the source-file.
```

## Example

`FatAntelope app.config prod_app.config app.release.config`

Source File (app.config):

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="Users" connectionString="Data Source=127.0.0.1;initial catalog=UserDB;user id=myUser;password=myPassword" providerName="System.Data.EntityClient" />
<add name="Posts" connectionString="Data Source=127.0.0.1;initial catalog=PostDB;user id=myUser;password=myPassword" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="MyUrl" value="http://localhost:50634" />
<add key="MyService.Api" value="http://localhost:10424" />
</appSettings>
</configuration>
```

**FatAntelope source-file target-file output-file [transformed-file]**
Target File (prod_app.config) :

source-file : (input) original config file path. E.g. the development web.config
```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="Users" connectionString="Data Source=203.1.1.1;initial catalog=UserDB;user id=myUser;password=myPassword" providerName="System.Data.EntityClient" />
<add name="Posts" connectionString="Data Source=203.1.1.1;initial catalog=PostDB;user id=myUser;password=myPassword" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="MyUrl" value="http://MyAmazingWebsite.com" />
<add key="MyService.Api" value="http://MyAmazingWebsite.com/Api" />
</appSettings>
</configuration>
```

target-file : (input) final config file path. E.g. the production web.config
Patch File (app.release.config) :

output-file : (output) file path to save the generated patch . E.g. web.release.config
```xml
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="Users" xdt:Locator="Match(name)" connectionString="Data Source=203.1.1.1;initial catalog=UserDB;user id=myUser;password=myPassword" xdt:Transform="SetAttributes(connectionString)" />
<add name="Posts" xdt:Locator="Match(name)" connectionString="Data Source=203.1.1.1;initial catalog=PostDB;user id=myUser;password=myPassword" xdt:Transform="SetAttributes(connectionString)" />
</connectionStrings>
<appSettings>
<add key="MyUrl" xdt:Locator="Match(key)" value="http://MyAmazingWebsite.com" xdt:Transform="SetAttributes(value)" />
<add key="MyService.Api" xdt:Locator="Match(key)" value="http://MyAmazingWebsite.com/Api" xdt:Transform="SetAttributes(value)" />
</appSettings>
</configuration>
```

transformed-file : (output, optional) file path to save the result from applying the output-file to the source-file.
## Caveats

Known Issues
============
- The generated XDT transform may not have the most optimal values for the xdt:Locator and xdt:Transform attributes. I recommend only using this output as a starting-point for your transforms.

- The XML comparison algorithm used (XDiff) does an unordered comparison of XML nodes, so changes to child elements' position within the same parent will be ignored.
Binary file added banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6a34a9e

Please sign in to comment.