1. Christian Junk
  2. Tree Surgeon

Commits

Christian Junk  committed 9385f63

Initial import of latest available Tree Surgeon source,
version 2.0 21426.

  • Participants
  • Branches default
  • Tags v2.0.21426

Comments (0)

Files changed (705)

File .hgignore

View file
+syntax: glob
+*.obj
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*.vssscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.cache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.scc
+[Bb]in
+[Dd]ebug*/
+obj/
+[Rr]elease*/
+_ReSharper*/
+[Tt]humbs.db
+[Tt]est[Rr]esult*
+[Bb]uild[Ll]og.*
+*.[Pp]ublish.xml
+*.resharper

File TreeSurgeon.build

View file
+<?xml version="1.0" ?>
+<project name="nant" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
+
+	<property name="nant.settings.currentframework" value="net-3.5"/>
+	<property name="msbuild.exe" value="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe" />
+	<property name="msbuild.verbosity" value="Quiet"/>
+	<property name="build.dir" value="build" />
+	<property name="verbose" value="false" />
+
+	<!-- User targets --> 
+	<target name="clean" description="Delete Automated Build artifacts">
+		<delete dir="${build.dir}" if="${directory::exists('build')}" verbose="${verbose}"/>
+	</target>
+	
+	<target name="compile" description="Compiles using the AutomatedDebug Configuration">
+		<exec program="${msbuild.exe}">
+			<arg value="src\TreeSurgeon.sln" />
+			<arg value="/p:Configuration=AutomatedDebug" />
+			<arg value="/v:${msbuild.verbosity}" />
+		</exec>
+	</target>
+		
+	<target name="test" depends="compile, run-unit-tests, run-acceptance-tests" description="Compile and Run Tests" />
+		
+	<target name="continuous-integration" depends="clean, continuous-integration-setup-versioning, test, dist, continuous-integration-publish" />
+	
+	<!-- Internal targets -->
+	<target name="run-unit-tests">
+		<mkdir dir="${build.dir}\test-reports" failonerror="false" />
+		<nunit2>
+			<formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}\test-reports" />
+			<test assemblyname="${build.dir}\Debug\UnitTests\TreeSurgeon.UnitTests.dll" />
+		</nunit2>
+	</target>
+
+	<target name="run-acceptance-tests">
+		<copy todir="${build.dir}\Debug\AcceptanceTests" verbose="${verbose}" >
+			<fileset basedir="${build.dir}\Debug\TreeSurgeonConsole">
+				<include name="**\*" />
+			</fileset>
+		</copy>
+		<mkdir dir="${build.dir}\test-reports" verbose="${verbose}" />
+		<nunit2>
+			<formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}\test-reports" />
+			<test assemblyname="${build.dir}\Debug\AcceptanceTests\TreeSurgeon.AcceptanceTests.dll" />
+		</nunit2>
+	</target>
+	
+	<target name="dist">
+		<!-- Binary zip -->
+		<copy todir="${build.dir}\dist" verbose="${verbose}">
+			<fileset basedir="${build.dir}\Debug\TreeSurgeonConsole">
+				<include name="**\*"/>
+				<exclude name="**\*.pdb" />
+				<exclude name="**\PostBuildEvent.bat" />
+			</fileset>
+		</copy>
+
+		<copy todir="${build.dir}\dist" verbose="${verbose}">
+			<fileset basedir="${build.dir}\Debug\WindowsUI">
+				<include name="**\*"/>
+				<exclude name="**\*.pdb" />
+				<exclude name="**\PostBuildEvent.bat" />
+			</fileset>
+		</copy>
+
+		<copy todir="${build.dir}\dist" file="license.txt" />
+		<copy file="tools\nant\license.html" tofile="${build.dir}\dist\nant-license.html" />
+		<copy file="tools\nunit\license.html" tofile="${build.dir}\dist\nunit-license.html" />
+		
+		<zip zipfile="${build.dir}\TreeSurgeon-${CCNetLabel}.zip" verbose="${verbose}">
+			<fileset basedir="${build.dir}\dist">
+				<include name="**\*" />
+			</fileset>
+		</zip>
+
+		<!-- Source Zip -->
+		<copy todir="${build.dir}\dist-src" verbose="${verbose}">
+			<fileset>
+				<include name="**\*"/>
+				<exclude name="build\**\*" />
+				<exclude name="dist" />
+				<exclude name="dist/**" />
+				<exclude name="src/*/bin" />
+				<exclude name="src/*/obj" />
+				<exclude name="src/*/bin/**" />
+				<exclude name="src/*/obj/**" />
+				<exclude name="**/*.suo" />
+				<exclude name="**/*.user" />
+				<exclude name="**/*.resharperoptions" />
+				<exclude name="src\_ReSharper.TreeSurgeon\**\*" />
+			</fileset>
+		</copy>
+
+		<zip zipfile="${build.dir}\TreeSurgeon-${CCNetLabel}.source.zip" verbose="${verbose}">
+			<fileset basedir="${build.dir}\dist-src">
+				<include name="**\*" />
+			</fileset>
+		</zip>
+
+		<!-- Installer -->
+		<exec program="tools\NSIS\makensis.exe" commandline="TreeSurgeon.nsi" verbose="${verbose}" />
+	</target>
+	
+	<target name="continuous-integration-setup-versioning">
+
+		<!-- set the build number format for TeamCity to use so we don't have to reconfigure the project when versions bump -->
+		<echo message="##teamcity[buildNumber '2.1.{build.number}']"/>
+	
+		<!-- have to set a NAnt property manually as the one coming back from TeamCity at this point is the original format -->
+		<property name="version.number" value="2.1.${build.number}" />
+	
+		<asminfo output="src/CommonAssemblyInfo.cs" language="CSharp">
+			<imports>
+				<import name="System.Reflection" />
+			</imports>
+			<attributes>
+				<attribute type="AssemblyVersionAttribute" value="${build.number}" />
+				<attribute type="AssemblyCopyrightAttribute" value="Copyright © 2007 - 2008 Bil Simser, Copyright © 2005 - 2006 Mike Roberts, ThoughtWorks Inc." />
+				<attribute type="AssemblyCompanyAttribute" value="ThoughtWorks" />
+				<attribute type="AssemblyProductAttribute" value="Tree Surgeon" />
+			</attributes>
+		</asminfo>
+
+	</target>
+		
+	<target name="continuous-integration-publish">
+		<property name="publish.dir" value="${CCNetArtifactDirectory}\${CCNetLabel}" />
+		<mkdir dir="${publish.dir}" />
+		<copy todir="${publish.dir}">
+			<fileset basedir="build">
+				<include name="*.exe"/>
+				<include name="*.zip"/>
+			</fileset>
+		</copy>			
+	</target>
+  
+</project>

