Merge pull request #367 from sbwalker/master

fixed external module template so that it generates folder paths correctly
This commit is contained in:
Shaun Walker 2020-04-13 12:48:26 -04:00 committed by GitHub
commit 060d449076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 20 deletions

View File

@ -23,10 +23,10 @@
<ItemGroup> <ItemGroup>
<Reference Include="Oqtane.Client"> <Reference Include="Oqtane.Client">
<HintPath>..\..\oqtane.framework\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Client.dll</HintPath> <HintPath>..\..\[RootFolder]\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Client.dll</HintPath>
</Reference> </Reference>
<Reference Include="Oqtane.Shared"> <Reference Include="Oqtane.Shared">
<HintPath>..\..\oqtane.framework\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath> <HintPath>..\..\[RootFolder]\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -16,7 +16,7 @@
<releaseNotes></releaseNotes> <releaseNotes></releaseNotes>
<summary></summary> <summary></summary>
<dependencies> <dependencies>
<dependency id="Oqtane.Framework" version="0.0.9" /> <dependency id="Oqtane.Framework" version="[FrameworkVersion]" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>

View File

@ -1,6 +1,6 @@
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.dll" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.pdb" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.dll" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.pdb" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.dll" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.pdb" "..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y

View File

@ -1,2 +1,2 @@
"..\..\oqtane.framework\oqtane.package\nuget.exe" pack [Owner].[Module]s.Module.nuspec "..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.Module.nuspec
XCOPY "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\wwwroot\Modules\" /Y XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y

View File

@ -43,10 +43,10 @@
<ItemGroup> <ItemGroup>
<Reference Include="Oqtane.Server"> <Reference Include="Oqtane.Server">
<HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Server.dll</HintPath> <HintPath>..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Server.dll</HintPath>
</Reference> </Reference>
<Reference Include="Oqtane.Shared"> <Reference Include="Oqtane.Shared">
<HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Shared.dll</HintPath> <HintPath>..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Shared.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -21,7 +21,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="Oqtane.Shared"> <Reference Include="Oqtane.Shared">
<HintPath>..\..\oqtane.framework\Oqtane.Shared\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath> <HintPath>..\..\[RootFolder]\Oqtane.Shared\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -186,23 +186,24 @@ namespace Oqtane.Controllers
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
string templatePath = Path.Combine(Directory.GetParent(_environment.ContentRootPath).FullName, "Oqtane.Client\\Modules\\Admin\\ModuleCreator\\Templates\\" + moduleDefinition.Template + "\\");
string rootPath; string rootPath;
DirectoryInfo rootFolder = Directory.GetParent(_environment.ContentRootPath);
string templatePath = Path.Combine(rootFolder.FullName, "Oqtane.Client\\Modules\\Admin\\ModuleCreator\\Templates\\" + moduleDefinition.Template + "\\");
if (moduleDefinition.Template == "internal") if (moduleDefinition.Template == "internal")
{ {
rootPath = Directory.GetParent(_environment.ContentRootPath).FullName + "\\"; rootPath = rootFolder.FullName + "\\";
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, Oqtane.Client"; moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, Oqtane.Client";
moduleDefinition.ServerAssemblyName = "Oqtane.Server"; moduleDefinition.ServerAssemblyName = "Oqtane.Server";
} }
else else
{ {
rootPath = Directory.GetParent(_environment.ContentRootPath).Parent.FullName + "\\" + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module\\"; rootPath = rootFolder.Parent.FullName + "\\" + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module\\";
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Client"; moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Client";
moduleDefinition.ServerAssemblyName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Server"; moduleDefinition.ServerAssemblyName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Server";
} }
ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, templatePath, moduleDefinition); ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, rootFolder.Name, templatePath, moduleDefinition);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Definition Created {ModuleDefinition}", moduleDefinition); _logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Definition Created {ModuleDefinition}", moduleDefinition);
Models.Module module = _modules.GetModule(int.Parse(moduleid)); Models.Module module = _modules.GetModule(int.Parse(moduleid));
@ -213,7 +214,7 @@ namespace Oqtane.Controllers
} }
} }
private void ProcessTemplatesRecursively(DirectoryInfo current, string rootPath, string templatePath, ModuleDefinition moduleDefinition) private void ProcessTemplatesRecursively(DirectoryInfo current, string rootPath, string rootFolder, string templatePath, ModuleDefinition moduleDefinition)
{ {
// process folder // process folder
string folderPath = rootPath + current.FullName.Replace(templatePath, ""); string folderPath = rootPath + current.FullName.Replace(templatePath, "");
@ -239,9 +240,11 @@ namespace Oqtane.Controllers
text = text.Replace("[Module]", moduleDefinition.Name); text = text.Replace("[Module]", moduleDefinition.Name);
text = text.Replace("[Description]", moduleDefinition.Description); text = text.Replace("[Description]", moduleDefinition.Description);
text = text.Replace("[RootPath]", rootPath); text = text.Replace("[RootPath]", rootPath);
text = text.Replace("[RootFolder]", rootFolder);
text = text.Replace("[ServerAssemblyName]", moduleDefinition.ServerAssemblyName); text = text.Replace("[ServerAssemblyName]", moduleDefinition.ServerAssemblyName);
text = text.Replace("[Folder]", folderPath); text = text.Replace("[Folder]", folderPath);
text = text.Replace("[File]", Path.GetFileName(filePath)); text = text.Replace("[File]", Path.GetFileName(filePath));
text = text.Replace("[FrameworkVersion]", Constants.Version);
System.IO.File.WriteAllText(filePath, text); System.IO.File.WriteAllText(filePath, text);
if (Path.GetExtension(filePath).ToLower() == ".sql" && !filePath.ToLower().Contains("uninstall")) if (Path.GetExtension(filePath).ToLower() == ".sql" && !filePath.ToLower().Contains("uninstall"))
@ -255,7 +258,7 @@ namespace Oqtane.Controllers
foreach (DirectoryInfo folder in folders.Reverse()) foreach (DirectoryInfo folder in folders.Reverse())
{ {
ProcessTemplatesRecursively(folder, rootPath, templatePath, moduleDefinition); ProcessTemplatesRecursively(folder, rootPath, rootFolder, templatePath, moduleDefinition);
} }
} }
} }