-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Distribution mode for Curupira.WindowsService and adjustments to the …
…build scripts
- Loading branch information
Showing
27 changed files
with
566 additions
and
191 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,44 @@ | ||
using NLog; | ||
using NLog.Config; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace Curupira.AppClient | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
public static class AppConfigurationHelper | ||
{ | ||
public static void ConfigureAppSettings(string configFileName) | ||
{ | ||
// Override the default app.config location | ||
var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\conf", configFileName); | ||
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configPath); | ||
} | ||
|
||
public static void ConfigureNLog() | ||
{ | ||
// Load NLog configuration from the specified path | ||
var nlogConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\conf\NLog.config"); | ||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath); | ||
} | ||
|
||
public static Assembly ResolveAssemblyFromLibFolder(object sender, ResolveEventArgs args) | ||
{ | ||
// Extract the assembly name | ||
var assemblyName = new AssemblyName(args.Name).Name + ".dll"; | ||
var libPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\lib", assemblyName); | ||
|
||
// Check if the DLL exists in the lib directory | ||
if (File.Exists(libPath)) | ||
{ | ||
#pragma warning disable S3885 | ||
return Assembly.LoadFrom(libPath); | ||
#pragma warning restore S3885 | ||
} | ||
|
||
return null; // Return null if the assembly is not found | ||
} | ||
} | ||
} |
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
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
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
Binary file not shown.
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,44 @@ | ||
using NLog; | ||
using NLog.Config; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace Curupira.WindowsService | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
public static class AppConfigurationHelper | ||
{ | ||
public static void ConfigureAppSettings(string configFileName) | ||
{ | ||
// Override the default app.config location | ||
var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\conf", configFileName); | ||
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configPath); | ||
} | ||
|
||
public static void ConfigureNLog() | ||
{ | ||
// Load NLog configuration from the specified path | ||
var nlogConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\conf\NLog.config"); | ||
LogManager.Configuration = new XmlLoggingConfiguration(nlogConfigPath); | ||
} | ||
|
||
public static Assembly ResolveAssemblyFromLibFolder(object sender, ResolveEventArgs args) | ||
{ | ||
// Extract the assembly name | ||
var assemblyName = new AssemblyName(args.Name).Name + ".dll"; | ||
var libPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\lib", assemblyName); | ||
|
||
// Check if the DLL exists in the lib directory | ||
if (File.Exists(libPath)) | ||
{ | ||
#pragma warning disable S3885 | ||
return Assembly.LoadFrom(libPath); | ||
#pragma warning restore S3885 | ||
} | ||
|
||
return null; // Return null if the assembly is not found | ||
} | ||
} | ||
} |
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<plugin xmlns="http://ampliar.dev.br/projects/curupira/plugin/backup-plugin" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ampliar.dev.br/projects/curupira/plugin/backup-plugin backup-plugin.xsd"> | ||
<settings destination="c:\temp" limit="3" /> | ||
<backups> | ||
<backup id="ruby" root="C:\Ruby"> | ||
<remove>bin</remove> | ||
<remove>etc</remove> | ||
<remove>include\</remove> | ||
<remove>lib\</remove> | ||
<remove>msys64</remove> | ||
<remove>packages\*</remove> | ||
<remove>**\*.html</remove> | ||
<remove>LICENSE.txt</remove> | ||
</backup> | ||
<backup id="dell" root="C:\Dell\Drivers\HFVP5\EULA" destination="P:\temp"> | ||
</backup> | ||
<backup id="xampp" root="C:\xampp\cgi-bin"> | ||
<remove>*.pl</remove> | ||
</backup> | ||
<backup id="tomcat" root="C:\tomcat" /> | ||
</backups> | ||
</plugin> |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="http://ampliar.dev.br/projects/curupira/plugin/backup-plugin" | ||
xmlns="http://ampliar.dev.br/projects/curupira/plugin/backup-plugin" | ||
elementFormDefault="qualified"> | ||
|
||
<xs:element name="plugin"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="settings"> | ||
<xs:complexType> | ||
<xs:attribute name="destination" type="xs:string" use="optional" /> | ||
<xs:attribute name="limit" type="xs:positiveInteger" use="optional" /> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="backups"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="backup" maxOccurs="unbounded"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="remove" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> | ||
</xs:sequence> | ||
<xs:attribute name="id" type="xs:string" use="required" /> | ||
<xs:attribute name="root" type="xs:string" use="required" /> | ||
<xs:attribute name="destination" type="xs:string" use="optional" /> | ||
</xs:complexType> | ||
<xs:unique name="uniqueBackupId"> | ||
<xs:selector xpath="." /> | ||
<xs:field xpath="@id" /> | ||
</xs:unique> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> |
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<plugin xmlns="http://ampliar.dev.br/projects/curupira/plugin/folders-creator-plugin" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ampliar.dev.br/projects/curupira/plugin/folders-creator-plugin folders-creator-plugin.xsd"> | ||
<directories> | ||
<add>C:\temp\myapp\bin</add> | ||
<add>C:\temp\myapp\backup\logs</add> | ||
<add>C:\temp\myapp\other</add> | ||
<add>\\192.168.1.1\daniel\folder\newfolder</add> | ||
</directories> | ||
</plugin> |
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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="http://ampliar.dev.br/projects/curupira/plugin/folders-creator-plugin" | ||
xmlns="http://ampliar.dev.br/projects/curupira/plugin/folders-creator-plugin" | ||
elementFormDefault="qualified"> | ||
|
||
<xs:element name="plugin"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="directories"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="add" type="xs:string" maxOccurs="unbounded"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> |
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,25 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<plugin xmlns="http://ampliar.dev.br/projects/curupira/plugin/installer-plugin" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ampliar.dev.br/projects/curupira/plugin/installer-plugin installer-plugin.xsd"> | ||
<components> | ||
<component id="ruby" type="zip"> | ||
<param name="SourceFile" value="C:\temp\ruby.zip" /> | ||
<param name="TargetDir" value="P:\Ruby" /> | ||
<remove>include\ruby-3.2.0\ruby.h</remove> | ||
<remove>include\ruby-3.2.0\ruby\io\*</remove> | ||
</component> | ||
<component id="InstallAppTest" type="msi" action="install"> | ||
<param name="SourceFile" value="C:\temp\AppTeste.msi" /> | ||
<param name="Params" value="/qn" /> | ||
</component> | ||
<component id="Install.bat" type="bat"> | ||
<param name="SourceFile" value="C:\temp\Install.bat" /> | ||
<param name="Params" value="C:\temp\myapp" /> | ||
</component> | ||
<component id="Installer.exe" type="exe"> | ||
<param name="SourceFile" value="C:\temp\Installer.exe" /> | ||
<param name="Params" value="C:\temp\myapp2" /> | ||
</component> | ||
</components> | ||
</plugin> |
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,68 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="http://ampliar.dev.br/projects/curupira/plugin/installer-plugin" | ||
xmlns="http://ampliar.dev.br/projects/curupira/plugin/installer-plugin" | ||
elementFormDefault="qualified" | ||
attributeFormDefault="unqualified"> | ||
|
||
<!-- Root element definition --> | ||
<xs:element name="plugin"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="components"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<!-- One or more components allowed --> | ||
<xs:element name="component" maxOccurs="unbounded"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<!-- One or more params allowed --> | ||
<xs:element name="param" maxOccurs="unbounded"> | ||
<xs:complexType> | ||
<xs:attribute name="name" type="xs:string" use="required"/> | ||
<xs:attribute name="value" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="remove" type="xs:string" minOccurs="0" maxOccurs="unbounded" /> | ||
</xs:sequence> | ||
<!-- Attributes for component --> | ||
<xs:attribute name="id" type="xs:string" use="required"/> | ||
<xs:attribute name="type" use="required"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:string"> | ||
<xs:enumeration value="zip"/> | ||
<xs:enumeration value="msi"/> | ||
<xs:enumeration value="bat"/> | ||
<xs:enumeration value="exe"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:attribute> | ||
<!-- Conditional action attribute for type="msi" --> | ||
<xs:attribute name="action" use="optional"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:string"> | ||
<xs:enumeration value="install"/> | ||
<xs:enumeration value="uninstall"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:attribute> | ||
</xs:complexType> | ||
<!-- Action attribute required only for type="msi" --> | ||
<xs:unique name="uniqueParamName"> | ||
<xs:selector xpath="param"/> | ||
<xs:field xpath="@name"/> | ||
</xs:unique> | ||
<!-- Unique id constraint for component --> | ||
<xs:unique name="uniqueComponentId"> | ||
<xs:selector xpath="component"/> | ||
<xs:field xpath="@id"/> | ||
</xs:unique> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
</xs:schema> |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<plugin xmlns="http://ampliar.dev.br/projects/curupira/plugin/service-manager-plugin" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ampliar.dev.br/projects/curupira/plugin/service-manager-plugin service-manager-plugin.xsd"> | ||
<bundles> | ||
<bundle id="stop_all"> | ||
<service name="WSearch" action="Stop" /> | ||
<service name="wuauserv" action="Stop" /> | ||
</bundle> | ||
<bundle id="start_all"> | ||
<service name="WSearch" action="Start" /> | ||
<service name="wuauserv" action="Start" /> | ||
</bundle> | ||
<bundle id="status_test" logFile="c:\temp\{0:yyyy-MM-dd}-services.txt"> | ||
<service name="VSSERV" action="Status" /> | ||
<service name="W32Time" action="Status" /> | ||
<service name="WaaSMedicSvc" action="Status" /> | ||
</bundle> | ||
</bundles> | ||
</plugin> |
Oops, something went wrong.