mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Adjusting generation commands to new data migration path and file names
--HG-- branch : dev
This commit is contained in:
parent
8162e6ee7a
commit
9696efe4bb
@ -7,7 +7,7 @@ using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace $$FeatureName$$.DataMigrations {
|
||||
public class $$ClassName$$DataMigration : DataMigrationImpl {
|
||||
public class Migration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
$$Commands$$
|
||||
|
@ -65,16 +65,16 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
return false;
|
||||
}
|
||||
|
||||
string dataMigrationsPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Name + "/DataMigrations/");
|
||||
string dataMigrationPath = dataMigrationsPath + extensionDescriptor.DisplayName + "DataMigration.cs";
|
||||
string dataMigrationFolderPath = HostingEnvironment.MapPath("~/Modules/" + extensionDescriptor.Name + "/");
|
||||
string dataMigrationFilePath = dataMigrationFolderPath + "Migration.cs";
|
||||
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard." + ModuleName + "/CodeGenerationTemplates/");
|
||||
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extensionDescriptor.Name));
|
||||
|
||||
if (!Directory.Exists(dataMigrationsPath)) {
|
||||
Directory.CreateDirectory(dataMigrationsPath);
|
||||
if (!Directory.Exists(dataMigrationFolderPath)) {
|
||||
Directory.CreateDirectory(dataMigrationFolderPath);
|
||||
}
|
||||
|
||||
if (File.Exists(dataMigrationPath)) {
|
||||
if (File.Exists(dataMigrationFilePath)) {
|
||||
Context.Output.WriteLine(T("Data migration already exists in target Module {0}.", extensionDescriptor.Name));
|
||||
return false;
|
||||
}
|
||||
@ -91,9 +91,8 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
|
||||
string dataMigrationText = File.ReadAllText(templatesPath + "DataMigration.txt");
|
||||
dataMigrationText = dataMigrationText.Replace("$$FeatureName$$", featureName);
|
||||
dataMigrationText = dataMigrationText.Replace("$$ClassName$$", extensionDescriptor.DisplayName);
|
||||
dataMigrationText = dataMigrationText.Replace("$$Commands$$", stringWriter.ToString());
|
||||
File.WriteAllText(dataMigrationPath, dataMigrationText);
|
||||
File.WriteAllText(dataMigrationFilePath, dataMigrationText);
|
||||
|
||||
string projectFileText = File.ReadAllText(moduleCsProjPath);
|
||||
|
||||
@ -370,6 +369,7 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
}
|
||||
else {
|
||||
var projectText = File.ReadAllText(_orchardWebProj);
|
||||
|
||||
// find where the first ItemGroup is after any References
|
||||
var refIndex = projectText.LastIndexOf("<Reference Include");
|
||||
if (refIndex != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user