File TreeSurgeon.nsi

View file
+; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "Tree Surgeon"
+!define PRODUCT_VERSION "2.0"
+!define PRODUCT_PUBLISHER "Bil Simser"
+!define PRODUCT_WEB_SITE "http://www.codeplex.com/treesurgeon"
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\TreeSurgeonGUI.exe"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+
+; MUI 1.67 compatible ------
+!include "MUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "src\WindowsUI\Tree.ico"
+!define MUI_UNICON "src\WindowsUI\Tree.ico"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+; License page
+!insertmacro MUI_PAGE_LICENSE "license.txt"
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define MUI_FINISHPAGE_RUN "$INSTDIR\TreeSurgeonGUI.exe"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "build\TreeSurgeon-${PRODUCT_VERSION}-Setup.exe"
+InstallDir "$PROGRAMFILES\Tree Surgeon"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+Section "MainSection" SEC01
+  SetOutPath "$INSTDIR"
+  SetOverwrite ifnewer
+  File /r "build\dist\*"
+  CreateDirectory "$SMPROGRAMS\Tree Surgeon"
+  CreateShortCut "$SMPROGRAMS\Tree Surgeon\Tree Surgeon.lnk" "$INSTDIR\TreeSurgeonGUI.exe"
+  CreateShortCut "$DESKTOP\Tree Surgeon.lnk" "$INSTDIR\TreeSurgeonGUI.exe"
+SectionEnd
+
+Section -AdditionalIcons
+  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
+  CreateShortCut "$SMPROGRAMS\Tree Surgeon\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
+  CreateShortCut "$SMPROGRAMS\Tree Surgeon\Uninstall.lnk" "$INSTDIR\uninst.exe"
+SectionEnd
+
+Section -Post
+  WriteUninstaller "$INSTDIR\uninst.exe"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "src\WindowsUI\Tree.ico"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+SectionEnd
+
+Function un.onUninstSuccess
+  HideWindow
+  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+FunctionEnd
+
+Function un.onInit
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+  Abort
+FunctionEnd
+
+Section Uninstall
+  RMDir /r "$INSTDIR"
+
+  Delete "$SMPROGRAMS\Tree Surgeon\Uninstall.lnk"
+  Delete "$SMPROGRAMS\Tree Surgeon\Website.lnk"
+  Delete "$SMPROGRAMS\Tree Surgeon\Tree Surgeon.lnk"
+  Delete "$DESKTOP\Tree Surgeon.lnk"
+
+  RMDir "$SMPROGRAMS\Tree Surgeon"
+
+  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+  SetAutoClose true
+SectionEnd

