Skip to content

Commit

Permalink
Added additional logging and fixed an issue with '.' in the package name
Browse files Browse the repository at this point in the history
  • Loading branch information
cturano committed Sep 21, 2015
1 parent 8e86f58 commit 7318b64
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 7 deletions.
Binary file removed Hhogdev.SitecorePackageDeployer_v1.1.update
Binary file not shown.
Binary file added Hhogdev.SitecorePackageDeployer_v1.2.update
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<PackageAuthor>Charles Turano</PackageAuthor>
<PackagePublisher>Hedgehog Development</PackagePublisher>
<PackageReadme>Installs packages using a folder</PackageReadme>
<PackageVersion>1.0</PackageVersion>
<PackageVersion>1.2</PackageVersion>
<SitecoreAssemblyPath>..\packages\SitecoreKernel.7.0.0.131127\lib</SitecoreAssemblyPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
Expand Down
11 changes: 9 additions & 2 deletions SitecorePackageDeployer/Tasks/InstallPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,14 @@ internal static void ExecutePostSteps(PostStepDetails postStepDetails)
/// </summary>
private void FindAndUpdateChangedConfigs(string installPackageName)
{
string appConfigFolder = MainUtil.MapPath("/App_Config");
string appConfigFolder = MainUtil.MapPath("/");

foreach (string newConfigFile in Directory.GetFiles(appConfigFolder, "*.config." + installPackageName, SearchOption.AllDirectories))
{
string oldConfigFile = Path.Combine(Path.GetDirectoryName(newConfigFile), Path.GetFileNameWithoutExtension(newConfigFile));
Log.Info(string.Format("Found changed config {0}", newConfigFile), this);

int configExtensionPos = newConfigFile.LastIndexOf(".config") + 7;
string oldConfigFile = Path.Combine(Path.GetDirectoryName(newConfigFile), newConfigFile.Substring(0, configExtensionPos));
string backupConfigFile = newConfigFile + string.Format(".backup{0:yyyyMMddhhmmss}", DateTime.Now);

//Backup the existing config file
Expand All @@ -310,9 +313,13 @@ private void FindAndUpdateChangedConfigs(string installPackageName)
File.Delete(backupConfigFile);
}

Log.Info(string.Format("Backing up config file {0} as {1}", oldConfigFile, backupConfigFile), this);

File.Move(oldConfigFile, backupConfigFile);
}

Log.Info(string.Format("Copying new config file from {0} to {1}", newConfigFile, oldConfigFile), this);

//Move the new file into place
File.Copy(newConfigFile, oldConfigFile);

Expand Down
2 changes: 1 addition & 1 deletion TestUpdatePackage.Web/App_Config/Include/NewConfig1.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<configuration>
<sitecore/>
<!-- Test 2 1234s-->
<!-- Test 2 1234-->
</configuration>
2 changes: 1 addition & 1 deletion TestUpdatePackage.Web/App_Config/Include/TestPatch.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<!-- Test Patch File 124-->
<!-- Test Patch File 123-->
</sitecore>
</configuration>
2 changes: 1 addition & 1 deletion TestUpdatePackage.Web/App_Config/NewConfig2.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<!-- Test 1 1-->
<!-- Test 1 1 1-->
</system.web>
</configuration>
2 changes: 1 addition & 1 deletion TestUpdatePackage/TestUpdatePackage.scproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<GeneratePackage>True</GeneratePackage>
<SeperateFilesAndItems>False</SeperateFilesAndItems>
<PackageExcludeCode>False</PackageExcludeCode>
<AddDateTimeToPackageName>False</AddDateTimeToPackageName>
<AddDateTimeToPackageName>True</AddDateTimeToPackageName>
<PackageAuthor>Charles Turano</PackageAuthor>
<PackagePublisher>Hedgehog Development</PackagePublisher>
<PackageReadme>This package tests the package deployer</PackageReadme>
Expand Down

0 comments on commit 7318b64

Please sign in to comment.