-
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- (Core) Added a new RockUpdateV2 block for advanced testing/usage fo…
…r Rock updates.
- Loading branch information
1 parent
dd6db65
commit 6f8f8be
Showing
27 changed files
with
3,401 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
|
||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | ||
<parameters> | ||
<parameter value="mssqllocaldb" /> | ||
</parameters> | ||
</defaultConnectionFactory> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
</providers> | ||
</entityFramework> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.42.0.0" newVersion="1.42.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Google.Apis" publicKeyToken="4b01fa6e34db77ab" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.42.0.0" newVersion="1.42.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Google.Apis.Core" publicKeyToken="4b01fa6e34db77ab" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.42.0.0" newVersion="1.42.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.1.5.0" newVersion="5.1.5.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.1.5.0" newVersion="5.1.5.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// <copyright> | ||
// Copyright by the Spark Development Network | ||
// | ||
// Licensed under the Rock Community License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.rockrms.com/license | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
namespace Rock.Update.Enum | ||
{ | ||
/// <summary> | ||
/// Represents the possible results of a version check. | ||
/// </summary> | ||
public enum DotNetVersionCheckResult | ||
{ | ||
/// <summary> | ||
/// The version check definitely fails | ||
/// </summary> | ||
Fail = 0, | ||
|
||
/// <summary> | ||
/// This version check definitely passes | ||
/// </summary> | ||
Pass = 1, | ||
|
||
/// <summary> | ||
/// The version check could not determine pass or fail so proceed at own risk. | ||
/// </summary> | ||
Unknown = 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// <copyright> | ||
// Copyright by the Spark Development Network | ||
// | ||
// Licensed under the Rock Community License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.rockrms.com/license | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System; | ||
|
||
namespace Rock.Update.Exceptions | ||
{ | ||
/// <summary> | ||
/// The exception that is thrown if the package for the requested version is not found. | ||
/// </summary> | ||
/// <seealso cref="System.Exception" /> | ||
public class PackageNotFoundException : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="PackageNotFoundException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
public PackageNotFoundException( string message ) : base( message ) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// <copyright> | ||
// Copyright by the Spark Development Network | ||
// | ||
// Licensed under the Rock Community License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.rockrms.com/license | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System; | ||
|
||
namespace Rock.Update.Exceptions | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <seealso cref="System.Exception" /> | ||
public class VersionValidationException : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="VersionValidationException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
public VersionValidationException( string message ) : base( message ) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// <copyright> | ||
// Copyright by the Spark Development Network | ||
// | ||
// Licensed under the Rock Community License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.rockrms.com/license | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System; | ||
using System.IO; | ||
using System.Web.Hosting; | ||
using Rock.Model; | ||
|
||
namespace Rock.Update.Helpers | ||
{ | ||
/// <summary> | ||
/// Helper methods for accessing the file system. | ||
/// </summary> | ||
public static class FileManagementHelper | ||
{ | ||
/// <summary> | ||
/// The root physical file system path of the web application. | ||
/// </summary> | ||
public static readonly string ROOT_PATH = HostingEnvironment.MapPath( "~/" ) ?? AppDomain.CurrentDomain.BaseDirectory; | ||
private static readonly string DELETE_FILE_EXTENSION = "rdelete"; | ||
|
||
/// <summary> | ||
/// Tries the delete. | ||
/// </summary> | ||
/// <remarks> | ||
/// This method will always log any exception that occurs even if the exception isn't thrown. | ||
/// </remarks> | ||
/// <param name="filePath">The file path.</param> | ||
/// <param name="shouldBubbleException">if set to <c>true</c> [should bubble exception].</param> | ||
public static void TryDelete( string filePath, bool shouldBubbleException ) | ||
{ | ||
TryDelete( filePath, ( ex ) => ExceptionLogService.LogException( ex ), shouldBubbleException ); | ||
} | ||
|
||
/// <summary> | ||
/// Tries the delete. | ||
/// </summary> | ||
/// <remarks> | ||
/// Will not log the exception by default. | ||
/// </remarks> | ||
/// <param name="filePath">The file path.</param> | ||
/// <param name="catchMethod">The catch method.</param> | ||
/// <param name="shouldBubbleException">if set to <c>true</c> [should bubble exception].</param> | ||
public static void TryDelete( string filePath, Action<Exception> catchMethod, bool shouldBubbleException ) | ||
{ | ||
try | ||
{ | ||
File.Delete( filePath ); | ||
} | ||
catch ( Exception ex ) | ||
{ | ||
catchMethod( ex ); | ||
if ( shouldBubbleException ) | ||
{ | ||
throw; | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Deletes the or rename. | ||
/// </summary> | ||
/// <param name="filepath">The file path.</param> | ||
public static void DeleteOrRename( string filepath ) | ||
{ | ||
if ( File.Exists( filepath ) ) | ||
{ | ||
TryDelete( filepath, ( ex ) => RenameFile( filepath ), false ); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Renames the file. | ||
/// </summary> | ||
/// <param name="physicalFile">The physical file.</param> | ||
public static void RenameFile( string physicalFile ) | ||
{ | ||
if ( File.Exists( physicalFile ) ) | ||
{ | ||
File.Move( physicalFile, GetRenameFileName( physicalFile ) ); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Renames the active file. | ||
/// </summary> | ||
/// <param name="filepathToRename">The file path to rename.</param> | ||
public static void RenameActiveFile( string filepathToRename ) | ||
{ | ||
bool dllFileNotInBin = filepathToRename.EndsWith( ".dll" ) && !filepathToRename.Contains( @"\bin\" ); | ||
bool roslynAssembly = ( filepathToRename.EndsWith( ".dll" ) || filepathToRename.EndsWith( ".exe" ) ) && filepathToRename.Contains( @"\roslyn\" ); | ||
|
||
// If this a roslyn assembly or a dll file from the Content files, rename it so that we don't have problems with it being locks | ||
if ( roslynAssembly || dllFileNotInBin ) | ||
{ | ||
string physicalFile; | ||
if ( roslynAssembly ) | ||
{ | ||
physicalFile = filepathToRename; | ||
} | ||
else | ||
{ | ||
physicalFile = Path.Combine( ROOT_PATH, filepathToRename ); | ||
} | ||
|
||
RenameFile( physicalFile ); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Cleans up deleted files. | ||
/// </summary> | ||
public static void CleanUpDeletedFiles() | ||
{ | ||
var filesToDelete = Directory.GetFiles( ROOT_PATH, $"*.{DELETE_FILE_EXTENSION}", SearchOption.AllDirectories ); | ||
foreach ( var file in filesToDelete ) | ||
{ | ||
FileManagementHelper.TryDelete( file, false ); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of the rename file. | ||
/// </summary> | ||
/// <param name="physicalFile">The physical file.</param> | ||
/// <returns></returns> | ||
private static string GetRenameFileName( string physicalFile ) | ||
{ | ||
var fileCount = 1; | ||
var fileToDelete = $"{physicalFile}.{fileCount}.{DELETE_FILE_EXTENSION}"; | ||
|
||
// generate a unique *.#.rdelete filename | ||
while ( File.Exists( fileToDelete ) ) | ||
{ | ||
fileCount++; | ||
fileToDelete = $"{physicalFile}.{fileCount}.{DELETE_FILE_EXTENSION}"; | ||
} | ||
|
||
return fileToDelete; | ||
} | ||
} | ||
} |
Oops, something went wrong.