File go.bat

View file
+@tools\nant\NAnt.exe -buildfile:TreeSurgeon.build %*

File lib/AdaptiveConsole.dll

Binary file added.

File lib/Commons.dll

Binary file added.

File lib/MbUnit.Framework.dll

Binary file added.

File lib/NVelocity.dll

Binary file added.

File lib/log4net.dll

Binary file added.

File lib/nmock.dll

Binary file added.

File lib/nunit.framework.dll

Binary file added.

File license.txt

View file
+MIT License
+
+Copyright � 2007 - 2008 Bil Simser
+Copyright � 2005 - 2006 Mike Roberts & ThoughtWorks
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
+and associated documentation files (the "Software"), to deal in the Software without restriction, 
+including without limitation the rights to use, copy, modify, merge, publish, distribute, 
+sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or 
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
+BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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. 

File src/AcceptanceTests/AcceptanceTests.csproj

View file
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>9.0.21022</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{7CF4428D-1BD0-4C5C-885E-2706C9C8D761}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon>
+    </ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>TreeSurgeon.AcceptanceTests</AssemblyName>
+    <AssemblyOriginatorKeyFile>
+    </AssemblyOriginatorKeyFile>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <RootNamespace>TreeSurgeon.AcceptanceTests</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <StartupObject>
+    </StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <OutputPath>bin\Debug\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>false</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>true</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>none</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AutomatedDebug|AnyCPU' ">
+    <OutputPath>..\..\build\Debug\AcceptanceTests\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework">
+      <Name>nunit.framework</Name>
+      <HintPath>..\..\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System">
+      <Name>System</Name>
+    </Reference>
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <ProjectReference Include="..\Core\Core.csproj">
+      <Name>Core</Name>
+      <Project>{122C6B21-ECAE-4535-9B15-F379A866F12F}</Project>
+      <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\CommonAssemblyInfo.cs">
+      <Link>CommonAssemblyInfo.cs</Link>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConsoleAcceptanceTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

File src/AcceptanceTests/AssemblyInfo.cs

View file
+using System.Reflection;
+//
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly : AssemblyTitle("Tree Surgeon Acceptance Tests")]
+[assembly : AssemblyDescription("")]
+[assembly : AssemblyConfiguration("")]

File src/AcceptanceTests/ConsoleAcceptanceTest.cs

View file
+using System;
+using System.IO;
+using NUnit.Framework;
+using TreeSurgeon.Core.Utils;
+
+namespace TreeSurgeon.AcceptanceTests
+{
+    [TestFixture]
+    public class ConsoleAcceptanceTest
+    {
+        #region Setup/Teardown
+
+        [SetUp]
+        public void Setup()
+        {
+            projectName = "AcceptanceTestProject";
+            outputPath =
+                Path.Combine(
+                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "TreeSurgeon"),
+                    projectName);
+            wd = new DirectoryInfo(Directory.GetCurrentDirectory());
+        }
+
+        [TearDown]
+        public void Teardown()
+        {
+            try
+            {
+                // If at first you don't succeed...
+                DeleteOutputDir();
+            }
+            catch (Exception)
+            {
+                // .. try again. (Stoopid windows file locking...)
+                DeleteOutputDir();
+            }
+        }
+
+        #endregion
+
+        private string projectName;
+        private string outputPath;
+        private DirectoryInfo wd;
+
+        private void DeleteOutputDir()
+        {
+            if (Directory.Exists(outputPath))
+            {
+                Directory.Delete(outputPath, true);
+            }
+        }
+
+        private string RunNantAndCheckPasses(string nantArgs)
+        {
+            var nantResult = new ProcessExecutor().Execute(new ProcessInfo("go.bat", nantArgs, outputPath));
+            var nantOutput = nantResult.StandardOutput;
+
+            if (nantResult.ExitCode != 0)
+            {
+                Console.WriteLine("Go.bat failed");
+                Console.WriteLine("** Standard out from go.bat: **");
+                Console.WriteLine(nantOutput);
+                Console.WriteLine("** End of Standard out from go.bat: **\n");
+                Console.WriteLine("Standard err:");
+                Console.WriteLine(nantResult.StandardError);
+                Assert.Fail("Go.bat failed");
+            }
+
+            Assert.IsTrue(nantOutput.IndexOf("BUILD SUCCEEDED") > -1);
+            return nantOutput;
+        }
+
+        private void RunTreeSurgeonAndCheckOK()
+        {
+            //TODO: We are passing in 2005 as the version. Need to test for other versions as they generate different output
+            var TreeSurgeonResult =
+                new ProcessExecutor().Execute(new ProcessInfo(Path.Combine(wd.Name, "TreeSurgeonConsole.exe"),
+                                                              projectName + " 2005", wd.Parent.FullName));
+            if (TreeSurgeonResult.ExitCode != 0)
+            {
+                Console.WriteLine("TreeSurgeon Console failed");
+                Console.WriteLine("** Standard out from TreeSurgeon.exe: **");
+                Console.WriteLine(TreeSurgeonResult.StandardOutput);
+                Console.WriteLine("** End of Standard out from TreeSurgeon.exe: **\n");
+                Console.WriteLine("Standard err:");
+                Console.WriteLine(TreeSurgeonResult.StandardError);
+                Assert.Fail("TreeSurgeon console app failed");
+            }
+
+            Assert.IsTrue(Directory.Exists(outputPath));
+        }
+
+        private void CheckFileExistsAndIsBiggerThan(string fileName, int fileSize)
+        {
+            var expectedLocation = Path.Combine(Path.Combine(outputPath, "build"), fileName);
+            Assert.IsTrue(File.Exists(expectedLocation));
+            Assert.IsTrue(new FileInfo(expectedLocation).Length > fileSize);
+        }
+
+        [Test]
+        [Ignore("Broken after adding 2005/2008 support, needs to be fixed")]
+        public void GeneratedTreeShouldGenerateDistributionFiles()
+        {
+            RunTreeSurgeonAndCheckOK();
+            RunNantAndCheckPasses("full");
+            CheckFileExistsAndIsBiggerThan(projectName + ".zip", 1000);
+        }
+
+        [Test]
+        [Ignore("Broken after adding 2005/2008 support, needs to be fixed")]
+        public void GeneratedTreeShouldRunNCoverForUnitTests()
+        {
+            RunTreeSurgeonAndCheckOK();
+            RunNantAndCheckPasses("full");
+            CheckFileExistsAndIsBiggerThan(Path.Combine("test-reports", "Coverage.xml"), 500);
+        }
+
+        [Test]
+        [Ignore(
+            "Currently only works in NAnt build - need some Post-Build script that is configuration dependent to set this up for VS use."
+            )]
+        public void ShouldGenerateADevelopmentTreeWithCorrectNameThatBuildsSuccessfullyAndCanBeCleaned()
+        {
+            RunTreeSurgeonAndCheckOK();
+
+            var nantOutput = RunNantAndCheckPasses("");
+            Console.WriteLine(nantOutput);
+            Assert.IsTrue(nantOutput.IndexOf("[msbuild]   Building solution configuration \"AutomatedDebug|Any CPU\"") >
+                          -1);
+            Assert.IsTrue(nantOutput.IndexOf("Tests run: 1, Failures: 0") > -1);
+            Assert.IsTrue(Directory.Exists(Path.Combine(outputPath, "build")));
+            CheckFileExistsAndIsBiggerThan(Path.Combine("test-reports", "UnitTests.xml"), 500);
+            RunNantAndCheckPasses("clean");
+            Assert.IsFalse(Directory.Exists(Path.Combine(outputPath, "build")));
+        }
+    }
+}

File src/CommonAssemblyInfo.cs

View file
+using System.Reflection;
+
+[assembly: AssemblyVersionAttribute("0.0.0.0")]
+[assembly: AssemblyCopyrightAttribute("Copyright � 2007 - 2008 Bil Simser, Copyright � 2005 - 2006 Mike Roberts, ThoughtWorks Inc.")]
+[assembly: AssemblyCompanyAttribute("ThoughtWorks")]
+[assembly: AssemblyProductAttribute("Tree Surgeon")]

File src/Core/AssemblyInfo.cs

View file
+using System.Reflection;
+//
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly : AssemblyTitle("Tree Surgeon Core")]
+[assembly : AssemblyDescription("")]
+[assembly : AssemblyConfiguration("")]

File src/Core/Core.csproj

View file
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>9.0.21022</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{122C6B21-ECAE-4535-9B15-F379A866F12F}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon>
+    </ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>TreeSurgeon.Core</AssemblyName>
+    <AssemblyOriginatorKeyFile>
+    </AssemblyOriginatorKeyFile>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <RootNamespace>TreeSurgeon.Core</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <StartupObject>
+    </StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <OutputPath>bin\Debug\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>false</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>true</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>none</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AutomatedDebug|AnyCPU' ">
+    <OutputPath>..\..\build\Debug\Core\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Commons, Version=1.0.1106.21941, Culture=neutral">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\lib\Commons.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net">
+      <Name>log4net</Name>
+      <HintPath>..\..\lib\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="NVelocity">
+      <Name>NVelocity</Name>
+      <HintPath>..\..\lib\NVelocity.dll</HintPath>
+    </Reference>
+    <Reference Include="System">
+      <Name>System</Name>
+    </Reference>
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\CommonAssemblyInfo.cs">
+      <Link>CommonAssemblyInfo.cs</Link>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\DefaultDirectoryCopier.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\DefaultVelocityTransformerConfig.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\FileGeneratorWithTransformer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\ICopyDirectories.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\ITransformFiles.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\IGenerateFiles.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\IConfigureTheTransformer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\Content\LazilyInitialisingVelocityTransformer.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\IGenerateGuids.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Generators\StandardDotNetUpperCaseGuidGenerator.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="IBuildDirectories.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="IGenerateSolutionTrees.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SimpleDirectoryBuilder.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="SimpleTreeGenerator.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="TreeSurgeonFrontEnd.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\IExecuteProcesses.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\Log.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\ProcessExecutor.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\ProcessInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\ProcessReader.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\ProcessResult.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <None Include="Resources\Templates\2003\AssemblyInfo.cs.vm" />
+    <None Include="Resources\Templates\2003\Sapling.build.mbunit.vm" />
+    <None Include="Resources\Templates\2003\Core.csproj.vm" />
+    <None Include="Resources\Templates\2003\go.bat.vm" />
+    <None Include="Resources\Templates\2003\HelloWorld.cs.vm" />
+    <None Include="Resources\Templates\2003\Sapling.build.nunit.vm" />
+    <None Include="Resources\Templates\2003\Sapling.sln.vm" />
+    <None Include="Resources\Templates\2003\SaplingConsole.csproj.vm" />
+    <None Include="Resources\Templates\2003\Test1.cs.vm" />
+    <None Include="Resources\Templates\2003\UnitTests.csproj.vm" />
+    <None Include="Resources\Templates\2005\AssemblyInfo.cs.vm" />
+    <None Include="Resources\Templates\2005\Sapling.build.mbunit.vm" />
+    <None Include="Resources\Templates\2005\Core.csproj.vm" />
+    <None Include="Resources\Templates\2005\go.bat.vm" />
+    <None Include="Resources\Templates\2005\HelloWorld.cs.vm" />
+    <None Include="Resources\Templates\2005\Sapling.build.nunit.vm" />
+    <None Include="Resources\Templates\2005\Sapling.sln.vm" />
+    <None Include="Resources\Templates\2005\SaplingConsole.csproj.vm" />
+    <None Include="Resources\Templates\2005\Test1.cs.vm" />
+    <None Include="Resources\Templates\2005\UnitTests.csproj.vm" />
+    <None Include="Resources\Templates\2008\AssemblyInfo.cs.vm" />
+    <None Include="Resources\Templates\2008\Sapling.build.mbunit.vm" />
+    <None Include="Resources\Templates\2008\Core.csproj.vm" />
+    <None Include="Resources\Templates\2008\go.bat.vm" />
+    <None Include="Resources\Templates\2008\HelloWorld.cs.vm" />
+    <None Include="Resources\Templates\2008\Sapling.build.nunit.vm" />
+    <None Include="Resources\Templates\2008\Sapling.sln.vm" />
+    <None Include="Resources\Templates\2008\SaplingConsole.csproj.vm" />
+    <None Include="Resources\Templates\2008\Test1.cs.vm" />
+    <None Include="Resources\Templates\2008\UnitTests.csproj.vm" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>

File src/Core/Generators/Content/DefaultDirectoryCopier.cs

View file
+using System.IO;
+
+namespace TreeSurgeon.Core.Generators.Content
+{
+    public class DefaultDirectoryCopier : ICopyDirectories
+    {
+        #region ICopyDirectories Members
+
+        public void CopyDirectory(string sourceDirectory, string targetDirectory)
+        {
+            var sourceDirectoryInfo = new DirectoryInfo(sourceDirectory);
+            var targetDirectoryInfo = new DirectoryInfo(targetDirectory);
+
+            if (targetDirectoryInfo.Exists)
+            {
+                targetDirectoryInfo.Create();
+            }
+            foreach (var sourceChildDirectory in sourceDirectoryInfo.GetDirectories())
+            {
+                var targetChildDirectory = targetDirectoryInfo.CreateSubdirectory(sourceChildDirectory.Name);
+                CopyDirectory(sourceChildDirectory.FullName, targetChildDirectory.FullName);
+            }
+            foreach (var sourceFile in sourceDirectoryInfo.GetFiles())
+            {
+                sourceFile.CopyTo(Path.Combine(targetDirectoryInfo.FullName, sourceFile.Name));
+            }
+        }
+
+        #endregion
+    }
+}

File src/Core/Generators/Content/DefaultVelocityTransformerConfig.cs

View file
+namespace TreeSurgeon.Core.Generators.Content
+{
+    public class DefaultVelocityTransformerConfig : IConfigureTheTransformer
+    {
+        private readonly string _templateDirectory;
+
+        public DefaultVelocityTransformerConfig(string templateDirectory)
+        {
+            _templateDirectory = templateDirectory;
+        }
+
+        #region IConfigureTheTransformer Members
+
+        public string TemplateDirectory
+        {
+            get { return _templateDirectory; }
+        }
+
+        #endregion
+
+        public override bool Equals(object obj)
+        {
+            return (obj is DefaultVelocityTransformerConfig &&
+                    ((DefaultVelocityTransformerConfig) obj).TemplateDirectory == TemplateDirectory);
+        }
+
+        public override int GetHashCode()
+        {
+            return TemplateDirectory.GetHashCode();
+        }
+    }
+}

File src/Core/Generators/Content/FileGeneratorWithTransformer.cs

View file
+using System;
+using System.Collections;
+using System.IO;
+
+namespace TreeSurgeon.Core.Generators.Content
+{
+    public class FileGeneratorWithTransformer : IGenerateFiles
+    {
+        private readonly ITransformFiles _fileTransformer;
+
+        public FileGeneratorWithTransformer(ITransformFiles transformFiles)
+        {
+            _fileTransformer = transformFiles;
+        }
+
+        #region IGenerateFiles Members
+
+        public void Generate(string outputFileName, string transformName, Hashtable transformParameters)
+        {
+            if (File.Exists(outputFileName))
+            {
+                throw new ApplicationException(string.Format("Did not expect file [{0}] to already exist",
+                                                             outputFileName));
+            }
+
+            var outputDir = Path.GetDirectoryName(outputFileName);
+            if (! Directory.Exists(outputDir))